Skip to content

Commit

Permalink
Bug Fixes (#306)
Browse files Browse the repository at this point in the history
* Do not convert chromosome names to lower case

* Bug fix: change to html to allow presentation of Dropbox chooser from Juicebox panel

* css tweaks

* IGV and Juicebox panels: dropdown menu css tweaks

* CNDB bug fix: support loading from ensemble group list

* Ensemble Group List: now properly sorted
  • Loading branch information
turner authored Dec 4, 2024
1 parent ca05964 commit 8daab32
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 10 deletions.
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,15 @@
<!-- Hi-C map file chooser -->
<li id="hic-file-chooser-dropdown" class="list-group-item mx-auto py-1 ps-1">
<div class="dropdown">
<button id="hic-contact-map-dropdown" class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">

<!-- <button id="hic-contact-map-dropdown" class="dropdown-toggle btn btn-sm btn-outline-secondary" type="button" data-bs-toggle="dropdown">-->
<!-- Load Hi-C Map-->
<!-- </button>-->

<a id="hic-contact-map-dropdown" class="dropdown-toggle" data-bs-toggle="dropdown">
Load Hi-C Map
</button>
</a>

<ul class="dropdown-menu">

<!-- ENCODE Maps -->
Expand Down
4 changes: 2 additions & 2 deletions js/datasource/CNDBDatasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CNDBDatasource extends DataSourceBase {

this.isPointCloud = await isPointCloud(hdf5, this.replicaKeys)

await this.updateWithReplicaKey(this.replicaKeys[ 0 ])
await this.updateWithEnsembleGroupKey(this.replicaKeys[ 0 ])

hideGlobalSpinner()

Expand All @@ -43,7 +43,7 @@ class CNDBDatasource extends DataSourceBase {
return { sample: 'Unspecified Sample', genomeAssembly }
}

async updateWithReplicaKey(replicaKey) {
async updateWithEnsembleGroupKey(replicaKey) {

this.currentReplicaKey = replicaKey

Expand Down
3 changes: 2 additions & 1 deletion js/juicebox/juiceboxPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ function juiceboxMouseHandler({ xBP, yBP, startXBP, startYBP, endXBP, endYBP, in
function isLiveMapSupported() {

const { chr } = ensembleManager.locus
const chromosome = igvPanel.browser.genome.getChromosome(chr.toLowerCase())
// const chromosome = igvPanel.browser.genome.getChromosome(chr.toLowerCase())
const chromosome = igvPanel.browser.genome.getChromosome(chr)
if (undefined === chromosome) {
console.warn(`Live Maps are not available for chromosome ${ chr }. No associated genome found`)
return false
Expand Down
3 changes: 2 additions & 1 deletion js/juicebox/liveMapState.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class LiveMapState extends hic.State {
const [ xBin, yBin] = [ genomicStart / binSize, genomicStart / binSize ]

// chromosome index
const chromosome = igvPanel.browser.genome.getChromosome(chr.toLowerCase())
// const chromosome = igvPanel.browser.genome.getChromosome(chr.toLowerCase())
const chromosome = igvPanel.browser.genome.getChromosome(chr)
let { order } = chromosome

super(1 + order, 1 + order, 0, xBin, yBin, width, height, pixelSize, 'NONE')
Expand Down
1 change: 0 additions & 1 deletion js/panel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import igv from 'igv'
import SpacewalkEventBus from './spacewalkEventBus.js'
import { makeDraggable } from "./utils/draggable.js"

Expand Down
16 changes: 15 additions & 1 deletion js/spacewalkFileLoadWidgetServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,21 @@ function createAndConfigureEnsembleGroupSelectModal(parentElement, ensembleGroup

selectElement.appendChild(createPlaceholderOptionElement())

for (const key of data ) {
// sort
const sorted = data.sort((a, b) => {
// Extract the first number after the initial string
const firstNumberA = parseInt(a.match(/^\D+(\d+)/)?.[1] || 0, 10);
const firstNumberB = parseInt(b.match(/^\D+(\d+)/)?.[1] || 0, 10);

// Extract the second number, whether it's foo23, foo_23, or foo_03
const secondNumberA = parseInt(a.match(/\D(\d+)$/)?.[1] || 0, 10);
const secondNumberB = parseInt(b.match(/\D(\d+)$/)?.[1] || 0, 10);

// Sort by the first number, then by the second number
return firstNumberA - firstNumberB || secondNumberA - secondNumberB;
});

for (const key of sorted ) {
const html = `<option value=\"${ key }\">${ key }</option>`
const fragment = document.createRange().createContextualFragment(html)
selectElement.appendChild(fragment.firstChild)
Expand Down
4 changes: 3 additions & 1 deletion js/utils/liveMapUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import SWBDatasource from "../datasource/SWBDatasource.js"
async function enableLiveMaps() {

const { chr } = ensembleManager.locus
const chromosome = igvPanel.browser.genome.getChromosome(chr.toLowerCase())

// let chromosome = igvPanel.browser.genome.getChromosome(chr.toLowerCase())
const chromosome = igvPanel.browser.genome.getChromosome(chr)

if (chromosome) {
if (ensembleManager.datasource instanceof SWBDatasource) {
Expand Down
10 changes: 10 additions & 0 deletions styles/_igv_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ $spacewalk_igv_panel_heigth: 256px;

a.dropdown-toggle {
color: unset;
text-decoration-line: unset;
cursor: pointer;
}

a.dropdown-toggle:hover {
border-color: rgba(0, 0, 0, 0.3);
border-style: solid;
border-width: thin;
border-radius: 2px;
padding: 4px;
}
}

Expand Down
16 changes: 16 additions & 0 deletions styles/_juicebox_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@
.list-group {
width: 100%;
background-color: white;

#hic-contact-map-dropdown.dropdown-toggle {
color: unset;
text-decoration-line: unset;
cursor: pointer;
}

#hic-contact-map-dropdown.dropdown-toggle:hover {
border-color: rgba(0, 0, 0, 0.3);
border-style: solid;
border-width: thin;
border-radius: 2px;
padding: 4px;
}


#hic-live-contact-frequency-map-threshold-widget.list-group-item {
div.input-group {
width: 200px;
Expand Down
21 changes: 21 additions & 0 deletions styles/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion styles/app.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8daab32

Please sign in to comment.