Strand Determined Consistently Relative to Reference Genome (see the FLAG rather than XS tag) #485

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants
@tomoakin

tomoakin commented Jun 2, 2014

When viewing a BAM file of stranded RNA-seq data with JBrowse, the color of reads spanning an intron were shown with different color than other reads. Further looking the description, the strand are shown inconsistently, the read on an intron the strand is maked as relative to the transcript rather than the reference genome.

The cause of such behavior is that it looks on the XS tag if present, while in absence of XS tag it looks the FLAG. This makes inconsistent view. The patch attached does not check the XS tag and consistently follow the FLAG and therefore the strand is relative to genome.

Looking XS tag in itself could be a good thing. However, in that case, unknown should be treated as unknown. Having a switch to change the view between relative to transcript and relative to genome could worth to implement. But, that is beyond the scope of this pull request. Thank you.

@tomoakin

This comment has been minimized.

Show comment
Hide comment
@tomoakin

tomoakin Jun 3, 2014

To be clear what this patch intend, I show you what it looks like with current (1.11.4) and with the xs reference removed.

While current code renders as below
example with the current code

The altered code renders the same data as below
example with the altered code

tomoakin commented Jun 3, 2014

To be clear what this patch intend, I show you what it looks like with current (1.11.4) and with the xs reference removed.

While current code renders as below
example with the current code

The altered code renders the same data as below
example with the altered code

@tomoakin

This comment has been minimized.

Show comment
Hide comment
@tomoakin

tomoakin Jun 15, 2014

With the additional patch, paired-end stranded RNA-seq data can be clearly colored according to the strand of the read fragment (mRNA).

With the additional patch, paired-end stranded RNA-seq data can be clearly colored according to the strand of the read fragment (mRNA).

@tomoakin

This comment has been minimized.

Show comment
Hide comment
@tomoakin

tomoakin Jun 16, 2014

Here I show how it differs in the browser view, and that it is very helpful to understand the strand of the transcripts.

While the previous code renders as below
example view with the previous code

The altered code renders the same data as below
example view with the altered code

Here I show how it differs in the browser view, and that it is very helpful to understand the strand of the transcripts.

While the previous code renders as below
example view with the previous code

The altered code renders the same data as below
example view with the altered code

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Jun 16, 2014

Contributor

That looks great, but i guess i'm still trying to understand. These are paired end reads, and the strand color for the mate pair is being flipped to correspond to the direction of the actual transcript? So does this have any relevance to #207 ?

Contributor

cmdcolin commented Jun 16, 2014

That looks great, but i guess i'm still trying to understand. These are paired end reads, and the strand color for the mate pair is being flipped to correspond to the direction of the actual transcript? So does this have any relevance to #207 ?

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Jun 16, 2014

Contributor

Also #433

Contributor

cmdcolin commented Jun 16, 2014

Also #433

@tomoakin

This comment has been minimized.

Show comment
Hide comment
@tomoakin

tomoakin Jun 16, 2014

Thank you to let me know about #207 and #433. The color is simply according to the direction of read 1 of the pair. In TruSeq Stranded RNA seq kit, the read 1 will be the complementary strand. Thus, flipped relative to the transcript.

#207 primary request was showing a pair as connected. This is not achieved by this patch. In the comments you mentioned on the color. This is related and perhaps fulfilled the request.

#433 The idea looks similar. The major difference is when we flip the color. At the data store, the strand() function is just as close as the data is, and the color scheme is changed at the level of View, which was suggested by rbuels in the last comment.

Handling more than two reads per fragment or having two reads at the same direction is not well considered. All reads other than the first is flipped in this code. While SAM spec allows multi segment data, I don't see the SAM specify the direction relationships expected by sequencing method.

Thank you to let me know about #207 and #433. The color is simply according to the direction of read 1 of the pair. In TruSeq Stranded RNA seq kit, the read 1 will be the complementary strand. Thus, flipped relative to the transcript.

#207 primary request was showing a pair as connected. This is not achieved by this patch. In the comments you mentioned on the color. This is related and perhaps fulfilled the request.

#433 The idea looks similar. The major difference is when we flip the color. At the data store, the strand() function is just as close as the data is, and the color scheme is changed at the level of View, which was suggested by rbuels in the last comment.

Handling more than two reads per fragment or having two reads at the same direction is not well considered. All reads other than the first is flipped in this code. While SAM spec allows multi segment data, I don't see the SAM specify the direction relationships expected by sequencing method.

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Jul 21, 2014

Contributor

I would like to combine the pull request #473 with this pull request (#485), so that we get the best of both worlds. Does that sound fair?

Contributor

cmdcolin commented Jul 21, 2014

I would like to combine the pull request #473 with this pull request (#485), so that we get the best of both worlds. Does that sound fair?

@tomoakin

This comment has been minimized.

Show comment
Hide comment
@tomoakin

tomoakin Jul 21, 2014

This proposal (#485) is to ignore the XS tag at all (commit: e84ffe8), while #473 is to follow the XS tag. To get both to work, IMHO, a dispatch based on some configuration at a higher level should be implemented. I just could not figure out how to write that toplevel switch, and I do not need locally both...

This proposal (#485) is to ignore the XS tag at all (commit: e84ffe8), while #473 is to follow the XS tag. To get both to work, IMHO, a dispatch based on some configuration at a higher level should be implemented. I just could not figure out how to write that toplevel switch, and I do not need locally both...

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Aug 1, 2014

Contributor

Hi tomoakin
I created a patch that proposes two flags: useXS and useReversedTemplate that can be applied to Alignments2 tracks. Would you be able to review the useReversedTemplate flag? I can't be sure if the logic is correct since I don't have any paired end data available, but i'm interested if this works.

Comparison
https://github.com/GMOD/jbrowse/compare/xs_config

Contributor

cmdcolin commented Aug 1, 2014

Hi tomoakin
I created a patch that proposes two flags: useXS and useReversedTemplate that can be applied to Alignments2 tracks. Would you be able to review the useReversedTemplate flag? I can't be sure if the logic is correct since I don't have any paired end data available, but i'm interested if this works.

Comparison
https://github.com/GMOD/jbrowse/compare/xs_config

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Feb 7, 2015

Contributor

Fixed by merging xs_config

Contributor

cmdcolin commented Feb 7, 2015

Fixed by merging xs_config

@cmdcolin cmdcolin closed this Feb 7, 2015

cmdcolin added a commit that referenced this pull request Feb 10, 2015

Add useReverseTemplateOption and useXSOption checkboxes. Also rename …
…useReversedTemplate to useReverseTemplate. See #485
@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Feb 10, 2015

Contributor

I just wanted to note that I made a checkbox for this option too. The motivation is similar to the one for #502 where the user might want it for File->Open or similar things.

Contributor

cmdcolin commented Feb 10, 2015

I just wanted to note that I made a checkbox for this option too. The motivation is similar to the one for #502 where the user might want it for File->Open or similar things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment