psl2sam-pl
Quick Start
- Command:
psl2sam.pl [-a INT] [-b INT] [-q INT] [-r INT] input.psl > output.sam - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/psl2sam.pl - Reference: See references/help.md
When To Use This Tool
- Convert UCSC PSL alignments into SAM.
- Recalculate an
AS:ialignment score from PSL match, mismatch, and gap counts. - Preserve clipped alignment structure when translating PSL block coordinates into SAM CIGAR strings.
- Use simple PSL-to-SAM conversion when you do not need a full splice-aware aligner rerun.
Common Patterns
# 1) Convert PSL to SAM with default scoring
psl2sam.pl \
alignments.psl > alignments.sam
# 2) Use custom score weights for matches, mismatches, gap opens, and extensions
psl2sam.pl \
-a 2 -b 4 -q 5 -r 1 \
alignments.psl > rescored.sam
# 3) Stream PSL from stdin
cat alignments.psl | psl2sam.pl > alignments.sam
Recommended Workflow
- Confirm the input is ordinary PSL and not PSLX or some downstream PSL-derived report.
- Decide whether the default score weights are acceptable or whether you need explicit
-a,-b,-q, and-rvalues. - Convert to SAM, then inspect a few long-gap records to confirm the CIGAR output is acceptable for your downstream use.
- If the PSL represents spliced transcript alignments, verify whether this simple converter is sufficient before using the result in splice-aware analyses.
Guardrails
-a,-b,-q, and-ronly change the computedAS:iscore; they do not alter the underlying alignment coordinates.- The script does not emit reference-skip
Noperators in CIGAR strings, so intron-like PSL gaps are represented as insertions/deletions instead of splice skips. - Help comes from Perl
Getopt::Std, so--helpworks generically but-helpis the wrong pattern for this script family. - Output is plain SAM records without a SAM header.