Skip to content

Commit

Permalink
Fix using Color by modifications on BAM/CRAM that need ref renaming (#…
Browse files Browse the repository at this point in the history
…2128)

* Add assemblyName to the modifications rename

* Demo files

* Sample file

* Slightly better types to address lint warning about any
  • Loading branch information
cmdcolin authored Jul 14, 2021
1 parent f0da11b commit 5bd7b12
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/alignments/src/shared.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { BlockSet } from '@jbrowse/core/util/blockTypes'

import { getSession } from '@jbrowse/core/util'
import { getRpcSessionId } from '@jbrowse/core/util/tracks'
import {
getRpcSessionId,
getTrackAssemblyNames,
} from '@jbrowse/core/util/tracks'
import { IAnyStateTreeNode } from 'mobx-state-tree'
import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'

Expand Down Expand Up @@ -33,7 +36,9 @@ export async function getUniqueTagValues(
}

export async function getUniqueModificationValues(
self: IAnyStateTreeNode,
self: IAnyStateTreeNode & {
parentTrack: IAnyStateTreeNode & { configuration: AnyConfigurationModel }
},
adapterConfig: AnyConfigurationModel,
colorScheme: { type: string; tag?: string },
blocks: BlockSet,
Expand All @@ -53,6 +58,7 @@ export async function getUniqueModificationValues(
tag: colorScheme.tag,
sessionId,
regions: blocks.contentBlocks,
assemblyName: getTrackAssemblyNames(self.parentTrack)[0],
...opts,
},
)
Expand Down
63 changes: 63 additions & 0 deletions test_data/config_demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3163,6 +3163,69 @@
"uri": "https://jbrowse.org/genomes/GRCh38/methylation/modified_bases.5mC.bb"
}
}
},
{
"type": "AlignmentsTrack",
"trackId": "modbam_test.reference",
"name": "Nanopolish modbam_test.reference 20:10000000",
"assemblyNames": ["hg38"],
"category": ["Methylation"],
"adapter": {
"type": "BamAdapter",
"bamLocation": {
"uri": "https://jbrowse.org/genomes/hg19/nanopolish_methylation_test/modbam_test.reference.bam"
},
"index": {
"location": {
"uri": "https://jbrowse.org/genomes/hg19/nanopolish_methylation_test/modbam_test.reference.bam.bai"
},
"indexType": "BAI"
},
"sequenceAdapter": {
"type": "BgzipFastaAdapter",
"fastaLocation": {
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz"
},
"faiLocation": {
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz.fai"
},
"gziLocation": {
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz.gzi"
}
}
}
},

{
"type": "AlignmentsTrack",
"trackId": "modbam_test.read",
"name": "Nanopolish modbam_test.read 20:10000000",
"category": ["Methylation"],
"assemblyNames": ["hg38"],
"adapter": {
"type": "BamAdapter",
"bamLocation": {
"uri": "https://jbrowse.org/genomes/hg19/nanopolish_methylation_test/modbam_test.read.bam"
},
"index": {
"location": {
"uri": "https://jbrowse.org/genomes/hg19/nanopolish_methylation_test/modbam_test.read.bam.bai"
},
"indexType": "BAI"
},
"sequenceAdapter": {
"type": "BgzipFastaAdapter",
"fastaLocation": {
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz"
},
"faiLocation": {
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz.fai"
},
"gziLocation": {
"uri": "https://jbrowse.org/genomes/GRCh38/fasta/hg38.prefix.fa.gz.gzi"
}
}
}
}
],
"connections": [],
Expand Down

0 comments on commit 5bd7b12

Please sign in to comment.