@lifeomic/cli
Version:
CLI for interacting with the LifeOmic PHC API.
89 lines (85 loc) • 2.76 kB
JavaScript
'use strict';
const { post } = require('../../ga4gh');
const print = require('../../print');
const { convertToISODateString } = require('../../dateConversion');
exports.command = 'create-structural-variant-set <datasetId>';
exports.desc = 'Create structural variant genomic resources by indexing a FNV file';
exports.builder = yargs => {
yargs.positional('datasetId', {
describe: 'The dataset Id.',
type: 'string'
}).option('name', {
describe: 'A friendly display name to use for the sequence resources',
demandOption: true,
alias: 'n',
type: 'string'
}).option('fnv-file', {
describe: 'The ID of the FNV file to index',
alias: 'f',
type: 'string',
demandOption: true
}).option('patient', {
describe: 'The patient ID to reference',
alias: 'p',
type: 'string',
demandOption: true
}).option('reference', {
demandOption: true,
choices: ['GRCh37', 'GRCh38'],
describe: 'The reference build',
alias: 'r',
type: 'string'
}).option('sequence-type', {
choices: ['germline', 'somatic', 'metastatic', 'ctDNA', 'rna'],
describe: 'The sequence type',
alias: 't',
type: 'string',
demandOption: true
}).option('test-type', {
describe: 'The genetic test type.',
type: 'string'
}).option('indexed-date', {
describe: 'The date the genetic test was performed.',
type: 'string'
}).option('performer-id', {
describe: 'The ID of the FHIR Organization resource that performed the sequencing.',
type: 'string'
}).option('test-id', {
describe: 'The ID of the test to use for grouping related genomic sets.',
type: 'string'
}).option('sequence-id', {
describe: 'The ID to use for the FHIR Sequence resource.',
type: 'string'
}).option('body-site', {
describe: 'The body site of the specimen.',
type: 'string',
demandOption: false
}).option('body-site-display', {
describe: 'The display field for the body-site.',
type: 'string',
demandOption: false
}).option('body-site-system', {
describe: 'The defining system of the provided body site.',
type: 'string',
demandOption: false
});
};
exports.handler = async argv => {
const response = await post(argv, '/fusionsets', {
datasetId: argv.datasetId,
fileId: argv.fnvFile,
name: argv.name,
patientId: argv.patient,
referenceSetId: argv.reference,
sequenceType: argv.sequenceType,
testType: argv.testType,
indexedDate: convertToISODateString(argv.indexedDate),
performerId: argv.performerId,
testId: argv.testId,
sequenceId: argv.sequenceId,
bodySite: argv.bodySite,
bodySiteSystem: argv.bodySiteSystem,
bodySiteDisplay: argv.bodySiteDisplay
});
print(response.data, argv);
};