Questions tagged [sam]

Use this tag for questions specifically related to the text SAM format. For general questions about the SAM/BAM formats use the tag BAM.

Filter by
Sorted by
Tagged with
1
vote
1answer
21 views

How to filter a SAM file by a bed file?

I have a large BAM file and I want to filter it by just what's defined in a bed file, and write it to a new file. Is it possible to do this with samtools, and if so, how? Is there a better tool I ...
3
votes
0answers
307 views

Convert PAF format to SAM/BAM format

I have a bunch of PAF files resulting from the alignments of fastq files on a reference genome with minimap2. I would like to convert them into SAM/BAM format so I can use ...
0
votes
0answers
41 views

How to obtain the extended unaligned bases of the read in reference based genome assembly?

I did illumina read mapping based on a particular gene sequence (reference sequence) using the following command, ...
2
votes
1answer
172 views

Consensus sequence from SAM or BAM file?

I am trying to perform reference-based assembly. Most of the tutorials teach how to create a bam file and view alignemnts in IGV or Tablet. But, I want a assembled genome sequence in fasta format. How ...
3
votes
0answers
83 views

convert supplementary reads to primary in sam or bam

I have a problem with a tool, that possibly ignores supplementary reads. I want to find out a bit how this tool works by converting all supplementary reads to primary reads, and then change the names ...
6
votes
2answers
149 views

Number of reference sequences in a SAM file

From a single record, I can get the reference sequence ID from the field rID, but how can I get the total number of different reference sequences stored in the whole SAM file? It can be simple as just ...
4
votes
2answers
284 views

How can I easily get the read size distribution of reads mapping on a certain set of regions?

Suppose I have a BAM file indicating where reads in a library have mapped, and a bed file describing a set of genomic regions. Is there a way to easily get the size distribution of the reads mapping ...
0
votes
1answer
111 views

While opening a Bam file with the SeqAn library I get 'seqan::FileOpenError' [closed]

When I try to open a simple bam file with the SeqAn library using the following code: ...
2
votes
1answer
672 views

Modifying a SAM header after removing all non-primary reads

I subset a BAM to only include primary reads using the following samtools commands: samtools view -F 256 input.bam > input.primaryOnly.sam Now, in order to ...
3
votes
3answers
171 views

Parsing SAM/BAM files for additional information

I used BWA-MEM to alignment and I would like to gather the some informations like total % of match, mismatch, insert/delete etc. I am wondering if there is any existing tools that produces this ...
1
vote
2answers
403 views

Mapping Information from SAM/BAM file

I mapped raw illumina reads to longer pacbio reads and I would like to know the following information from my mapping file (SAM/BAM) How many PacBio reads are mapped to at least one illumina reads A ...
4
votes
2answers
308 views

Interpreting 0x200 flag in bwa-mem alignments

I am looking at the bwamem.h code in http://github.com/lh3/bwa and found that BWA-MEM will give flag 0x200 to what it calls ...
2
votes
1answer
298 views

Mark BWA-SW split alignments in output for long reads

Is there a way to remove split alignments of single-end long reads from BWA-SW output? BWA-MEM has an option to include or flag split alignments in the result, but it seems BWA-SW method include them ...
3
votes
4answers
709 views

True bam file encoding and viewing as text

We all have been using samtools to convert between sam and bam files. SAM is tab-delimited file. My question resides on the ability to visualize bam files as text. Is there any way to visualize any ...
8
votes
1answer
173 views

Convert local alignments to spliced alignments in SAM file

I mapped RNA reads to reference genome, using LAST in split mode, and converted the MAF alignment to SAM with maf-convert. My problem is that the transcripts are not reported in a spliced manner, ...
7
votes
3answers
473 views

Is there a way to retrieve several SAM fields faster than `samtools view | cut -f`?

I am constructing a bit of software which pipes the outputs of the bam file via samtools view into a script for parsing. My goal is to (somehow) make this process ...
8
votes
2answers
2k views

How to merge sam files together with adding read groups

I have three sequencing libraries of single individual mapped to a reference using bwa-mem. I would like to merge the three unsorted ...
5
votes
1answer
100 views

Is the optional SAM NM field strictly computable from the MD and CIGAR?

From SAM Optional Fields Specification the NM field is Edit distance to the reference, including ambiguous bases but excluding clipping Assuming both the MD and CIGAR are present, is the edit ...
6
votes
1answer
435 views

How should the SAM MD tag match the CIGAR string?

I am trying to understand how the MD:Z tag is used. The following is from the SAM Optional Fields Specification, which gives an example but is not thorough. The MD field aims to achieve SNP/indel ...
10
votes
2answers
230 views

What are the de facto required fields in a SAM/BAM read group?

The SAM specification indicates that each read group must have a unique ID field, but does not mark any other field as required. I have also discovered that htsjdk throws exceptions if the sample (...
6
votes
1answer
241 views

Why most aligners do not output the “X” CIGAR operation?

As I read the SAM spec, the "X" CIGAR operator represents a mismatch. This seems useful as we can know where are the mismatches without looking at the reference genome. However, many popular aligners ...
12
votes
1answer
711 views

Are soft-clipped bases used for variant calling in samtools + bcftools?

If there are soft clipped base pairs specified in the CIGAR string for a read in a SAM/BAM file, will these be used for variant calling in a samtools + bcftools workflow? The GATK HaplotypeCaller, ...
21
votes
4answers
26k views

What is the difference between FASTA, FASTQ, and SAM file formats?

I'd like to learn the differences between 3 common formats such as FASTA, FASTQ and SAM. How they are different? Are there any benefits of using one over another? Based on Wikipedia pages, I can't ...