Questions tagged [samtools]

Samtools is a suite of programs for interacting with high-throughput sequencing data.

Samtools is a suite of programs for interacting with high-throughput sequencing data. It consists of three separate repositories:

  1. Samtools Reading/writing/editing/indexing/viewing SAM/BAM/CRAM format
  2. Reading/writing BCF2/VCF/gVCF files and calling/filtering/summarising SNP and short indel sequence variants
  3. HTSlib A C library for reading/writing high-throughput sequencing data Samtools and BCFtools both use HTSlib internally, but these source packages contain their own copies of htslib so they can be built independently.

Links:

115 questions
0
votes
0 answers

How do I resolve the "inconsistent chromosome block error?

I am trying to align reads to hg38 using bowtie2 and then samtools. After getting the bam files and trying to index them I got the error: E::hts_idx_push\] Chromosome blocks not continuous \[E::sam_index\] Read 'SRR764959.25000002' with…
0
votes
0 answers

pileup "]" meaning in read-bases column

I have a pileup file from calling samtools mpileup and I'm confused to see a "]" in the column that shows read-base agreement with reference. 1 861225 G 45 ............................................^].…
rbierman
  • 71
  • 3
0
votes
1 answer

Snakemake: MissingInputException in rule - Missing input files for rule sam_to_bam:

I started to learn Snakemake and here is my first code: SAM_DIR = "/mnt/c/Code/sam_tiny" BAM_DIR = "/mnt/c/Code/bam" SAM_FILES = glob_wildcards(os.path.join(SAM_DIR, "{sample}.sam")) SAMPLES = [wildcards[0] for wildcards in SAM_FILES] rule all: …
Theresa
  • 65
  • 5
0
votes
1 answer

How to find the base using the chromosome number and position?

I have a list of chromosome numbers and positions which I have obtained from the output of MAC of my sample. The format looks like this: chr1.12661672.G.A,chr1.12661721.C.T 1/6 11 2 Mutant chr1.157640161.C.T,chr1.157640277.G.A 1/6 11 2 …
0
votes
0 answers

bash commands don't run from R Markdown file

I was trying to run a bash code chunk on my R Markdown file (see below), but I get this error. I am taking a bioinformatics course and am new to this. Can some help? thank you I have a MacBook Pro 2019, Ventura OS. Code chunk: cd…
Roy Khair
  • 1
  • 2
0
votes
0 answers

Wrong plotting data (insert size vs base quality means from BAM file)

I'am using PySam to calculate the insert reads and the mean base quality for the reads of a BAM as follows: import math import pysam import numpy as np import matplotlib.pyplot as plt bam_file = pysam.AlignmentFile("mybam.bam",…
P. Solar
  • 339
  • 3
  • 10
0
votes
1 answer

bcftools mpileup failed, format error of index

I'm trying to generate bcf files with bcftools with the following general code bcftools mpileup -Ou -f ref.fai file.bam Index was built with samtools faidx index.fna Sorted and markduped bam was by samtools sort file.bam -o…
Mauro
  • 47
  • 6
0
votes
1 answer

Samtools not working after system update (libcrypto.1.0.0.dylib' (no such file))

I had installed Samtools using Conda environment. My MacBook is Apple Silicon M1 based. Recently I did system update and now it is macOS Monterey 12.4. Now Samtools is showing following error. dyld[29136]: Library not loaded:…
Atsathe
  • 1
  • 2
0
votes
0 answers

I have 2 bash loops with the same structure and only the first works

Issue I have a few PE fastq files from an infected host. First I map reads to the host and keep reads that did not map and convert that single bam to new paired end fastq files. The next loop takes the new PE fastq files and maps them to the…
0
votes
1 answer

indexing sorted alignment file with samtools index gives "Exec format error"

I am struggling with samtools index. I already did the alignment using "bwa mem reference.fa seq.fastq > alg.sam". The resulting sam file was converted to bam format using "samtools view -S -h -b alg.sam > alg.bam". Next, the files were sorted by…
cicci
  • 1
  • 2
0
votes
0 answers

text encoding not readable on linux

I have a text file which has been previously readable in linux, then I modified some names in it manually on windows and now when I am running it on linux (using samtools), it cannot find exactly those names that I have changed manually [faidx]…
xyz0o
  • 49
  • 1
  • 8
0
votes
1 answer

Extract variant positions from VCF dependent on contents of other columns

I have a vcf file, I am trying to extract the information from these columns: #CHROM POS REF ALT However I would like to extract these only if the SAMPLE-1 column contains the string DeNovo (Not DeNovoSV) and that SAMPLE-1, SAMPLE-2, and…
hdjc90
  • 77
  • 6
0
votes
2 answers

iterate through files in python script and execute bash command

I am trying to write a python script that loops through SAM files in a directory and uses samtools view to convert those SAM files to BAM files. Here's what I have, but am struggling with how to input the SAM file (i) into the bash command in the…
Emerson
  • 125
  • 8
0
votes
1 answer

Extracting lines from file using grep in a for loop, exporting to new file with variable in file name

I am trying to extract all lines from a file that contain a string using a for loop with a file that contains a list of possible strings. I also want to export the results of grep to a new file with the variable in the file name. Here is what I…
0
votes
0 answers

Why is a specific row of 'samtools view' broken after grep?

I want to extract readname list one of which is uniquely mapped and the other is multi-mapped. However, after some try&error, I found the 1st raw of samtools view -@ 6 XXX.sorted.bam | if grep -q XS:i: ; then awk '{print $0}' ;else:;fi | head is…
kofuji
  • 1
  • 1