diff --git a/src/entity_object.ts b/src/entity_object.ts index ff5ab25..b2b67aa 100644 --- a/src/entity_object.ts +++ b/src/entity_object.ts @@ -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 = []; } @@ -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; }