Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing 9th column keys in gff3 #1068

Closed
nvteja opened this Issue Jun 11, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@nvteja
Copy link

nvteja commented Jun 11, 2018

Hello team,

I am loading a gff3 file with GFF3 storeClass and I want to change the color of the glyph based on the value of a key "GTExSampleCount" in the 9th column of my file, but I cannot get it to work. Below are the file and the json config

7   .   mRNA    114299729   114302120   166 .   .   ID=transcript:124139;Depth=7;SampleCount=61;GTExSampleCount=166
7   .   CDS 114299729   114299730   166 .   .   Parent=transcript:124139;SampleCount=61;GTExSampleCount=166
7   .   CDS 114302119   114302120   166 .   .   Parent=transcript:124139;SampleCount=61;GTExSampleCount=166
{   
    "category": "CRT samples / S12_9-1-M",
    "label": "S12_9-1-M_junction_data",
    "key": "S12_9-1-M_junction_data",
    "storeClass": "JBrowse/Store/SeqFeature/GFF3Tabix",
    "type": "CanvasFeatures",
    "urlTemplate": "ref_data/crt_junctions/S12_9-1-M.bam.gff3.sorted.gff3.gz",
    "onClick": { 
        "label": "<ul><li>#read count: {Depth}</li><li>#total CRT samples: {SampleCount}</li><li>#total GTEx samples: {GTExSampleCount}</li></ul>"
    },
    "compress": 0,
    "trackType": "CanvasFeatures",
    "style": {
        "strandArrow": false,
        "showLabels": false,
         "color": "function(feature){ if(feature.get('GTExSampleCount') > 0){return 'red';} return 'blue';}"
    }
}

I made sure the gff3 file is spaced by tabs. Also, "label" works properly in this track, i.e I can see Depth, SampleCount and GTExSampleCount values when I hover, but I cannot get either the "color" or "connectorColor" in style to work based on GTExSampleCount value. I am using JBrowse 1.12.5

What am I doing wrong?

Thanks,
Teja

@nvteja

This comment has been minimized.

Copy link
Author

nvteja commented Jun 11, 2018

I just found another issue.

I changed the color call back to get score instead of 'GTExSampleCount'

"color": "function(feature){ if(feature.get('score') > 0){return 'red';} return 'blue';}"

and it did NOT work with GFF3Tabix store, but when i unzipped the gff3 file and loaded it with the GFF3 store, it worked. ?!

Is this a bug with the GFF3Tabix store?

Teja.

@cmdcolin

This comment has been minimized.

Copy link
Contributor

cmdcolin commented Jun 23, 2018

I think you have to make it all lower case, e.g. feature.get('gtexsamplecount')

Potentially we could auto-lower case arguments to feature.get to avoid this confusion.

What is the issue with the score though? I think that if you had stored the score in the column 6 it would work in GFF3Tabix also

@cmdcolin

This comment has been minimized.

Copy link
Contributor

cmdcolin commented Jun 23, 2018

I created PR #1074 to help auto-lower-case argument names

@nvteja

This comment has been minimized.

Copy link
Author

nvteja commented Jun 25, 2018

Thank you, I will try using lowercase for all 9th column keys.

I dont know why feature.get('score') doesn't work with the GFFtabix, but it works with regular GFF3 (uncompressed).

@cmdcolin

This comment has been minimized.

Copy link
Contributor

cmdcolin commented Jun 25, 2018

I'm unable to reproduce the fact that feature.get('score') would not work on GFF3Tabix store

One aspect that might be of note though is that the color callback is called on the individual CDS features, not the parent transcript feature (you can confirm this by checking feature.get('type') inside your callback).

If you need to retrieve an attribute of the parent transcript in the color callback, then you can call feature.parent().get('score') for example

@rbuels rbuels added this to the 1.15.0 milestone Jun 30, 2018

@rbuels

This comment has been minimized.

Copy link
Collaborator

rbuels commented Jun 30, 2018

fixed by #1074

@rbuels rbuels closed this Jun 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.