GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
205 stars 61 forks source link

multi-track config from a CSV file or similar #2640

Open rbuels opened 2 years ago

rbuels commented 2 years ago

Sometimes people have a lot of different tracks that are all the same, but just differ in their metadata and in the data file they read from.

Example would be 10000 BAM files for rnaseq results of different samples. Want an alignments track for each of the BAM files, with the tracks only differing in their metadata and their data source.

might be a connection or might be a special kind of track

{
   type: "MultiTrack",
   trackDataSource: {
      url: "/path/to/some.csv"
   },
  configTemplate: {
      type: "AlignmentsTrack",
     // and all the rest of the track config here, maybe with templating similar to JB1 {refseq} stuff?
  }
}
gringer commented 2 years ago

I've been using faceted tracks for our RNASeq data as well; we've got about 160 different samples (mostly in-house, but some publicly-available data). Here's an example of our use (currently 20 possible sort / filter fields):

Screen Shot 2022-03-23 at 14 11 27

My proposal: include a 'trackId' field in the CSV file, and display a table in the interface with sortable fields. Clicking on lines in the CSV file activates/deactivates the associated track.

... I guess that's pretty much how JBrowse 1 does it at the moment.

gringer commented 2 years ago

Looking at the 'category' key, I'd be okay using the existing JSON structure for this, with slight modifications to make it match what the documentation says:

$ jbrowse add-track --help
...
--category=category                   Optional Comma separated string of categories to group tracks

Note the plural categories. This suggests that a track can appear in multiple categories. Currently the comma separation is used for defining the hierarchy, which seems to go against the way that JSON is usually interpreted.

My preference would be for the categories to be nested using /, as was possible in jbrowse1, with the comma duplicating the track entry and putting it into another nested location. For example:

  "category": [                                                                                                                                                                                 
    "run/GCMay22_S20",
    "countQC/HIGH",                                                                                                                                                                          
    "cellLine/4T1",
    "sampleType/p0_A_MFP_L"                                                                                                                                                                     
  ],                                                                                                                                                                                            

This approach sort-of already works thanks to the filter tracks dialog box (e.g. I can put in cellLine/4T1, and it will show just the 4T1 samples), it just doesn't duplicate tracks into multiple categories.