soap2sam-pl
Quick Start
- Command:
soap2sam.pl [-p] alignments.soap > alignments.sam - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/soap2sam.pl - Reference: See references/help.md
When To Use This Tool
- Convert legacy SOAP text alignment output into SAM.
- Interpret mate relationships with
-pwhen the SOAP file contains paired-end alignments. - Preserve sequence, quality, mismatch count, and simple mate fields while moving into SAM-aware tooling.
- Bridge old SOAP-based pipelines into modern BAM-centric downstream steps.
Common Patterns
# 1) Convert single-end SOAP output
soap2sam.pl \
alignments.soap > alignments.sam
# 2) Convert paired-end SOAP output
soap2sam.pl \
-p \
paired.soap > paired.sam
# 3) Convert then compress with samtools
soap2sam.pl \
-p \
paired.soap > paired.sam
samtools view -bS paired.sam > paired.bam
Recommended Workflow
- Confirm the input is SOAP text output and decide whether the file is paired-end before setting
-p. - Convert to SAM, then inspect a few records for read names, orientation flags, and mismatch tags.
- Validate that mate pairing still makes sense if the SOAP file was reordered upstream.
- Compress or sort with
samtoolsonly after confirming the converted SAM looks structurally correct.
Guardrails
-ponly toggles paired-end interpretation; it assumes mates arrive in the expected order and does not recover arbitrarily shuffled records.- Help comes from Perl
Getopt::Std, so--helpworks generically but-helpis the wrong pattern for this script family. - The script trims the quality string to sequence length if SOAP reports a longer quality field.
- Output is plain SAM records without a SAM header.