Skip to content

Commit

Permalink
feat: make CNV file optional (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
crfmc authored Mar 5, 2024
1 parent e24b7a8 commit 86a6e51
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/docs/loading-data/through-data-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`). |
Expand Down
2 changes: 1 addition & 1 deletion src/data/samples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]
Expand Down
5 changes: 2 additions & 3 deletions src/ui/sample-config-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -155,14 +155,13 @@ export default function SampleConfigForm(props: { onAdd: (config: ValidSampleCon
/>

<div className="menu-subtitle">
CNV<sup>*</sup> <small>(.txt)</small>
CNV <small>(.txt)</small>
</div>
{/* <span className="menu-subtitle-right">Required</span> */}
<input
type="text"
className={testOkay.cnv(sampleConfig) ? 'menu-text-input' : 'menu-text-input-invalid'}
placeholder="https://..."
required
onChange={e => setSampleConfig({ ...sampleConfig, cnv: e.currentTarget.value })}
value={sampleConfig.cnv}
/>
Expand Down

0 comments on commit 86a6e51

Please sign in to comment.