As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [samtools]

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,

Filter by
Sorted by
Tagged with
1 vote
0 answers
38 views

Mapping statistics from the bam files

I would like to find the mapping statistics from the sorted bam files. Samtools flagstat gives the output only for a single file. What is the easiest way to find the mapping statistics for all ...
Kam's user avatar
  • 11
3 votes
1 answer
24 views

regex: samtools command to "refine" PacBio IsoSeq data?

I am working with preprocessed data (IsoSeq PacBio) and I cannot understand one of the steps: samtools view -b -e [rq] >= 0.9 flnc.bam What exactly was ...
Aleksandra Greshnova's user avatar
2 votes
2 answers
149 views

Problem with samtools command with a final hyphen

...
ii4 unsafe's user avatar
3 votes
1 answer
97 views

Nextflow Error: failed to read header from "-"

I am trying to run my nextflow pipeline, and have gotten this error: samtools sort: failed to read header from "-" I'm not sure why this error is ...
anne's user avatar
  • 65
1 vote
0 answers
35 views

How do I filter reads from a bamfile based on 5' and 3' ends?

I have data in paired-end as well as single-end format for the same sample.I would like to split those two files into two per each, where one contains sequences that have 5' end and the other one has ...
Pikabu's user avatar
  • 11
3 votes
1 answer
61 views

CRISPR genome wide screen analysis using MAGeCK-- Loss of reads/sgRNA using MAGeCK count function?

Sorry if this question seems basic. I am trying to run the MAGeCK pipeline to analyze CRISPR knockout screen data produced by someone in my lab around 5 years ago. I was given the data as bam files ...
Cassie Bishop's user avatar
4 votes
0 answers
99 views

Write a bash script to run gatk, fix errors with input, and rerun until completion

I have a bam file that I want to run through GATK's SplitNCigarReads tool. Because of the way the bam file was generated, the program will often fail, with an error message stating: ...
kylep's user avatar
  • 41
2 votes
0 answers
71 views

Difference between pileup and mpileup in VarScan and samtools

I'm going to call variants with VarScan from a pileup files created with samtools. I realized that there are in general two major possibilities to call variants, pileup as well as mpileup. The VarScan ...
Anti's user avatar
  • 153
1 vote
0 answers
64 views

Trinity de novo transcriptome assembly: samtools view failed to add PG line to the header

I have assembled the transcriptome a plant species using Trinity. Here is the command: ...
Faroll's user avatar
  • 11
2 votes
1 answer
370 views

how to retain reads with low mapping quality (MAPQ) scores when using samtools view -q

I have been using the -q option of samtools view to filter out reads whose mapping quality (MAPQ) scores are below a given ...
Patrick Bastedo's user avatar
2 votes
1 answer
65 views

Get number of reads with a single, (almost) exact match to the full length of a reference sequence

I can't find an answer to this in previous questions, so hoping someone can help me now. We have nanopore sequenced a PCR product, and I've filtered our reads to +/- 10 bp of the expected product ...
Nat R McB's user avatar
1 vote
1 answer
202 views

Different line length in fasta file

I am currently using VEP for variant annotation. I am facing an error as below: [E::fai_build_core] Different line length in sequence 'Pn9' I understand there is ...
Sowmya Pulapet's user avatar
3 votes
1 answer
644 views

How to remove the unpaired reads in sam/bam files?

