GMOD / jbrowse

JBrowse 1, a full-featured genome browser built with JavaScript and HTML5. For JBrowse 2, see https://github.com/GMOD/jbrowse-components.
http://jbrowse.org
Other
460 stars 199 forks source link

Display of metrics and other information for gene models in JBrowse #1568

Closed sanyalab closed 3 years ago

sanyalab commented 3 years ago

Hello,

How does one display scores, coverage, identity and other useful metrics for a genemodel in JBrowse? The Attributes column of my gff3 looks something like below.

ID=dpgm00g000390.646.1;Parent=dpgm00g000390.646;Name=dpgm00g000390.646.1;5utr=complete;3utr=partial;AED=0.33;LogEVM=21.35;Annot_Conf=High;Note= Cox1 | gfam070157 | COX1 domains

If I wanted to display the AED, Annot_Conf, 5utr, 3utr values by the side of the gene model ID, how would I do that? In future there might be more info here, like coverage, identity, matches etc.

If I shift them to the "Note= " field the description line gets too big. Also the gff3 would look odd messing up other downstream applications. Any ideas?

Thanks

cmdcolin commented 3 years ago

@sanyalab you can use the callback functions in the config file to make the feature labels to display how you want them

for example I can write

"style": {
   "label": "function(f) { return f.get('name') + ' - ' + f.get('aed') }"
}

Note that this is called on features and subfeatures so you might want to conditionally display the "aed" part if it doesn't exist on subfeatures

"style": {
   "label": "function(f) { var aed = f.get('aed'); return `${f.get('name')}${aed? (' - '+aed) : '' }"
}
sanyalab commented 3 years ago

Hi Colin,

I want to implement this in Apollo. So I would change the Apollo.config file I suppose.

However, I was wondering if I can do the same by scripting so that there is a little more flexibility. I run flatfile-to-json.pl to format my gff3 file. Is there anyway of specifying what you mention in this command? There are 2 parameters "--clientConfig" and "--config". Can I use these? If so how?

Thank you for the advice.

Best Regards Abhijit

cmdcolin commented 3 years ago

Sorry for the delay :+1:

However, I was wondering if I can do the same by scripting so that there is a little more flexibility. I run flatfile-to-json.pl to format my gff3 file. Is there anyway of specifying what you mention in this command? There are 2 parameters "--clientConfig" and "--config". Can I use these? If so how?

Can use --clientConfig this specifically outputs entries inside the "style" section of the config

Example

 bin/flatfile-to-json.pl --gff docs/tutorial/data_files/volvox.gff3 --type mRNA --clientConfig "{\"label\": \"function(f) { return f.get('name') + ' - ' + f.get('aed') }\"}"  --trackLabel testing --out sample_data/json/volvox
cmdcolin commented 3 years ago

@sanyalab let me know if that helps :) just following up

sanyalab commented 3 years ago

Hi Colin,

Have yet to implement the same. Will let you know soon. Thank you for the support.

Best Regards Abhijit

On Wed, Jan 6, 2021 at 12:55 AM Colin Diesh notifications@github.com wrote:

@sanyalab https://github.com/sanyalab let me know if that helps :) just following up

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse/issues/1568#issuecomment-754847237, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE545CO5J7JHO4UHP45QEB3SYNRS7ANCNFSM4VH2BCUQ .

sanyalab commented 3 years ago

Hi Colin,

The solution you gave worked very well. Furthermore, I discovered that one can choose to put the descriptions at only two places "label" or "description". If one wants more data to be displayed, an option is to separate it with "commas". Thank you for the code.

I have another ask. I am trying to get Apollo to display sashimi plots. It appears that this is a JBrowse plugin. I want to use a junctions.bed file loaded with flatfile-to-json.pl. Just confirming if the command would go something like below

flatfile-to-json.pl --bed /Path/2/junctions.bed --trackType HTMLFeatures --arrowheadClass trellis-arrowhead --className container-16px --type mRNA --clientConfig '{\"label\":\"id\", \"description\":\"classification,name,note,description\", \"storeClass\" : \"JBrowse/Store/SeqFeature/NCList\", \"urlTemplate\" : \"tracks/test/{refseq}/trackData.json\", \"type\" : \"SashimiPlot/View/Track/Sashimi\", \"label\" : \"From_junctions_bed\" }' --trackLabel Sashmi-Plot --out /Path/2/JBrowse/data/"

