Pysam is a python module for reading and manipulating Samfiles. It's a lightweight wrapper of the samtools C-API. Pysam also includes an interface for tabix.
Questions tagged [pysam]
50 questions
1
vote
2 answers
Python- Can not install HTSEq
I can not install HTSeq in python 3.6.1.
When I try to install, it gives me this error:
"AttributeError: 'NoneType' object has no attribute 'encoding'[0m 2"

user6941992
- 11
- 2
1
vote
2 answers
Detect large deletions from CIGAR string
I am new to sequence analysis and I'm doing some exercises to help me learn to use pysam and samtools for WGS data analysis. One thing I would like to do is to detect (rather large) deletions from 2D Oxford nanopore data (large reads). For this…

Sigurgeir
- 365
- 2
- 12
1
vote
1 answer
Multiprocess, various process reading the same file
I am trying to simulate some dna-sequencing reads, and,in order to speed-up the code, I am in need to run it on parallel.
Basically, what I am trying to do is the following:I am sampling reads from the human genome, and I think that one the two…

Praderas
- 471
- 4
- 14
1
vote
1 answer
BAM file: getting all reads on certain position with pysam
I have a BAM-file with on a certain position 520817 reads (as seen in IGV). However, when I use pysam to get the read name and the associated nucleotide on a specific position, I do not get that amount by far (only get around 7000 reads). I think I…

Michaël Noë
- 31
- 2
1
vote
0 answers
An issue about pysam installation
It's linux, using conda to install pysam, and pip install pysam keep failing.
After successful installed pysam,
pysam shows in conda list and appears in anaconda2/pkgs/
but when import pysam in python 2.7.12, it failed by Traceback (most recent…

Lucas Lau
- 27
- 2
1
vote
2 answers
Is there a way to save an entire "alignment field/column" into a NumPy array using Samtools?
In the SAM format, each alignment line represents the linear alignment of a segment, and each line have 11 mandatory fields, i.e. QNAME, FLAG, RNAME, POS, MAPQ, etc.
Let's say I wanted a NumPy array of all "QNAMES" in a given BAM file. Or, one…

ShanZhengYang
- 16,511
- 49
- 132
- 234
1
vote
0 answers
Upgrading python pacakge in python2.7
I am new to python. I need to run a python script(riboplot) in python2.7 which requires the package "pysam_0.8.4" to run. In my python2.7, when I checked the version
import pysam
pysam.__version__
it showed me '0.7.5'. But in my python3.4, it is…

Carol
- 367
- 2
- 3
- 18
1
vote
1 answer
How to use pysam.view to emulate all functions of samtools view
I am trying to use pysam.view() to filter out certain alignments from a BAM file. The problem I am facing is how to include several regions in the filter.
pysam.view() emulates the samtools view command which allows one to enter several regions…

Chaus
- 11
- 1
1
vote
1 answer
Error message when use Python multiprocessing
I need to convert a very huge .bam file to .bed file, although I found a solution by using bedops's bam2bed parallel, that parallel support SEG and gnuParallel, the two clusters I can access only support slurm and torque schedulers, and I do not…

Fei Yuan
- 11
- 2
1
vote
2 answers
Accessing Bam file at particular location using Pysam
I have a given chromosome number and location (chr1 and location 1599812). I want to use the pysam module of python to access the bam file to obtain read numbers information for only that particular region chr1 and location 1599812. I have tried…

BioInformatician
- 97
- 2
- 12
0
votes
1 answer
Converting nested tuple 0 into row in matrix
I'm tring to make a code to simulation a wind turbine but it doesn't work, the error message that diplay said me that there is a worst tuple in my dictionnary but i've verified that several times but ther is no error. I need help.
Here is the code…
0
votes
0 answers
Error in installing of pysam (error to build HSTlib) during of CNVkit installation
enter image description here
I install the Linux server by VMware and try to install CNVkit but during the build of wheel in installation of pysam we have upper mentioned error. I had tried to install pysam separately but the same error was happened…
0
votes
0 answers
PySAM import failure on python3.11 macbookPro M2
I am working with a macbook Pro M2, I have installed pyhton3. 11, and I have installed PySAM using "pip install PySAM" in the terminal. However, I cannot use and import PySAM in my python environment. I have tried it with jupyter and visual studio…

Taslimi
- 1
0
votes
0 answers
Pysam view yield reads one at a time
I'm trying to using pysam to filter a .bam file for mapping quality and excluding flags.
I know I can use .fetch() and iterate through reads that way, but I'm guessing it's faster to first use pysam.view()
However, when I try this on a large .bam,…

rbierman
- 71
- 3
0
votes
0 answers
MapDamage [E::fai_retrieve] Failed to retrieve block: unexpected end of file, in snakemake pipeline
I don't know what to check next to solve the issues. I trie to re install mapdamage et transforme the .bam to .sam to check the file which seems fine.
And I still have the issue :
rule MapDammage:
input: /*/hg19.fa,…

angelina.Z.H
- 1
- 3