From 86a6e519697fbc2586da0de0953b4c8e78f2b34e Mon Sep 17 00:00:00 2001 From: Cesar Ferreyra-Mansilla Date: Tue, 5 Mar 2024 14:51:32 -0500 Subject: [PATCH] feat: make CNV file optional (#132) --- docs/docs/loading-data/through-data-config.md | 2 +- src/data/samples.ts | 2 +- src/main-spec.ts | 4 ++-- src/ui/sample-config-form.tsx | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/docs/loading-data/through-data-config.md b/docs/docs/loading-data/through-data-config.md index d4a0eace..fbbe6a18 100644 --- a/docs/docs/loading-data/through-data-config.md +++ b/docs/docs/loading-data/through-data-config.md @@ -23,7 +23,7 @@ For each sample, you need to prepare the following information in a JSON object. | `cancer` | `string` | Required. Type of a cancer. | | `assembly` | `'hg38'` or `'hg19'` | Required. Assembly. | | `sv` | `string` | Required. An URL of the SV bedpe file (`.bedpe`). | -| `cnv` | `string` | Required. An URL of the CNV text file (`.tsv`). | +| `cnv` | `string` | Optional. An URL of the CNV text file (`.tsv`). | | `drivers` | `string` | Optional. An URL of a file that contains drivers (`.tsv` or `.json`). | | `vcf` | `string` | Optional. An URL of the point mutation file (`.vcf`). | | `vcfIndex` | `string` | Optional. An URL of the point mutation index file (`.tbi`). | diff --git a/src/data/samples.ts b/src/data/samples.ts index a152bf6a..c4bc19ea 100644 --- a/src/data/samples.ts +++ b/src/data/samples.ts @@ -20,7 +20,7 @@ export type SampleType = { cancer: string; // cancer type assembly: Assembly; // hg19 or 38 sv: string; // URL of bedpe - cnv: string; // URL of txt + cnv?: string; // URL of txt drivers?: { [k: string]: string | number }[] | string; bam?: string; bai?: string; diff --git a/src/main-spec.ts b/src/main-spec.ts index e4c97a40..b4a52d5d 100644 --- a/src/main-spec.ts +++ b/src/main-spec.ts @@ -315,9 +315,9 @@ function getOverviewSpec(option: SpecOption): View[] { }, tracks.driver(id, driversToTsvUrl(drivers), width, 40, 'top'), tracks.boundary('driver', 'top'), - tracks.gain(id, cnv, width, 40, 'top', cnFields), + cnv ? [tracks.gain(id, cnv, width, 40, 'top', cnFields)] : [], tracks.boundary('gain', 'top'), - tracks.loh(id, cnv, width, 40, 'top', cnFields), + cnv ? [tracks.loh(id, cnv, width, 40, 'top', cnFields)] : [], tracks.boundary('loh', 'top'), tracks.sv(id, sv, width, 80, 'top', selectedSvId) ] diff --git a/src/ui/sample-config-form.tsx b/src/ui/sample-config-form.tsx index 29b0211e..4fdf6d9b 100644 --- a/src/ui/sample-config-form.tsx +++ b/src/ui/sample-config-form.tsx @@ -24,8 +24,8 @@ const testOkay = { id: (_: SampleConfig) => _.id, cancer: (_: SampleConfig) => _.cancer, sv: (_: SampleConfig) => isValidUrl(_.sv), - cnv: (_: SampleConfig) => isValidUrl(_.cnv), // optional + cnv: (_: SampleConfig) => !_.cnv || isValidUrl(_.cnv), drivers: (_: SampleConfig) => !_.drivers || isValidUrl(_.drivers), vcf: (_: SampleConfig) => !_.vcf || isValidUrl(_.vcf), vcfIndex: (_: SampleConfig) => !_.vcfIndex || isValidUrl(_.vcfIndex), @@ -155,14 +155,13 @@ export default function SampleConfigForm(props: { onAdd: (config: ValidSampleCon />
- CNV* (.txt) + CNV (.txt)
{/* Required */} setSampleConfig({ ...sampleConfig, cnv: e.currentTarget.value })} value={sampleConfig.cnv} />