Entering edit mode
7.3 years ago
PAn
▴
20
Hi,
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)
coverage
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?
Thanks!
Did pysamstats imported properly? Can you test it in interactive mode of python?