Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding hints scope #1294

Merged
merged 4 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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