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
21
votes
6 answers
unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory (pysam installation)
I am trying to install pysam.
After excecuting:
python path/to/pysam-master/setup.py build
This error is produced:
unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory
error: command 'x86_64-conda_cos6-linux-gnu-gcc'…

Sergio.pv
- 1,380
- 4
- 14
- 23
15
votes
3 answers
How to cache reads?
I am using python/pysam to do analyze sequencing data. In its tutorial (pysam - An interface for reading and writing SAM files) for the command mate it says:
'This method is too slow for high-throughput processing. If a read needs to be processed…

user2725109
- 2,286
- 4
- 27
- 46
4
votes
1 answer
Deeptools cannot find file that exists
An intern of mine is trying to use deeptools' bamCoverage function, and it throws a '/my/dir/data.bam' file does not exist error, despite the file being there. Yes, the file does exist, we can manipulate it using bash commands just fine so there's…

Whitehot
- 383
- 3
- 19
4
votes
2 answers
Why does installing pysam python package fail?
I'm new to python and running the command:
pip install pysam
Which results in:
Collecting pysam
Using cached https://files.pythonhosted.org/packages/25/7e/098753acbdac54ace0c6dc1f8a74b54c8028ab73fb027f6a4215487d1fea/pysam-0.15.4.tar.gz
…

Kyle
- 32,731
- 39
- 134
- 184
3
votes
2 answers
Keep getting error incompatible library version libchtslib.so requires version 9.0.0 or later, but libcurl.4.dylib provides version 7.0.0
I am trying to install a program called metaBIT. I was able to add it to my PATH. But when I execute:
metaBIT -h
It errors and gives me this:
Traceback (most recent call last):
File "/Users/twpierson/edirect/metaBIT", line 12, in
import…

user3105519
- 309
- 4
- 10
2
votes
3 answers
sum elements in python list if match condition
I have a variable with lists with varied number of elements:
['20', 'M', '10', 'M', '1', 'D', '14', 'M', '106', 'M']
['124', 'M', '19', 'M', '7', 'M']
['19', 'M', '131', 'M']
['3', 'M', '19', 'M', '128', 'M']
['12', 'M', '138', 'M']
Variable is…

fonpe
- 23
- 2
2
votes
2 answers
snakemake script access to stdin / stdout for stream processing
For a Snakemake workflow, I need to manipulate tags in many BAM files, and would like to process these by piping them through a script (using the Snakemake script: directive). The specific way I'm doing this is with pysam stream processing.
infile =…

Krischan
- 41
- 3
2
votes
0 answers
Import tab delimited file as pandas dataframe when column orders in not fixed in each row
I am trying to import a tab-delimited sam file as a pandas dataframe.
NB501670:42:HJL7WAFXX:1:11209:17120:18358 83 chr1 13182 0 86M = 13178 -90 CAGCTGTAACTCAAAGCCTTAGCCTCTGTTCCCACGAAGGCAGGGCCATCGGGCACCAAAGGGATTCTGCCAGCATAGTGCTCCTG …

Amit Goyal
- 29
- 3
2
votes
1 answer
Python consume an iterator pair-wise
I am trying to understand Python's iterators in the context of the pysam module. By using the fetch method on a so called AlignmentFile class one get a proper iterator iter consisting of records from the file file. I can the use various methods to…

user3375672
- 3,728
- 9
- 41
- 70
2
votes
1 answer
Error when I install samtools for python on windows
I am trying to install pysam and pybedtools modules on python 3.4. But I got an Error:
Collecting pysam
Using cached pysam-0.9.0.tar.gz
Complete output from command python setup.py egg_info:
'.' is not recognized as an internal or…

tov_Kirov
- 21
- 5
1
vote
0 answers
Docker installation testing fails because of missing dependency which was installed earlier
I'm trying to create a deb of a python project for Ubuntu 18.04 via docker which passes installation testing.
My compile.dockerfile includes this:
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
zlib1g-dev \
libbz2-dev…

azural
- 21
- 3
1
vote
1 answer
Snakemake Conda environment does not seem to be activating though it says it is
I am running Snakemake with the --use-conda option. Snakemake successfully creates the environment, which should include pysam. I am able to manually activate this created environment, and within it, run my script split_strands.py, which imports the…

ekofman
- 299
- 3
- 12
1
vote
1 answer
Python error: OSError: error when opening file `all_fprau.fasta`. Fasta file too large?
I have a script that searches through a csv file and a fasta file and any ID's that are in both files will be used to extract the fasta sequence from fasta file. It looks like this:
import os
import shlex
import subprocess
import argparse
import…

BrianF
- 11
- 3
1
vote
0 answers
Multiprocessing hangs after several hundred jobs
I am trying to use this question for my file processing:
Python multiprocessing safely writing to a file
This is my modification of the code:
def listener(q):
'''listens for messages on the q, writes to file. '''
while 1:
reads =…

Cindy Almighty
- 903
- 8
- 20
1
vote
2 answers
Failed to install pysam 0.13
I keep on failing to install pysam 0.13 on macOS High Sierra.
To sum up my two errors:
htslib/htslib/hts.h:142:9: error: missing ',' between enumerators
json HTS_DEPRECATED_ENUM("Use htsExactFormat 'htsget' instead") = htsget,
^
…

Rafail Tasakis
- 39
- 6