I have sam and bam files for the chimeric reads, which come from two different parts of the genome (For example, the first half of the read from part of Chromosome 1 and the second half of the read ...
Wang Ming's user avatar
  • 101
0 votes
1 answer
186 views

Can I use samtools addreplacerg to replace multiple RG entries at the same time?

I have a bam file that contains two @RG lines: ...
Greg Dougherty's user avatar
1 vote
2 answers
57 views

Checking that two multiline FASTAs are identical (allowing for different order and lower/upper case)

Is there a good CLI tool that can diff two multiline fasta files, ignoring order, and comparing sequences with identical names with each other pairwise. Bonus points if lower/upper case is tolerated (...
Cornelius Roemer's user avatar
0 votes
2 answers
39 views

BAM files with no RNAME and POS, how to map contents to SNPs?

I have a set of 4 .bam files containing the exome of an individual, around 400 MB each. I used samtools to generate a 2.4 GB .sam file out of one of the .bam files, and I found it contains lines with ...
Fernando D'Andrea's user avatar
2 votes
0 answers
293 views

How to extract reads that map exclusively to a single site with 1 or zero mismatches from BAM files

I generated BAM files (sorted by coordinates) by aligning human RNA reads against the human reference genome using BWA MEM and ...
plicht's user avatar
  • 21
3 votes
2 answers
126 views

Detect mutation context in a read of a sam file

After sequencing (Illumina) of some DNA, I generated a sam file through alignment of a fastq file (using Bowtie2). Instead of using variant calling programs, I want to know the specific variances, ...
Annelisa's user avatar
1 vote
2 answers
532 views

Potential side effects of replacing read group tags in BAM file

I have a set of BAM files where the read group tags have some (default?) values, i.e.: @RG ID:RG0 LB:LB0 PU:PU0 SM:SM0 This creates issues in my downstream ...
gc5's user avatar
  • 1,773
4 votes
1 answer
280 views

samtools view command not found error

When I tried to use samtools to split a bam file based on different chromosomes, I used this command: samtools view input.bam -b chr21 | chr21.bam However, I get ...
Scott XU's user avatar
  • 135
4 votes
1 answer
333 views

BWA mem | samtools view: Intermittent parsing error

Update The issue was that bwa was running out of memory and failing, but that error wasn't floating to the top (see @Steve's answer, below). I was getting an error ...
Mark Ebbert's user avatar
  • 1,274
2 votes
1 answer
193 views

Samtools sort: most efficient approach to sort a single sample after aligning split .fastq files

Related to my other question (Samtools sort: most efficient memory and thread settings for many samples on a cluster), we need to optimize samtools sort as we ...
Mark Ebbert's user avatar
  • 1,274
2 votes
2 answers
2k views

Samtools sort: most efficient memory and thread settings for many samples on a cluster

We're preparing to analyze thousands of .bam files beginning with re-alignment, sorting, etc. Complicated question: Has anyone investigated the optimal thread and ...
Mark Ebbert's user avatar
  • 1,274
0 votes
1 answer
2k views

How to Sort and Index a SAM file without converting it to BAM?

Generally, I use samtools to sort and index BAM files. Samtools works also with BGZF ...
alec_djinn's user avatar
3 votes
0 answers
262 views

How to analyze an IGV alignment

I'm working on a project where I am analyzing the performance of an alignment workflow. My goal is to find regions in the resulting BAM file where there are outstanding discrepancies or anything that ...
pythonbeginner44's user avatar
1 vote
1 answer
54 views

Is there a sam flag for all&none of the reads?

a. Is there a SAM flag that specifies all reads? b. Is there a SAM flag that specifies none of the reads? So that if I run samtools view -f (a) -F (b) the result will be all reads of the file (as if ...
Sam's user avatar
  • 177
0 votes
1 answer
148 views

Convert VCF file to mpileup.txt

I am working on an iterative analysis that uses orthologous pipelines that require mpileup.txt files as input for a visualization step. This requires me to convert VCF files to mpileup.txt. This ...
Andrew Judell's user avatar
1 vote
2 answers
367 views

How to extract all sequences mapped to a transcript from Kallisto output

This question has also been asked on Biostars I ran Kallisto with the --pseudobam option. How do I extract all the short reads that are mapped to a single transcript (e.g. ENST00000367969.8)? As a ...
Dr. Who's user avatar
  • 21
1 vote
1 answer
378 views

How to convert multiple single-end bam files to fastq using samtools

Hi I am trying to convert bam files generated from Ion Torrent Proton sequencing to fastq format so that I can upload them to ...
Justin1609's user avatar
2 votes
1 answer
44 views

Counting the co-occurrence of variants A and B in an aligned sequencing read

I need some help getting started on this project. To simplify we want to be able to quantify the occurrence of 3 variants on each sequencing read in an alignment file as a proxy measurement for ...
Bioreeb's user avatar
  • 21
0 votes
1 answer
368 views

Is it normal to have a smaller bam file after merging bam files?

I have 2 bam files that belong to the same sample and I merged them with samtools merge. And after merging, I realized that the merged version is a bit smaller than ...
Baran Aldemir's user avatar
1 vote
2 answers
234 views

Can HTSlib extract bam reads occurring in a specific region without iterating through the whole file?

I am using htslib/sam.h to write a C++ program. As part of this program, I must extract reads occurring on specific scaffolds in specific regions from a bam file. Essentially, I want to perform the ...
annabelperry's user avatar
4 votes
4 answers
163 views

Unable to open .bam file in C++ using SeqAn due to 'seqan::UnknownExtensionError'

I am trying to open .bam files in C++ to extract reads occurring at specific scaffolds and loci. I essentially want to call "samtools view sample.bam -o sample.sam scaffold:pos-pos" from C++....
annabelperry's user avatar
1 vote
0 answers
512 views

Conversion of SAM to BAM files

I am very new to micro RNA analysis. I have been using H. sapiens, GRCh38 + major index as given in the Bowtie Website to align with my trimmed FASTQ file . The command I am using to make very ...
Aranyak Goswami's user avatar
2 votes
1 answer
43 views

Python package or CLI tool outputting mutations of sequence with respect to reference

I'm new to bioinformatics, and I'm looking for a tool that takes two FASTA files, one containing a reference, let's call it A.fasta, the other another sequence, let'...
Cornelius Roemer's user avatar
0 votes
0 answers
99 views

seqff script got trouble after samtools treatment

I'm trying to study fetal fraction by using a seqff script from here. The instruction says that I need a headless sam file to work so after alignment with bwa, I process my sam file by using samtools: ...
khanhlpbao's user avatar
3 votes
1 answer
894 views

Inflate operation failed: progress temporarily not possible, or in() / out() returned an error

I download a BAM file from ftp-trace.ncbi.nlm.nih.gov:/giab/ftp/data/NA12878/10Xgenomics_ChromiumGenome_LongRanger2.0_06202016/NA12878_GRCh38.bam (171G), and I am trying to view the comparison result ...
yyn's user avatar
  • 31
0 votes
1 answer
153 views

How can I run the latest version of samtools on Slurm?

I am trying to run the following script on slurm to extract information from .sam files. While everything is perfect on my local machine with the samtools version 1.11, it does not work on slurm. I ...
Dmitrii Trubetskoy's user avatar
0 votes
1 answer
246 views

How to perform bowtie2 analysis with slurm?

I am trying to run my alignment script that works locally, using SBATCH. Official manual for bowtie2 says I can use ...
Dmitrii Trubetskoy's user avatar
1 vote
1 answer
1k views

How can I extract information from .sam files?

I have 10 .sam files after my bowtie2 alignment on ten single-pair sequences. I would like to build a graph based on that output ...
Dmitrii Trubetskoy's user avatar
1 vote
1 answer
1k views

What is "unmapped read segments" in the output of samtools idxstats?

samtools idxstats produces a four column output (see here) ...
Roger Vadim's user avatar
1 vote
1 answer
163 views

How to extract reads with INDELs > a given size?

I'm trying to modify this https://www.biostars.org/p/253774/ To get reads with deletions > 20bp I think this gives reads with exactly 20bp dels: ...
Liam McIntyre's user avatar
2 votes
1 answer
2k views

How to generate a consensus sequence from a multi-reference BAM file?

I am trying to generate a consensus sequence from a BAM file that was generated by mapping reads to a reference FASTA containing multiple sequences. Usually, I generate consensus sequences from BAM ...
teaelleceecee's user avatar
0 votes
1 answer
248 views

Reading fasta sequence regions with faidx

Im coding in c++ and reading in different reference genomes to examine regions across the chromosomes a few hundred basepairs at a time. To do it in c++ i use the library htslib and the command ...
RAHenriksen's user avatar
0 votes
1 answer
69 views

How to identify to each scaffold a read belongs to, inside a .sam file?

I have a fasta file assembly and combining it with the raw reads we produced a .bam file which I converted to .sam . The .sam information lines look like this: ...
fullmooninu's user avatar
1 vote
2 answers
530 views

Trying to create a .bam file without the need for a .sam file

I'm trying to use the code specified in this link to create a .bam file without the need for a .sam file. Here is the code I'm using: ...
Connor's user avatar
  • 55
1 vote
2 answers
337 views

Mapping statistics from bam file using bbtools and sambamba

Below are the statistics for RNA-seq mapped and unmapped paired-end reads to rice genome using reformat.sh from bbtools on bam files. It gives 77% mapped and 5% unmapped, what about the remaining 18% ...
bioinfonext's user avatar
0 votes
0 answers
112 views

summarising read group information from a .bam file

I have merged together 2 different .bam files in order to simulate sample contamination. So the reads can come from one of two samples, as shown by the read group info: ...
user438383's user avatar
  • 1,442
0 votes
1 answer
834 views

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

I am doing an RNA seq analysis with mouse samples. I had my reads in several lanes, so I concatenated those fastq reads. Then I've mapped my reads with Hisat2 against the new version of mouse "...
user9393's user avatar
0 votes
2 answers
49 views

Basic question about finding mRNA sequence in transcriptome

I am a computer scientist just starting out in bioinformatics topics, and would appreciate any guidance that can be given here: I have an mRNA sequence- an isoform - whose length is about 4000 base ...
the_darkside's user avatar