Skip to content

Commit

Permalink
Merge pull request #156 from bcgsc/release/v8.0.2
Browse files Browse the repository at this point in the history
Release/v8.0.2
  • Loading branch information
mathieulemieux committed Jun 5, 2024
2 parents 8756b66 + 2bd2f6f commit 4c25b32
Show file tree
Hide file tree
Showing 20 changed files with 1,636 additions and 717 deletions.
17 changes: 11 additions & 6 deletions bin/load.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const fs = require('fs');
const path = require('path');

const { runLoader } = require('../src');
const { createOptionsMenu, fileExists } = require('../src/cli');

Expand Down Expand Up @@ -36,7 +33,12 @@ const cosmicResistance = require('../src/cosmic/resistance');
const cosmicFusions = require('../src/cosmic/fusions');

const API_MODULES = {
asco, dgidb, docm, fdaApprovals, moa, oncotree,
asco,
dgidb,
docm,
fdaApprovals,
moa,
oncotree,
};

const FILE_MODULES = {
Expand Down Expand Up @@ -102,6 +104,11 @@ civicParser.add_argument('--trustedCurators', {
help: 'CIViC User IDs of curators whose statements should be imported even if they have not yet been reviewed (evidence is submitted but not accepted)',
nargs: '+',
});
civicParser.add_argument('--noUpdate', {
action: 'store_true',
default: false,
help: 'Will not check for updating content of existing GraphKB Statements',
});

const clinicaltrialsgovParser = subparsers.add_parser('clinicaltrialsgov');
clinicaltrialsgovParser.add_argument('--days', {
Expand Down Expand Up @@ -132,14 +139,12 @@ let loaderFunction;
if (input) {
loaderFunction = ALL_MODULES[moduleName || subparser_name].uploadFile;
} else {
debugger;
loaderFunction = ALL_MODULES[moduleName || subparser_name].upload;
}

const loaderOptions = { ...options };

if (input) {
debugger;
loaderOptions.filename = input;
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bcgsc-pori/graphkb-loader",
"main": "src/index.js",
"version": "8.0.1",
"version": "8.0.2",
"repository": {
"type": "git",
"url": "https://github.com/bcgsc/pori_graphkb_loader.git"
Expand Down
41 changes: 41 additions & 0 deletions src/civic/disease.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { orderPreferredOntologyTerms } = require('../graphkb');

/**
* Given a CIViC EvidenceItem record with its disease property,
* returns the corresponding disease record from GraphKB
*
* @param {ApiConnection} conn graphkb API connector
* @param {object} param1
* @param {object} param1.rawRecord the EvidenceItem from CIViC
* @returns {object} the disease record from GraphKB
*/
const getDisease = async (conn, { rawRecord }) => {
let disease;

// Get corresponding GraphKB Disease by it's doid (disease ontology id)
if (rawRecord.disease) {
let diseaseQueryFilters = {};

if (rawRecord.disease.doid) {
diseaseQueryFilters = {
AND: [
{ sourceId: `doid:${rawRecord.disease.doid}` },
{ source: { filters: { name: 'disease ontology' }, target: 'Source' } },
],
};
} else {
diseaseQueryFilters = { name: rawRecord.disease.name };
}

disease = await conn.getUniqueRecordBy({
filters: diseaseQueryFilters,
sort: orderPreferredOntologyTerms,
target: 'Disease',
});
}
return disease;
};

module.exports = {
getDisease,
};
Loading

0 comments on commit 4c25b32

Please sign in to comment.