Question: Error in pysamstats
gravatar for PAn
2.3 years ago by
United States
PAn20 wrote:


I am trying to run pysamstats through a python script in jupyter, here is the code that I am trying to use :

from __future__ import division, print_function
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import sklearn
import pysam
import pysamstats
fasta_filename = 'data/Pf3D7_v3.fa'  # path to the reference genome FASTA file
bam_filename = 'data/Dd2.bam'  # path to the BAM file containing aligned sequence reads
fasta = pysam.Fastafile(fasta_filename)
bam = pysam.Samfile(bam_filename)
chrom = 'Pf3D7_05_v3'  # chromosome 5
window_size = 300  # use 300bp non-overlapping windows
coverage = pysamstats.load_coverage_ext_binned(bam, fasta, chrom=chrom, pad=True, window_size=window_size)

But the pysamstats.load_coverage_ext_binned is giving me this error -

AttributeError                            Traceback (most recent call last)
<ipython-input-18-5bdb4812a1d5> in <module>()
      3 chrom = 'Pf3D7_05_v3'  # chromosome 5
      4 window_size = 300  # use 300bp non-overlapping windows
----> 5 coverage = pysamstats.load_coverage_ext_binned
      6 coverage

AttributeError: 'module' object has no attribute 'load_coverage_ext_binned'

I tried to correct this lot and wen through the modules list as well, but I cannot resolve it.

Can anyone please suggest?


pysamstats jupyter python • 865 views
ADD COMMENTlink modified 2.2 years ago by Biostar ♦♦ 20 • written 2.3 years ago by PAn20

Did pysamstats imported properly? Can you test it in interactive mode of python?

ADD REPLYlink written 2.3 years ago by Vitis2.1k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 925 users visited in the last hour