Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samtools sort #404

Closed
simonvh opened this issue Jun 15, 2020 · 4 comments
Closed

samtools sort #404

simonvh opened this issue Jun 15, 2020 · 4 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@simonvh
Copy link
Member

simonvh commented Jun 15, 2020

samtools sort {params.sort_order} -@ {params.threads} {input} -o {output} -T {params.out_dir}/{wildcards.assembly}-{wildcards.sample}.tmp 2> {log}

Have you tried / benchmarked setting larger memory for samtools sort (-m 4G)? With the defautl settings samtools sort generates many small files for sorting. I think this can slow down the process. An alternative is also sambamba which seems to sort faster (at least, the last time I looked at it).

@simonvh simonvh added enhancement New feature or request question Further information is requested labels Jun 15, 2020
@Maarten-vd-Sande
Copy link
Member

Yes I am aware. However I think the issue is that some assemblies consist of many many many contigs, and that blows up in memory. But that is from memory ( +/- a year ago). I will leave this open, and test again.

You can already use sambamba as a sorter, but ... ofcourse there are minor differences in the way they sort. Samtools & sambamba sort slightly different on read names (not coordinates, and not sure anymore on what, but think about order of capital letters), which makes some tools very unhappy.

So I decided that every downstream tool MUST use the samtools-coordinate sorted bam, since I never had troubles with those. If you only do alignment, then you can choose the sort_order (coordinate/queryname) and sorter (samtools/sambamba).

@simonvh
Copy link
Member Author

simonvh commented Jun 15, 2020

Ah, sounds reasonable. I suspected there might be a good reason. In any case, it might be good to have the -m option of samtools configurable.

@Maarten-vd-Sande
Copy link
Member

Note for instance that genrich specifically uses sambamba-queryname sorted bams, this is because it explodes when you give it samtools-queryname sorted bams. This means that during some workflows two versions of the same bam exist, but they differ just by sorters/sort orders. See for instance: biod/sambamba#132.

Ah, sounds reasonable. I suspected there might be a good reason. In any case, it might be good to have the -m option of samtools configurable.

Yes, will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants