Custom sam sort
2
0
Entering edit mode
8.3 years ago
thomas.smith2 ▴ 120

[UPDATE]: Thanks for the suggestions. It turns out I don't need to perform the custom sort after all though

Hi everyone,

I hoping someone may be able to point towards a tool for custom sorting a sam/bam file? Essentially I want to sort by a meta-contig feature which will not be encoded within the samfile. The resultant sorted sam will not need to be sorted on contig or position whatsoever.

I can perform the sort myself using pysam to extract the contigs associated with each meta-contig and then outputting to the sorted sam, but I'm hoping this functionality may exists already elsewhere?

A fuller explanation of the motivation can be found here

Cheers

sam bam sort RNA-Seq • 2.1k views
ADD COMMENT
0
Entering edit mode

Link to the fuller explanation seems to require a github account and is not otherwise visible.

ADD REPLY
0
Entering edit mode

It is not a proper link. It is pointing to "https://github.com/CGATOxford/UMI-tools/issues/new"

ADD REPLY
1
Entering edit mode
ADD REPLY
0
Entering edit mode

Thanks. Link updated in the questions.

ADD REPLY
2
Entering edit mode
8.3 years ago

You can easily implement a new sorting algorithm using java+ and the class 'SortingCollection' from the htsjdk library. See https://github.com/lindenb/jvarkit/blob/master/src/main/java/com/github/lindenb/jvarkit/tools/misc/SortSamRefName.java for an example (sorts reads on REF and then on NAME)

ADD COMMENT
0
Entering edit mode
8.3 years ago

Bamtools allows different sorting schemes. If i remember correctly it allows users to specify their own sort functions... maybe?

ADD COMMENT
0
Entering edit mode

I am not sure if bamtools sort can do that but maybe bamtools filter could help.

ADD REPLY

Login before adding your answer.

Traffic: 2310 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6