jbrowse-components icon indicating copy to clipboard operation
jbrowse-components copied to clipboard

Add @jbrowse/cli method to create a MultiQuantitativeTrack

Open cmdcolin opened this issue 2 years ago • 6 comments
trafficstars

Similar to https://github.com/GMOD/jbrowse-components/issues/3410

cmdcolin avatar Dec 29 '22 02:12 cmdcolin

cc @scottcain

cmdcolin avatar Dec 29 '22 02:12 cmdcolin

Note also that the bigWigs array in the MultiBigWig adapter does not accept a list of multiple files. This should be documented or fixed. Reason being is they have no concept of the baseUri, which is only added to attributes in the config that are {"uri":"..."}

Note also that the bigWigs array in the MultiBigWig adapter does not accept a list of multiple files. This should be documented or fixed. Reason being is they have no concept of the baseUri, which is only added to attributes in the config that are {"uri":"..."}

this could possibly be addressed by adding a "baseUri" (for the index.html essentially) and "configBaseUri" (for the config.json) to the environment of the config. this would avoid having to make it a true config slot on every config type, and would allow code to obtain it more easily.

the current method is manually "patching the config uris at load time" that only works in jbrowse-web, and this change would be more of a dynamic runtime behavior that could also apply to other apps like embedded

cmdcolin avatar Jan 10 '23 17:01 cmdcolin

some tangential discussion moved to https://github.com/GMOD/jbrowse-components/issues/3562

cmdcolin avatar Mar 04 '23 00:03 cmdcolin

Hi @cmdcolin, I am Rajat Partani. I wanted to get started with development in jbrowse. Is this a good starting point for me? Can I work on this issue?

raj1701 avatar Mar 04 '23 09:03 raj1701

Hi, any progress about this topic?

luoxun-xl avatar Jan 30 '24 16:01 luoxun-xl

@luoxun-xl hi there

there have not been any updates so far but I think it would still be a good idea.

in the meantime, i would basically "hand edit" the config.json code, or write a small script to auto-generate the track to add to the config.json. here is an example node.js script that can add a MultiQuantiativeTrack

const fs = require('fs')
const config = JSON.parse(fs.readFileSync('config.json', 'utf8'))
const path = require('path')
config.tracks.push({
  type: 'MultiQuantitativeTrack',
  trackId: process.argv[2],
  name: process.argv[2],
  assemblyNames: [process.argv[3]],
  adapter: {
    type: 'MultiWiggleAdapter',
    subadapters: process.argv.slice(4).map(uri => ({
      type: 'BigWigAdapter',
      bigWigLocation: { uri },
      name: path.basename(uri),
    })),
  },
})
fs.writeFileSync('config.json', JSON.stringify(config, null, 2))

Usage:

node generate_multi_wiggle.js MyTrackName hg19 url1.bw url2.bw url3.bw

Run this script in the same folder as your config.json and it will be updated. The first argument to the script is the track name (also used as id) second argument is the assembly name and the rest of the args are bigwig files that are in the same directory as the config.json, or are absolute URLs to files on the web

some docs on the config format https://jbrowse.org/jb2/docs/config_guides/multiquantitative_track/#multiquantitativetrack-config

there is the simpler "bigWigs" array but it does not allow relative URLs right now, so the script above uses the "subadapters" array which allows relative paths to bigwig files in your data directory

cmdcolin avatar Jan 30 '24 22:01 cmdcolin