How to sort a FASTA file and (its) BAM file in the same order?
Exactly what the title says.
I'd like to sort the FASTA and BAM files in the same order (for reasons). Can samtools do this or would this need some scripting (e.g., sorting an intermediate SAM file and subsequently converting it to BAM)?
I do apologize if this a simple question that is already answered elsewhere.
• 1,417 views
•
link
1 answer
You should be able to name sort your BAM (use samtools sort -n). Linearize your fasta file and then sort it based on first column (which will contain the fasta header). They should be in the same order then.
You could usebbmap.sh to do the alignments in first place with the following option.
ordered=f Set to true to output reads in same order as input.
Slower and uses more memory.
• 0 views
•
link
Log in to answer this question.