Can I sort my bam files with Picard MergeSamFiles?
2
1
Entering edit mode
3.3 years ago

Hi!

I noticed this in the picard MergeSamFiles help:

--SORT_ORDER,-SO:SortOrder Sort order of output file Default value: coordinate. Possible values: {unsorted, queryname, coordinate, duplicate, unknown}

Does this mean that it is unnecessary to use picard SortSam before? can MergeSamFiles do the same job?

if so, is it faster to do the sorting together with merging in MergeSamFiles or is it better to do run Sortsam first?

thanks in advance!

best / Jonas

MergeSamFiles picard-tools SortSam • 1.9k views
ADD COMMENT
0
Entering edit mode

If you're merging a set of sorted SAM/BAM files, you will get a sorted file in the end. So no need to sort it then.

If you're merging (basically concatenating) unsorted files, you'll have to sort it after.

You can check if the file is sorted by indexing it with samtools

ADD REPLY
0
Entering edit mode
3.3 years ago

thx for your answer!

so If I have the default value of --SORT_ORDER coordinate in MergeSamFiles, that doesn't mean that MergeSamFiles also will sort the unsorted files when merging?

I have to sort them with e.g. sortsam either before or after the merge?

ADD COMMENT
0
Entering edit mode

I don't think so - I think it refers to the sort order in the input files. But you can check using two small bam files :)

ADD REPLY

Login before adding your answer.

Traffic: 1412 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