Skip to content

Commit

Permalink
shoebox support - round 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Oct 12, 2024
1 parent b962c35 commit 78aec24
Show file tree
Hide file tree
Showing 11 changed files with 404 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions dev/shoebox/old/shoebox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Seg Big</title>

</head>

<body>

<h1>Shoebox</h1>


<div id="igvDiv" style="padding-top: 50px;padding-bottom: 20px; height: auto"></div>

<script type="module">

import igv from "../../js/index.js"

var options =
{
genome: "hg38"
}

var igvDiv = document.getElementById("igvDiv")

igv.createBrowser(igvDiv, options)
.then(function (browser) {
console.log("Created IGV browser")
browser.loadSession({url: "session.json"})
})


</script>

</body>

</html>
</title>
</head>
<body>

</body>
</html>
51 changes: 49 additions & 2 deletions dev/shoebox/shoebox.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,62 @@ <h1>Shoebox</h1>

var options =
{
genome: "hg38"
sampleNameViewportWidth: 6,
genome: "hg38",
locus: "chr1:1,001,575-1,002,408",
tracks: [
{
"url": "https://www.dropbox.com/scl/fi/2tv6vnqqlfy6kxzahshwc/pseudobulk_14.bed?rlkey=ytrotr3v197k26pe2dettfgsr&dl=0",
"name": "pseudobulk 14",
"type": "shoebox",
"format": "shoebox"
},
{
"name": "Homo sapiens HepG2 H3K4me3 ",
"url": "https://www.encodeproject.org/files/ENCFF752OCZ/@@download/ENCFF752OCZ.bigWig",
"color": "rgb(0,150,0)",
"metadata": {
"Biosample": "Homo sapiens HepG2",
"AssayType": "ChIP-seq",
"Target": "H3K4me3 ",
"BioRep": "1",
"TechRep": "1_1",
"OutputType": "signal p-value",
"Format": "bigWig",
"Lab": "John Stamatoyannopoulos, UW",
"Accession": "ENCFF752OCZ",
"Experiment": "ENCSR000DUF"
},
"format": "bigwig",
"type": "wig"
},
{
"name": "Homo sapiens HepG2 CTCF ",
"url": "https://www.encodeproject.org/files/ENCFF160QOX/@@download/ENCFF160QOX.bigWig",
"metadata": {
"Biosample": "Homo sapiens HepG2",
"AssayType": "ChIP-seq",
"Target": "CTCF ",
"BioRep": "1",
"TechRep": "1_1",
"OutputType": "fold change over control",
"Format": "bigWig",
"Lab": "Richard Myers, HAIB",
"Accession": "ENCFF160QOX",
"Experiment": "ENCSR000BIE"
},
"format": "bigwig",
"type": "wig"
}
]
}


var igvDiv = document.getElementById("igvDiv")

igv.createBrowser(igvDiv, options)
.then(function (browser) {
console.log("Created IGV browser")
browser.loadSession({url: "session.json"})
})


Expand Down
25 changes: 24 additions & 1 deletion js/feature/decode/ucsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,29 @@ function decodeSNP(tokens, header) {

}

function decodeShoebox(tokens, header, maxColumnCount = Number.MAX_SAFE_INTEGER) {

if (tokens.length < 4) return undefined

const chr = tokens[0]
const start = parseInt(tokens[1])
const end = tokens.length > 2 ? parseInt(tokens[2]) : start + 1
if (isNaN(start) || isNaN(end)) {
return new DecodeError(`Unparsable bed record.`)
}
const feature = new UCSCBedFeature({chr: chr, start: start, end: end, score: 1000})

const values = []
for(let i = 3; i< tokens.length; i++) {
values.push(Number.parseInt(tokens[i]))
}
feature.values = values;


return feature
}


class UCSCBedFeature {

constructor(properties) {
Expand Down Expand Up @@ -650,6 +673,6 @@ class PSLFeature {

export {
decodeBed, decodeBedGraph, decodeGenePred, decodeGenePredExt, decodePeak, decodeReflat, decodeRepeatMasker,
decodeSNP, decodeWig, decodePSL, decodeBedmethyl, decodeGappedPeak, decodeNarrowPeak
decodeSNP, decodeWig, decodePSL, decodeBedmethyl, decodeGappedPeak, decodeNarrowPeak, decodeShoebox
}

5 changes: 5 additions & 0 deletions js/feature/featureParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
decodePeak,
decodeReflat,
decodeRepeatMasker,
decodeShoebox,
decodeSNP,
decodeWig
} from "./decode/ucsc.js"
Expand Down Expand Up @@ -319,6 +320,10 @@ class FeatureParser {
this.decode = decodeGcnv
this.delimiter = "\t"
break
case "shoebox":
this.decode = decodeShoebox
this.delimiter = "\t"
break
default:
const customFormat = getFormat(format)
if (customFormat !== undefined) {
Expand Down
Loading

0 comments on commit 78aec24

Please sign in to comment.