The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [pysam]

The tag has no usage guidance.

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

Convert paired-end BAM into a single-end BAM and keep all the reads

I want to call peaks using MACS2 on my paired-end ATAC-seq BAM and I am interested in cutting sites. So I make use of the -BAM option (opposed to the -BAMPE) option. However this throws away all the ...
0
votes
1answer
103 views

filter secondary alignments using pysam

I am new to python and trying to learn. The below is an attempt to filter out secondary reads in a bam using ...
5
votes
2answers
305 views

What does “fetching by region is not available for SAM files” mean?

I am used to gzip/biopython solutions when dealing with sequencing data, but now I wish to switch to more elegant ...
2
votes
2answers
91 views

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 ...
1
vote
1answer
33 views

Aligned base strand in pysam `pileupcolumn`

Is it possible that on the same pileupcolumn object (i.e a specific aligned base) I find the same base but aligned to different strands? For example, can I find a coverage of 50 'A's that align to ...
1
vote
2answers
204 views

Chunk alignment in a name sorted bam for parallel processing

I have a bam file with 1 billion alignment reads of which there are 700 million unique reads. I want to split the alignments into chunks for parallel-processing. Multi-alignments of the same read ...
3
votes
1answer
316 views

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 ...
5
votes
1answer
241 views

Using pysam with cython: htslib/kstring.h not found

I'm trying to learn to use cython to speed up some code based on pysam. My issue is not strictly speaking about bioinformatics, but rather about building tools using a bioinformatics library. I hope ...
2
votes
1answer
305 views

pysam pileup: what reads appear in the pileup?

Cross-posted on Biostars (with no answers currently). I hope that's OK. I thought that iff a read matches the reference at a position, it would appear in the pileup column for that position. But ...
7
votes
1answer
1k views

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 ...
7
votes
1answer
298 views

Reject reads with low quality bases from a Bam file through pysam

I have a code below: ...
7
votes
1answer
409 views

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 ...
10
votes
1answer
403 views

Quantifying reads mapping to multiple loci

I have been using STAR for our RNA-Seq samples. The final.out log file reports percentage of uniquely mapped reads along with percentage of reads that map to ...