igvteam / igv.js

Embeddable genomic visualization component based on the Integrative Genomics Viewer
MIT License
640 stars 226 forks source link

Annotation Track Mishandling Spaces in BED Name Column #845

Closed dicara closed 5 years ago

dicara commented 5 years ago

We're providing a tab delimited BED file for the annotation track. If an annotation name contains a space, I would expect the whole name to appear with spaces. Instead, only that portion of the name prior to the space is displayed.

jrobinso commented 5 years ago

Is the name quoted? Bed files are whitespace delimited, not tab delimited, so a space denotes a break between columns.

jrobinso commented 5 years ago

Have you tried displaying this file at UCSC?

dicara commented 5 years ago

The BED file spec indicates fields in custom tracks can be whitespace-delimited or tab-delimited. Unfortunately, we chose to generate tab-delimited BEDs and I simply assumed spaces were allowed in names. I did test quoting the name, and that didn't seem to work either. I have not tried displaying it at UCSC. Perhaps one of the other annotation formats will work for my use case. GFF is tab-delimited - will IGV display whitespaced names for this format? I'll give that a try and close this issue if that's the case.

jrobinso commented 5 years ago

Actually, you can specify the delimiter in the track config. I had forgotten that. Something like this should work with your files

 {
  type: 'annotation',
  format: 'bed',
  delimiter: '\t',
  url: '../test/data/bed/4_column.tabs.bed'
}
dicara commented 5 years ago

Thanks Jim! Adding a delimiter resolved my issue - I can now see annotations that contain spaces.

odoublewen commented 5 years ago

@dicara or @jrobinso -- How do you get the label to show up in the browser track? I also have 4-column tab-delim bed files, and I can see rectangles for all of my features, but when I click on them I can only see, e.g.:

screen shot 2019-02-21 at 2 46 49 pm

Is a header required? I've tried with and without headers. My bed file looks like the test file 4_column.tabs.bed.

$ head protein_coding_genes_4col_header.bed
track name="Basic Features" color=255,0,0 height=50
chr1    65418   71585   OR4F5
chr1    450702  451697  OR4F29
chr1    685678  686673  OR4F16
chr1    923927  944581  SAMD11
chr1    944203  959309  NOC2L

And I'm specifying it like so:

      tracks: [
                     {
                        type: 'annotation',
                        name: 'protein_coding_genes_4col_header.bed',
                        format: 'bed',
                        delimiter: '\t',
                        url: 'https://dl.dnanex.us/F/D2/file-obfuscated',
                        headers: {"X-Authorization": "obfuscated"},
                    },
                   ]

Is there some setting to make the labels appear for bed files? (I'm aware of nameField for gff files -- is there an analog for bed files?)

Maybe something needs to be set in trackDefaults? The browser configuration wiki mentions trackDefaults:

Option Description
trackDefaults Embedded object defining default settings for specific track types (see table below).

But I can't seem to find any "table below" that pertains.

Thanks for any help!

jrobinso commented 5 years ago

@odoublewen You config is fine, that was a bug. Just pushed a fix.

odoublewen commented 5 years ago

I built from source and can confirm that your fix works! Thanks!