I do not know the json format very well, and have always been curious as to how the paths mentioned in "urlTemplate" or "storeClass" get deconvoluted. Do these come from the data directory? In that case would I need to change it for my specific case?

Thank you for your help and guidance

Best Regards Abhijit

On Wed, Jan 6, 2021 at 8:39 PM Abhijit Sanyal abhijit.synl@gmail.com wrote:

Hi Colin,

Have yet to implement the same. Will let you know soon. Thank you for the support.

Best Regards Abhijit

On Wed, Jan 6, 2021 at 12:55 AM Colin Diesh notifications@github.com wrote:

@sanyalab https://github.com/sanyalab let me know if that helps :) just following up

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse/issues/1568#issuecomment-754847237, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE545CO5J7JHO4UHP45QEB3SYNRS7ANCNFSM4VH2BCUQ .

cmdcolin commented 3 years ago

@sanyalab this worked for me...maybe I'll add to the sashimiplot docs

bin/flatfile-to-json.pl --bed junctions.bed --trackType SashimiPlot/View/Track/Sashimi --out hg19 --trackLabel sashimi_junctions

cmdcolin commented 3 years ago

As far as how the parameters are interpreted

urlTemplate is the path to the file that is relative to the data directory storeClass is the name of a JBrowse class, so in your config file your see JBrowse/Store/SeqFeature/NCList then the jbrowse source code it refers to src/JBrowse/Store/SeqFeature/NCList.js

type is sort of similar so if your config says "type": "CanvasFeatures" it automatically looks in src/JBrowse/View/Track folder so it resolves with src/JBrowse/View/Track/CanvasFeatures.js, but if we supply something different like "type":"SashimiPlot/View/Track/Sashimi", then it knows to look in plugins/SashimiPlot/js/View/Track/Sashimi.js

