Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 134

Questions specific to interacting with and post-processing sequence alignments using the SAMtools package. For questions specifically about formats SAM, BAM or CRAM use tags sam or bam,

2 votes

NO_COOR reads not in a single block at the end 0 -1

This is essentially a duplicate of Samtools Index: Chromosome Blocks not Continuous but with different error messages, and a duplicate of Error given while trying to index a BAM file with Samtools Index … This is because samtools sort -n has been used to sort the reads by name instead. Remove -n to sort by position, which is what is needed to prepare a BAM file for indexing with samtools index. …
John Marshall's user avatar
3 votes

samtools view: writing to standard output failed: Broken pipe

[W::sam_read1] Parse error at line 1 samtools sort: truncated file. … If the output of samtools fixmate is SAM, then this LP1 is garbling the SAM header lines. If the output of samtools fixmate is BAM (as it probably is), this LP1 is completely garbling the data. …
John Marshall's user avatar
3 votes
Accepted

samtools mpileup skipping read

/H2O XA:Z:chrM,-9340,18S58M,1; and run it through mpileup: $ samtools mpileup -Q0 -B oneread.sam This will show you that this read's base quality dips below 20 at the position you are interested …
John Marshall's user avatar
5 votes
Accepted

What is a samtools mpileup reference skip?

Base is a mismatch to the reference base > < Reference skip (due to CIGAR "N") * * Deletion of the reference base (CIGAR "D") (And so on — see the pull request or doc/samtools-mpileup … The documentation on that web page will be updated when this is released in a new samtools release.) …
John Marshall's user avatar
1 vote

Error given while trying to index a BAM file with Samtools Index - NO COOR?

By now this will be of little interest to the original poster, but for future reference: $ samtools sort -n -T ~/[etc] -o sample${r}bowtiemapping_sorted.bam [etc] $ samtools index sample${r}bowtiemapping_sorted.bam … This is because samtools sort -n has been used to sort the reads by name instead. Remove -n to sort by position, which is what is needed to prepare a BAM file for indexing with samtools index. …
John Marshall's user avatar
8 votes

Merge hundreds of small BAM files into a single BAM file

So samtools merge (use the most up-to-date version, as there have been improvements in merge header handling in the 1.3.x and 1.4.x versions), picard MergeSamFiles, etc. … Samtools does not do this internally; I'm not sure whether any of the other merge implementations do. …
John Marshall's user avatar
8 votes
Accepted

Convert BAM to properly paired FASTQ files

… | samtools fastq -F 0x900 -@ 48 \ -0 /dev/null -1 reads_R1.fastq.gz -2 reads_R2.fastq.gz - Your samtools fastq command is not doing anything to siphon off these singleton reads. … See the discussion in samtools/samtools#874 (especially the part starting here). …
John Marshall's user avatar
5 votes
Accepted

Samtools Index: Chromosome Blocks not Continuous

samtools sort blasted_SRR6649368.bam -o sorted_SRR6649368.bam -n These error messages indicate that the reads are not sorted by coordinate — in particular, that the reads mapped to ScdB1pO_646;HRSCAF= … This is because samtools sort -n has been used to sort the reads by name instead. Remove -n to sort by position, which is what is needed to prepare a BAM file for indexing with samtools index. …
John Marshall's user avatar
3 votes

How to subset BAM file based on read length range (120-180) bp?

To do this sort of thing you should have the headers bypass your filtering, which is a pain: (samtools view --header-only $file; \ samtools view --no-header $file | awk …) | samtools view -b -o $outfile … samtools view -b -o $outfile Much easier to use samtools's built-in filtering expressions to do your filtering instead: samtools view -e 'qlen >= 120 && qlen <= 180' -b -o $outfile $file …
John Marshall's user avatar