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

change tracks display by using functions or config file #41

Open
mgabriel01 opened this issue Apr 26, 2024 · 1 comment
Open

change tracks display by using functions or config file #41

mgabriel01 opened this issue Apr 26, 2024 · 1 comment

Comments

@mgabriel01
Copy link

Hello,
Thank you for this nice tool.

Is there a way to change the display of the tracks by using the functions assembly(), track_feature(), track_alignments(), default_session(), or at least a config file?
For example, by default we have the genome in forward and reverse, and the corresponding translation in 3 frames, is there an easy way to reduce this ?

Thank you in advance for your answer !

Best,

Marc G.

@BELKHIR
Copy link

BELKHIR commented Sep 5, 2024

Hello,

This is my solution to disable reverse sequence and translation for genome (assembly) track.
I wrote a function "mydefault_session()" that replace default_session by adding the showXX to the display section.

This new function is then used this way :

set up the default session for the browser using the new function

default_session <- mydefault_session(
assembly,
c(annotations_track)
)

mydefault_session <- function(assembly, displayed_tracks, display_assembly = TRUE) {
assembly_name <- JBrowseR:::get_assembly_name(assembly)

configuration <- stringr::str_c(assembly_name, "-ReferenceSequenceTrack")

if (display_assembly) {
reference_track= as.character(
stringr::str_glue(
"{{ ",
'"type": "ReferenceSequenceTrack", ',
'"configuration": "{configuration}", ',
'"displays": [ ',
"{{ ",
'"type": "LinearReferenceSequenceDisplay", ',
'"configuration": "{stringr::str_c(configuration, "-LinearReferenceSequenceDisplay")}",',
'"showForward": true,',
'"showReverse": false,',
'"showTranslation": false',
"}}",
"]",
"}}"
)
)
} else {
reference_track = ""
}

tracks <- JBrowseR:::get_tracks(assembly, displayed_tracks, display_assembly)

as.character(
stringr::str_glue(
"{{ ",
'"name": "My Session", ',
'"view": {{ ',
'"id": "LinearGenomeView", ',
'"type": "LinearGenomeView", ',
'"tracks": [ ',
"{reference_track} ",
"{tracks} ",
"] ",
"}} ",
"}}"
)
)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants