ChristopherWilks / megadepth

BigWig and BAM utilities
Other
91 stars 9 forks source link

Junction strands #10

Open AlexWeinreb opened 2 years ago

AlexWeinreb commented 2 years ago

From the code, process_jx_output.sh always outputs only 0 in the strand column. I imagine it's because the megadepth --all-junctions column 5 only gives the mapping strand, which would be incorrect in some cases. But in many cases, the BAMs have an XS tag that indicates the correct strand.

So, could it make sense for megadepth --all-junctions to add a column with the XS strand in the tsv, and process_jx_output.sh to report that column in the sjout file?

ChristopherWilks commented 2 years ago

Hi @AlexWeinreb, thanks for the feedback (and for using Megadepth).

You are correct in both points.
I went back and looked at what I'm doing and it's reasonable to think I could read the XS tag if present, for --all-junctions.

I would then set the current strand column in the tsv output of process_jx_output.sh to be what the XS tag reports translated to STAR's format for strand, as I want to avoid adding another column in the output to keep compatibility with STAR's junction format.

If that's acceptable, I'll see about when I can get this done and post back.

Chris

AlexWeinreb commented 2 years ago

Yes, it makes perfect sense.

For the additional column, I meant in the tsv output of --all-junctions, the file that can then be fed to process_jx_output.sh. IIRC it's only the output of that last script, the .sjout file, that has to follow STAR's format. My reasoning was that if someone is already relying on the content of column 5 of the intermediary file, that wouldn't break. But in practice I have no idea if this "mapping strand" is useful to anyone.

In any case, that would be great!

ChristopherWilks commented 2 years ago

Hi @AlexWeinreb I've created a minor pre-release which should now support the XS:A tag in BAM files if present. Please give it a try out and let me know if it works (or not) for you: https://github.com/ChristopherWilks/megadepth/releases/tag/1.1.2

Thanks, Chris

ChristopherWilks commented 2 years ago

@AlexWeinreb I just made a minor adjustment to the 1.1.2 prerelease with support for the XS:A tag, it's now: https://github.com/ChristopherWilks/megadepth/releases/tag/1.1.2a