Skip to content

Commit

Permalink
Merge pull request #1294 from PathwayCommons/iss1148_all-hint-types
Browse files Browse the repository at this point in the history
Expanding hints scope
  • Loading branch information
fileoy authored Aug 9, 2024
2 parents dbd1ca0 + 0db7739 commit 38e4759
Show file tree
Hide file tree
Showing 8 changed files with 2,263 additions and 53 deletions.
33 changes: 21 additions & 12 deletions src/model/hint.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import _ from 'lodash';
import { ENTITY_TYPE } from './element/entity-type.js';

// Define constants for Hint types, combining ORGANISM with ENTITY_TYPE
const HINT_TYPE = Object.freeze({
ORGANISM: 'organism',
});
const HINT_TYPE = Object.freeze(
_.assign(
{
ORGANISM: 'organism',
DISEASE: 'disease',
CELL_LINE: 'cell_line',
VARIANT: 'variant',
},
ENTITY_TYPE,
),
);

// Flatten the HINT_TYPE object to create an array of all hint types
const HINT_TYPES = _.flatMap(HINT_TYPE);
Expand All @@ -23,17 +32,17 @@ const SECTIONS = _.flatMap(SECTION);
class Hint {
/**
* Creates an instance of Hint.
* @param {Array} param.texts - The texts associated with the hint.
* @param {string} param.type - The type of the hint.
* @param {Object} param.xref - The cross-reference (xref) object.
* @param {string} param.section - The section of the document where the hint was found.
* @param {Array} texts - The texts associated with the hint.
* @param {string} type - The type of the hint.
* @param {Object} xref - The cross-reference (xref) object.
* @param {string} section - The section of the document where the hint was found.
*/
constructor(texts, type, xref, section) {
// Initialize the properties using the setters to enforce validation
this._texts = texts;
this._type = type;
this._xref = xref;
this._section = section;
// Use setters to initialize properties and enforce validation
this.texts = texts;
this.type = type;
this.xref = xref;
this.section = section;
}

// Getter and setter for texts
Expand Down
18 changes: 16 additions & 2 deletions src/server/routes/api/document/hint/pubtator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,32 @@ function map(bioCDocument) {

// See Table 1 https://www.ncbi.nlm.nih.gov/research/pubtator3/tutorial
const PUBTATOR_ANNOTATION_TYPE = Object.freeze({
GENE: 'Gene',
SPECIES: 'Species',
// could add more types here when scope expands
CHEMICAL: 'Chemical',
DISEASE: 'Disease',
CELL_LINE: 'CellLine',
// VARIANT: 'Variant',
});
const PUBTATOR_DATABASE = Object.freeze({
ncbi_gene: 'ncbi_gene',
ncbi_taxonomy: 'ncbi_taxonomy',
// could add more databases here when scope expands
ncbi_mesh: 'ncbi_mesh',
cvcl: 'cvcl',
litvar: 'litvar',
});
const entityTypes = new Map([
[PUBTATOR_ANNOTATION_TYPE.GENE, HINT_TYPE.GGP],
[PUBTATOR_ANNOTATION_TYPE.SPECIES, HINT_TYPE.ORGANISM],
[PUBTATOR_ANNOTATION_TYPE.CHEMICAL, HINT_TYPE.CHEMICAL],
[PUBTATOR_ANNOTATION_TYPE.DISEASE, HINT_TYPE.DISEASE],
[PUBTATOR_ANNOTATION_TYPE.CELL_LINE, HINT_TYPE.CELL_LINE],
]);
const database2Xref = new Map([
[PUBTATOR_DATABASE.ncbi_gene, COLLECTIONS.NCBI_GENE],
[PUBTATOR_DATABASE.ncbi_taxonomy, COLLECTIONS.NCBI_TAXONOMY],
[PUBTATOR_DATABASE.ncbi_mesh, COLLECTIONS.MESH],
[PUBTATOR_DATABASE.cvcl, COLLECTIONS.CELLOSAURUS],
]);

/**
Expand Down
45 changes: 32 additions & 13 deletions src/util/registry.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
const COLLECTIONS = Object.freeze({
PUBMED: {
dbname: 'PubMed',
dbPrefix: 'pubmed'
},
/**
* The Taxonomy Database is a curated classification and nomenclature for all of the organisms
* in the public sequence databases. This currently represents about 10% of the described species of life on the planet.
*/
NCBI_TAXONOMY: {
dbname: 'NCBI Taxonomy',
dbPrefix: 'NCBITaxon'
}
PUBMED: {
dbname: 'PubMed',
dbPrefix: 'pubmed',
},
NCBI_GENE: {
dbName: 'NCBI Gene',
dbPrefix: 'NCBIGene',
},
/**
* The Taxonomy Database is a curated classification and nomenclature for all of the organisms
* in the public sequence databases. This currently represents about 10% of the described species of life on the planet.
*/
NCBI_TAXONOMY: {
dbname: 'NCBI Taxonomy',
dbPrefix: 'NCBITaxon',
},
MESH: {
dbName: 'MeSH',
dbPrefix: 'mesh',
},
CHEBI: {
dbName: 'ChEBI',
dbPrefix: 'CHEBI',
},
CELLOSAURUS: {
dbName: 'CELLOSAURUS',
dbPrefix: 'cellosaurus',
},
UNIPROT: {
dbName: 'UniProt Knowledgebase',
dbPrefix: 'uniprot',
},
});

export { COLLECTIONS };

Loading

0 comments on commit 38e4759

Please sign in to comment.