Note that these are not actual file paths referred to in the config....more it resolves names of modules that roughly correspond to the folder paths but are not exactly folder paths...and you have to use a "dev" version of jbrowse and run ./setup.sh after downloading the plugin to make it work (see http://gmod.org/wiki/JBrowse_FAQ#How_do_I_install_a_plugin)

sanyalab commented 3 years ago

Hi Colin,

Thank you for the explanation. I tried your code, but it did not work for me. Attached is what I see (capture-1.png)

I then used the below code, and that seemed to work ok

flatfile-to-json.pl --bed junctions.bed --trackType HTMLFeatures --className feature --clientConfig '{\"storeClass\" : \"JBrowse/Store/SeqFeature/NCList\", \"type\" : \"SashimiPlot/View/Track/Sashimi\" }' --trackLabel sashimi-plot --out /apollo/genome/data/

However, I cannot see the arcs. Attached image capture2.png is what happens. Can you tell me how to get the arcs? Is this a HTMLFeatures versus CanvasFeatures thing?

Thanks Abhijit

On Sat, Feb 13, 2021 at 11:37 AM Colin Diesh notifications@github.com wrote:

As far as how the parameters are interpreted

urlTemplate is the path to the file that is relative to the data directory storeClass is the name of a JBrowse class, so in your config file your see JBrowse/Store/SeqFeature/NCList then the jbrowse source code it refers to src/JBrowse/Store/SeqFeature/NCList.js

type is sort of similar so if your config says "type": "CanvasFeatures" it automatically looks in src/JBrowse/View/Track folder so it resolves with src/JBrowse/View/Track/CanvasFeatures.js, but if we supply something different like "type":"SashimiPlot/View/Track/Sashimi", then it knows to look in plugins/SashimiPlot/js/View/Track/Sashimi.js

Note that these are not actual file paths referred to in the config....more it resolves names of modules that roughly correspond to the folder paths but are not exactly folder paths...and you have to use a "dev" version of jbrowse and run ./setup.sh after downloading the plugin to make it work (see http://gmod.org/wiki/JBrowse_FAQ#How_do_I_install_a_plugin)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse/issues/1568#issuecomment-778569801, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE545CNKQQZOVAYAA54PBZLS6YJJVANCNFSM4VH2BCUQ .

cmdcolin commented 3 years ago

I don't think that github received the attached images

sanyalab commented 3 years ago

Oh Ok... Here it is. Please see attached Capture-1 Capture2

sanyalab commented 3 years ago

In Capture-2.png above the light pink bars are the junctions. I also have Fgenesh, Augustus in orange, BigWig bam track in Blue and Pasa assemblies in green.

cmdcolin commented 3 years ago

@sanyalab you said "I tried your code, but it did not work for me."

Does it give you the error about "Failed to load resource SashimiPlot/View/Track/Sashimi" when you do this? This means that the SashimiPlot plugin is not installed

You may want to refer to https://genomearchitect.readthedocs.io/en/latest/Configure.html#jbrowse-plugins-and-configuration

See here in the apollo guide for an example with sashimiplot https://github.com/GMOD/Apollo/blob/develop/grails-app/conf/Config.groovy#L452-L462

sanyalab commented 3 years ago

Yes Colin. The "Failed to load resource SashimiPlot/View/Track/Sashimi" happens when I tried your code.

I'll check out the plugin installation. I have JBrowse installed via conda. So hopefully this will work. Also just for my info, does Apollo or JBrowse throw errors if some tracks are type HTMLFeatures and some are Canvas? I use HTMLFeatures since I have to edit gene models and Canvas doe not allow that.

Thanks Abhijit

sanyalab commented 3 years ago

I have Apollo installed via the docker image. So I don't think I can make the change. I presently run my commands to write the tracks in the /data directory via JBrowse installed in conda. But I use Apollo via docker.

I ran the following command and ended up with an error "junctions.bed Not Found"

docker run --rm jbrowse/gmod-jbrowse bin/flatfile-to-json.pl --bed junctions.bed --trackType SashimiPlot/View/Track/Sashimi --out /capeAA0001/data/ --trackLabel sashimi_junctions

Giving the absolute path to the file also gives the same error.

cmdcolin commented 3 years ago

Sorry I don't have experience with running commands in docker, any ideas @nathandunn

nathandunn commented 3 years ago

@sanyalab If junctions.bed is local, then you need to provide the "docker" path of the embedded file. Docker is trying to look for it within the unix system. What command where you using to run it?

Not sure what your mounted directory structure is, but if you are mounting /capeAA0001/data to the same within the docker image, then you would copy copy junctions.bed to /capeAA0001/data and then run something like this?:

 docker run --rm jbrowse/gmod-jbrowse bin/flatfile-to-json.pl --bed /capeAA0001/data/junctions.bed --trackType SashimiPlot/View/Track/Sashimi --out /capeAA0001/data/ --trackLabel sashimi_junctions

I also often just do it from within the docker contain . . . docker exec -it <image> /bin/bash . . . that way you can play within things a bit easier and check if your mounts are working properly.

sanyalab commented 3 years ago

@nathandunn: Thank you for replying. Here is what is happening

I used the following command to load the BED file

docker run -v /test1:/test1 -v /cape:/cape --rm jbrowse/gmod-jbrowse bin/flatfile-to-json.pl --bed /test1/TEST/junctions.bed --trackType SashimiPlot/View/Track/Sashimi --out /cape/TEST1/data/ --trackLabel sashimi_junctions

The track gets loaded OK! But the track looks like the image above where the light pink bars are the junctions. I cannot see the arcs. Then I used the following command to look into the directory structure to find the apollo-config.groovy, so I can change it.

docker run -it gmod/apollo:release-2.6.0 ls -l apollo

This only shows me the apollo.war file. As you can guess I am learning docker via Apollo :)

So if I understand you correctly I can manipulate the image (This is not the WAR file correct) using the command

docker exec -it dockerImage /bin/bash vi

Will the above work? I am trying to open the image in "vi" for Manipulation

nathandunn commented 3 years ago

@sanyalab your initial command looks okay. At this point @cmdcolin will have to comment on why it is generating a light bar.

You can definitely run single command, but I was suggesting opening up a bash script to poke around:

docker run -it gmod/apollo:latest /bin/bash

however, it looks like everything is working on the apollo / docker end.

sanyalab commented 3 years ago

@cmdcolin I uncommented the Sashimiplot plugin in the Apollo-config.groovy file

SashimiPlot { git = 'https://github.com/cmdcolin/sashimiplot' branch = 'master' alwaysPull = "true" }`

Is this all the change I have to do in the groovy file? Do I also have to add a section about the Sashimiplot plugin in the jbrowse.conf?

-Abhijit

sanyalab commented 3 years ago

@cmdcolin : I was able to build a new Apollo docker file with the Sashimi plot changes (uncommented). It started working. Thanks for your support and hints from Nathan.

Best Regards Abhijit