How to get "SO coordinate" instead of "SO unsorted" ? #1182

Closed
liamlee opened this Issue Sep 26, 2016 · 9 comments

Comments

Projects
None yet
3 participants
@liamlee
Contributor

liamlee commented Sep 26, 2016

image

When I save data to sam file,I can only get "SO unsorted" sort_tag in the result file.
Can anyone help me ?
Thx!

@heuermh

This comment has been minimized.

Show comment
Hide comment
@heuermh

heuermh Sep 26, 2016

Member

Hello @liamlee!

Are you using release version 0.19.0 or git HEAD? And then are you using the transform command, or calling saveAsSam(...) directly?

Member

heuermh commented Sep 26, 2016

Hello @liamlee!

Are you using release version 0.19.0 or git HEAD? And then are you using the transform command, or calling saveAsSam(...) directly?

@liamlee

This comment has been minimized.

Show comment
Hide comment
@liamlee

liamlee Sep 26, 2016

Contributor

@heuermh I compiled from master branch(scala_2.11) by myself,and I calling sortReadsByReferencePosition() to sort the record ,and then to call saveAsSam(...).

Contributor

liamlee commented Sep 26, 2016

@heuermh I compiled from master branch(scala_2.11) by myself,and I calling sortReadsByReferencePosition() to sort the record ,and then to call saveAsSam(...).

@heuermh

This comment has been minimized.

Show comment
Hide comment
@heuermh

heuermh Sep 26, 2016

Member

Great, thank you for the clarification. I'll look into it today!

Member

heuermh commented Sep 26, 2016

Great, thank you for the clarification. I'll look into it today!

@fnothaft

This comment has been minimized.

Show comment
Hide comment
@fnothaft

fnothaft Sep 26, 2016

Member

Hi @liamlee !

To get SO:coordinate, you need to provide the isSorted = true optional parameter to saveAsSam.

Member

fnothaft commented Sep 26, 2016

Hi @liamlee !

To get SO:coordinate, you need to provide the isSorted = true optional parameter to saveAsSam.

@liamlee

This comment has been minimized.

Show comment
Hide comment
@liamlee

liamlee Sep 26, 2016

Contributor

Hi @fnothaft
I do set isSorted = true, I even tried to do this in the "convertToSam()" source code:
val header = adamRecordConverter.createSAMHeader(sequences, recordGroups) if (isSorted) { header.setSortOrder(SAMFileHeader.SortOrder.coordinate) } **header.setSortOrder(SAMFileHeader.SortOrder.coordinate)**

But I still get "unsorted".

Contributor

liamlee commented Sep 26, 2016

Hi @fnothaft
I do set isSorted = true, I even tried to do this in the "convertToSam()" source code:
val header = adamRecordConverter.createSAMHeader(sequences, recordGroups) if (isSorted) { header.setSortOrder(SAMFileHeader.SortOrder.coordinate) } **header.setSortOrder(SAMFileHeader.SortOrder.coordinate)**

But I still get "unsorted".

@fnothaft

This comment has been minimized.

Show comment
Hide comment
@fnothaft

fnothaft Sep 26, 2016

Member

I've got a fix for this, will push in a sec.

Member

fnothaft commented Sep 26, 2016

I've got a fix for this, will push in a sec.

fnothaft added a commit to fnothaft/adam that referenced this issue Sep 26, 2016

[ADAM-1182] isSorted=true should write SO:coordinate in SAM/BAM/CRAM …
…header.


Resolves #1182. Moved to use SAMTextHeaderCodec + SAMFileWriter.writeHeader to
write the header, vs. relying on SAMFileWriter's internal header writing code.
@fnothaft

This comment has been minimized.

Show comment
Hide comment
@fnothaft

fnothaft Sep 26, 2016

Member

Opened #1183 to resolve. I believe this is a bug (more so a usage issue?) in HTSJDK where some header writing paths don't properly write the sort order.

Member

fnothaft commented Sep 26, 2016

Opened #1183 to resolve. I believe this is a bug (more so a usage issue?) in HTSJDK where some header writing paths don't properly write the sort order.

fnothaft added a commit to fnothaft/adam that referenced this issue Sep 26, 2016

[ADAM-1182] isSorted=true should write SO:coordinate in SAM/BAM/CRAM …
…header.


Resolves #1182. Moved to use SAMTextHeaderCodec + SAMFileWriter.writeHeader to
write the header, vs. relying on SAMFileWriter's internal header writing code.

fnothaft added a commit to fnothaft/adam that referenced this issue Sep 26, 2016

[ADAM-1182] isSorted=true should write SO:coordinate in SAM/BAM/CRAM …
…header.


Resolves #1182. Moved to use SAMTextHeaderCodec + SAMFileWriter.writeHeader to
write the header, vs. relying on SAMFileWriter's internal header writing code.

@heuermh heuermh closed this in 54371cb Sep 26, 2016

@heuermh

This comment has been minimized.

Show comment
Hide comment
@heuermh

heuermh Sep 26, 2016

Member

#1183 worked for me and has been merged. @liamlee can you confirm, and reopen if necessary?

Member

heuermh commented Sep 26, 2016

#1183 worked for me and has been merged. @liamlee can you confirm, and reopen if necessary?

@liamlee

This comment has been minimized.

Show comment
Hide comment
@liamlee

liamlee Sep 27, 2016

Contributor

Hi @heuermh
It's works fine now.
Thank you very much!!!

Contributor

liamlee commented Sep 27, 2016

Hi @heuermh
It's works fine now.
Thank you very much!!!

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