This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools equivalent of "CleanSam" Picard GATK?

I have a process which is in gatk, I would like to convert partially to samtools, however I am unsure of if there is a Samtools equivalent of the CleanSam process?

bwa mem -t 12 -M -R "..." $ref ${paired_reads} > ${pair_id}.sam

gatk --java-options "-Xmx16g -Xms16g" SamFormatConverter -R $ref -I ${pair_id}.sam -O ${pair_id}.bam
gatk --java-options "-Xmx16g -Xms16g" CleanSam -R $ref -I ${pair_id}.bam -O ${pair_id}.clean.bam
gatk --java-options "-Xmx16g -Xms16g" SortSam -R $ref -I ${pair_id}.clean.bam -O ${pair_id}.sorted.bam -SO coordinate --CREATE_INDEX true TMP_DIR=`pwd`/tmp
gatk --java-options "-Xmx16g -Xms16g" MarkDuplicates -R $ref -I ${pair_id}.sorted.bam -O ${pair_id}.sorted.dup.bam -M ${pair_id}_dup_metrics.txt -ASO coordinate

Tentatively ... skipping .sam and going straight to .bam

bwa mem -t 12 -M -k 25 \
-R "@RG\\tID:${pair_id}\\tLB:${pair_id}\\tPL:illumina\\tSM:${pair_id}\\tPU:${pair_id}" \
$ref ${paired_reads} | samtools sort -@ 12 -o "${pair_id}.bam" \
&& samtools index "${pair_id}.bam"

However, I could not find a "clean" samtools function to run before indexing and sorting.

picard samtools gatk

I am writing a collaborator's shell script into nextflow, so I am trying to match it as closely as possible.

Quick note: It's picard, not piccard.

1 answer

It exists as an option on samtools view and has been merged into the samtools develop branch, so it'll be in the 1.17 release (likely Jan next year).

https://github.com/samtools/samtools/pull/1698

Thank you for the information!

Log in to answer this question.