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.
Obtaining uniquely mapped reads from BWA mem alignment
This is based on a question from betsy.s.collins on BioStars. The original post can be found here. Does anyone have any suggestions for other tags or filtering steps on BWA-generated BAM files that ...
Access base aligned to particular reference position
The short version: If I have a SAM record, is there any simple way to retrieve the base aligned to a particular reference position without computing a pileup? The long version: I'm using pysam to ...
How can I downsample a BAM file while keeping both reads in pairs?
I know how to downsample a BAM file to lower coverage. I know I can randomly select lines in SAM, but this procedure can't guarantee two reads in a pair are always sampled the same time. Is there a ...
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 ...
Random access on a FASTQ file
I would like to select a random record from a large set of n unaligned sequencing reads in log(n) time complexity (big O ...
Converting a BAM file into VCF
I have NGS illumina RNA-seq reads from M. musculus (mm10). I am trying to find variants along the strand portion of the reads in the refseq (mm10). I mapped a pair of sequence files and generated a ...
How to manipulate a reference FASTA or bam to include variants from a VCF?
I have some software which takes fastas as the input. I need to include SNVs and InDels from a VCF into the reference hg38 and then use this. The problem is, I don't know of an algorithmically sound ...
How to import a large amount of .bed, .gff, .vcf, .paf, .sam files into an SQL database?
Are there best practices to load different bioinformatics file formats such as VCF, BED, GFF, and SAM to SQL databases? I am wondering how people out there do that efficiently. All of these three ...
How to subset a BAM by a list of QNAMEs?
I have a text file 'qnames.txt' with QNAMEs in the following format: EXAMPLE:QNAME1 EXAMPLE:QNAME2 EXAMPLE:QNAME3 EXAMPLE:QNAME4 EXAMPLE:QNAME5 I would like to ...
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 ...
Filtering bases based on phred qualities with pysam
Is there a way to filter bases in BAM files based on phred quallities through python's pysam ? I have a code here that Takes the nucleobases per position from a BAM file using pysam's pileup ...
ethnicity check either from bam or vcf files
What tool could I use to check the ethnicity of a human bam or vcf file? I would like to use the results as a QC check to know whether a given sample or set of samples match the ethnicity information ...
Extracting the CIGAR string from a BAM via Python?
Is there a standard method in Python to extract a CIGAR string from the BAM? There are great libraries which parse the CIGAR, e.g. https://pypi.python.org/pypi/cigar/0.1 ...
How do I rewrite a read group using pysam?
I am trying to rewrite a SAM/BAM file with altered read group entries using pysam. In this simplified version, I want to take a BAM, and rewrite the SM tags in all read groups to the same string and ...
Read counts from BAM file
I have few BAM files which are generated from Ion Torrent Server (ampliseq) aligned to hg19 genome. I want to extract read counts from the bam files and I know that "featureCounts" can be used for ...
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 ...
Disk space error while aligning reads using STAR
Hi am trying to align RNA-seq reads using STAR through following commands, ...
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 ...
Extract reads from bam files by their @RG
How could I extract reads from bam files by their read groups @RG ?, I've got one file containing all reads for 5 samples, the SM is appears NONE, So, I want to extract each sample reads by the @RG ...