Skip to content

Commit

Permalink
Make any non-bigWig bigType track open as BigBedAdapter in UCSC conne…
Browse files Browse the repository at this point in the history
…ctions (#4796)
  • Loading branch information
cmdcolin authored Jan 28, 2025
1 parent c77d33e commit 767f4cc
Show file tree
Hide file tree
Showing 19 changed files with 276 additions and 145 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Install website deps (with cache)
uses: bahmutov/npm-install@v1
with:
Expand All @@ -37,7 +37,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Build codebase
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Build project
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
- name: Check codebase format
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js 20
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Install deps
Expand All @@ -53,7 +53,7 @@ jobs:
name: Build Windows desktop app
runs-on: ubuntu-latest
container:
image: docker://node:20-bullseye
image: docker://node:22-bullseye
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -107,10 +107,10 @@ jobs:
with:
persist-credentials: false

- name: Use Node.js 20
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Install build deps
run: |
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Expand All @@ -135,10 +135,10 @@ jobs:
with:
persist-credentials: false

- name: Use Node.js 20
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Install build deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion docs/generateConfigDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getAllFiles,
removeComments,
rm,
} from './util'
} from './util.ts'

interface Derives {
name: string
Expand Down
2 changes: 1 addition & 1 deletion docs/generateStateModelDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getAllFiles,
removeComments,
rm,
} from './util'
} from './util.ts'

interface Action {
name: string
Expand Down
2 changes: 2 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"strict": true,
"declaration": true,
"module": "commonjs",
"noEmit": true,
"allowImportingTsExtensions": true,
"moduleResolution": "node"
},
"include": ["generateConfigDocs.ts", "generateStateModelDocs.ts", "util.ts"]
Expand Down
193 changes: 90 additions & 103 deletions plugins/data-management/src/UCSCTrackHub/ucscTrackHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,24 @@ export function generateTracks({
parentTracks.push(trackDb.data[currentTrackName])
}
} while (currentTrackName)
parentTracks.reverse()
const categories = parentTracks
.map(p => p?.data.shortLabel)
.filter((f): f is string => !!f)
const res = makeTrackConfig({
return makeTrackConfig({
track,
categories,
trackDbLoc,
trackDb,
sequenceAdapter,
categories: parentTracks
.reverse()
.map(p => p?.data.shortLabel)
.filter((f): f is string => !!f),
})
return {
...res,
trackId: `ucsc-trackhub-${objectHash(res)}`,
assemblyNames: [assemblyName],
}
}
})
.filter(notEmpty)
.map(r => ({
...r,
trackId: `ucsc-trackhub-${objectHash(r)}`,
assemblyNames: [assemblyName],
}))
}

