Skip to content

Commit

Permalink
feat: ✨ add customized logics for handing id_prefixes
Browse files Browse the repository at this point in the history
add additional IDs for Gene and ChemicalSubstance which is not defined in biolink model
  • Loading branch information
kevinxin90 committed Mar 1, 2021
1 parent 623a192 commit 9fd2166
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/entity_object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ export default class Entity implements BioLinkEntityObject {
private _description: string;
private _parent: string;
private _children: string[];
private _ancestors: Entity[];
private _descendants: Entity[];
private _id_prefixes: string[];
private _name: string;

constructor(name: string, info: BioLinkClassObject) {
this._name = name;
this._description = info.description;
this._id_prefixes = info.id_prefixes;
this.id_prefixes = info.id_prefixes;
this._parent = typeof info.is_a === 'undefined' ? info.is_a : pascalCase(info.is_a);
this._children = [];
}
Expand All @@ -30,6 +28,16 @@ export default class Entity implements BioLinkEntityObject {
return this._id_prefixes;
}

set id_prefixes(idPrefixes: string[]) {
if (this._name === "Gene") {
this._id_prefixes = [...["SYMBOL", "OMIM", "UMLS"], ...idPrefixes];
} else if (this._name === "ChemicalSubstance") {
this._id_prefixes = [...["UMLS"], ...idPrefixes]
} else {
this._id_prefixes = idPrefixes;
}
}

get name(): string {
return this._name;
}
Expand Down

0 comments on commit 9fd2166

Please sign in to comment.