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
463 stars 199 forks source link

Question: JB1 reference sequence alias? #1618

Closed srobb1 closed 2 years ago

srobb1 commented 2 years ago

Hello all,

Is there a way to use and index aliases for reference sequences? I am using JBrowse version: 1.16.9. I have a large assembly for which the group is considering renaming a dozen scaffolds. I thought I have seen a way to include a list of names and aliases for references, but I can only find it for JB2.

Thank you, Sofia

cmdcolin commented 2 years ago

One possible way, you can replace the "ref renaming behavior" of jbrowse

I tried for example, changing a gff in our volvox test data to say "testingA" instead of "ctgA"

Then I made a custom ref renaming function in jbrowse.conf to say this:

replaceRefRename=function(ref) {
    if(ref==='testingA') { return 'ctgA' }
    else return ref;
 }

See replaceRefRename https://jbrowse.org/docs/global_options.html

note that the closing semi colon is spaced away from the left most column, a way to make multiline callbacks in the conf format :)

cmdcolin commented 2 years ago

note that replaceRefRename is only added in JBrowse 1.16.10 though https://jbrowse.org/blog/2020/09/24/jbrowse-1-16-10.html

srobb1 commented 2 years ago

Can I create my own custom function like you have above and add it into my functions.conf file? Or will I need to update to 1.16.10? I should update anyway...

cmdcolin commented 2 years ago

Yes, just put it in a [GENERAL] section e.g.


[GENERAL]
replaceRefRename=function(ref) {
    /* your code here, make sure to use proper semi-colons and js syntax */
 }

and make sure the code follows guidelines like this if using the conf format https://jbrowse.org/docs/configuration_file_formats.html#callback-function-specific-considerations-for-the-text-based-conf-format-

cmdcolin commented 2 years ago

but in order to use replaceRefRename you will need 1.16.10, not able to use that in 1.16.9

srobb1 commented 2 years ago

I updated to 1.16.11, created a function with my names and ran a test. It works great!

Thank you again @cmdcolin

Sofia

cmdcolin commented 2 years ago

cool :) i wasn't even sure this would work at first but glad it does

srobb1 commented 2 years ago

I only tested with one alias, but it seems logical that adding in more conditional statements will also work. I don't have a working list from the group yet, but wanted to see if I could get this working before I told them it was possible :)

cmdcolin commented 2 years ago

glad this helped...maybe can close for now!