function makeTrackConfig({
Expand Down Expand Up @@ -90,98 +89,87 @@ function makeTrackConfig({
? makeLoc(bigDataUrl, trackDbLoc)
: makeLoc2(bigDataUrl)

switch (baseTrackType) {
case 'bam':
return {
type: 'AlignmentsTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'BamAdapter',
bamLocation: bigDataLocation,
index: {
location: isUri
? makeLocAlt(bigDataIdx, `${bigDataUrl}.bai`, trackDbLoc)
: makeLoc2(bigDataIdx, `${bigDataUrl}.bai`),
},
if (baseTrackType === 'bam') {
return {
type: 'AlignmentsTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'BamAdapter',
bamLocation: bigDataLocation,
index: {
location: isUri
? makeLocAlt(bigDataIdx, `${bigDataUrl}.bai`, trackDbLoc)
: makeLoc2(bigDataIdx, `${bigDataUrl}.bai`),
},
}

case 'cram':
return {
type: 'AlignmentsTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'CramAdapter',
cramLocation: bigDataLocation,
craiLocation: isUri
? makeLocAlt(bigDataIdx, `${bigDataUrl}.crai`, trackDbLoc)
: makeLoc2(bigDataIdx, `${bigDataUrl}.crai`),
sequenceAdapter,
},
}
case 'bigBarChart':
case 'bigBed':
case 'bigGenePred':
case 'bigChain':
case 'bigInteract':
case 'bigMaf':
case 'bigNarrowPeak':
case 'bigPsl':
return {
type: 'FeatureTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'BigBedAdapter',
bigBedLocation: bigDataLocation,
},
}
case 'bigWig':
return {
type: 'QuantitativeTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'BigWigAdapter',
bigWigLocation: bigDataLocation,
},
}
} else if (baseTrackType === 'cram') {
return {
type: 'AlignmentsTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'CramAdapter',
cramLocation: bigDataLocation,
craiLocation: isUri
? makeLocAlt(bigDataIdx, `${bigDataUrl}.crai`, trackDbLoc)
: makeLoc2(bigDataIdx, `${bigDataUrl}.crai`),
sequenceAdapter,
},
}
} else if (baseTrackType === 'bigWig') {
return {
type: 'QuantitativeTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'BigWigAdapter',
bigWigLocation: bigDataLocation,
},
}
} else if (baseTrackType.startsWith('big')) {
return {
type: 'FeatureTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'BigBedAdapter',
bigBedLocation: bigDataLocation,
},
}
} else if (baseTrackType === 'vcfTabix') {
return {
type: 'VariantTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'VcfTabixAdapter',
vcfGzLocation: bigDataLocation,
index: {
location: isUri
? makeLocAlt(bigDataIdx, `${bigDataUrl}.tbi`, trackDbLoc)
: makeLoc2(bigDataIdx, `${bigDataUrl}.tbi`),
},
}

case 'vcfTabix':
return {
type: 'VariantTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'VcfTabixAdapter',
vcfGzLocation: bigDataLocation,
index: {
location: isUri
? makeLocAlt(bigDataIdx, `${bigDataUrl}.tbi`, trackDbLoc)
: makeLoc2(bigDataIdx, `${bigDataUrl}.tbi`),
},
},
}

case 'hic':
return {
type: 'HicTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'HicAdapter',
hicLocation: bigDataLocation,
},
}

},
}
} else if (baseTrackType === 'hic') {
return {
type: 'HicTrack',
name,
description: data.longLabel,
category: categories,
adapter: {
type: 'HicAdapter',
hicLocation: bigDataLocation,
},
}
} else {
// unsupported types
// case 'peptideMapping':
// case 'gvf':
Expand All @@ -196,8 +184,7 @@ function makeTrackConfig({
// case 'bedRnaElements':
// case 'broadPeak':
// case 'coloredExon':
default:
return generateUnknownTrackConf(name, baseTrackType, categories)
return generateUnknownTrackConf(name, baseTrackType, categories)
}
}

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"exclude": [
"**/build/",
"**/docs/",
"**/dist/",
"**/esm/",
"**/lib/",
Expand Down
2 changes: 1 addition & 1 deletion website/docs/config/BigBedAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ scoreColumn: {
aggregateField: {
type: 'string',
description: 'An attribute to aggregate features with',
defaultValue: 'geneName',
defaultValue: 'geneName2',
}
```
19 changes: 18 additions & 1 deletion website/docs/config/VcfAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ reference the markdown files in our repo of the checked out git tag
```js
vcfLocation: {
type: 'fileLocation',
defaultValue: { uri: '/path/to/my.vcf', locationType: 'UriLocation' },
defaultValue: {
uri: '/path/to/my.vcf',
locationType: 'UriLocation',
},
}
```

#### slot: samplesTsvLocation

```js
samplesTsvLocation: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/samples.tsv',
description:
'tsv with header like name\tpopulation\tetc. where the first column is required, and is the sample names',
locationType: 'UriLocation',
},
}
```
Loading

0 comments on commit 767f4cc

Please sign in to comment.