You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to deepTools GitHub repository! Before opening the issue please check
that the following requirements are met :
Search whether this issue (or a similar issue) has been solved before
using the search tab above. Link the previous issue if appropriate below.
Paste your deepTools version (deeptools --version) and your python
version (python --version) below.
deeptools 3.5.5
Python 3.10.12
Paste the full deepTools command that produces the issue below
(ignore if you simply spotted the issue in the code/documentation).
The error is generated when using the function writeBedGraph_bam_and_bw.writeBedGraph.
from deeptools import writeBedGraph_bam_and_bw
import os
from argparse import ArgumentParser
import numpy as np
def getType(fname):
"""
function from deeptools bigwigAverage.py
Tries to determine if a file is a wiggle file a bigWig file.
Returns 'wiggle' if the file name ends with .wig, otherwise 'bigwig'
"""
if fname.endswith(".wig") or fname.endswith(".wiggle"):
return "wiggle"
elif fname.lower().endswith(".bedgraph") or fname.endswith(".bdg"):
return "bedgraph"
else:
return "bigwig"
def identity(tileCoverage, args):
'''
an identity function to map over the tileCoverage object
'''
# print('running function')
# return [float(cov[0]) for cov in tileCoverage]
return np.mean(tileCoverage)
def smooth_bigwig(bigwig, smooth_length, outpath=None, n_threads=1, as_bedgraph=False):
if outpath == None:
outpath = os.path.dirname(bigwig) + '/' + os.path.basename(bigwig)[0] + f'_smooth_{smooth_length}.bw'
format = 'bigwig'
if as_bedgraph:
format = 'bedgraph'
print(bigwig, smooth_length, outpath,getType(bigwig) )
writeBedGraph_bam_and_bw.writeBedGraph([(bigwig, getType(bigwig))], numberOfProcessors=n_threads,
outputFileName=outpath,
fragmentLength=0,
format=format,
extendPairedEnds=False,
func=identity, funcArgs=[0],
smoothLength=smooth_length,
# skipOverZero=False
)
Paste the output printed on screen from the command that produces the issue
below (ignore if you simply spotted the issue in the code/documentation).
Traceback (most recent call last):
File "/tscc/projects/ps-renlab2/szu/projects/amb_pairedtag/02.track/src/main/python/smooth_bigwig.py", line 83, in <module>
main()
File "/tscc/projects/ps-renlab2/szu/projects/amb_pairedtag/02.track/src/main/python/smooth_bigwig.py", line 75, in main
smooth_bigwig(bigwig=args.input,
File "/tscc/projects/ps-renlab2/szu/projects/amb_pairedtag/02.track/src/main/python/smooth_bigwig.py", line 40, in smooth_bigwig
writeBedGraph_bam_and_bw.writeBedGraph([(bigwig, getType(bigwig))], numberOfProcessors=n_threads,
File "/home/szu/mambaforge/lib/python3.10/site-packages/deeptools/writeBedGraph_bam_and_bw.py", line 211, in writeBedGraph
res = mapReduce.mapReduce((tileSize, fragmentLength, bamOrBwFileList,
File "/home/szu/mambaforge/lib/python3.10/site-packages/deeptools/mapReduce.py", line 146, in mapReduce
res = list(map(func, TASKS))
File "/home/szu/mambaforge/lib/python3.10/site-packages/deeptools/writeBedGraph_bam_and_bw.py", line 42, in writeBedGraph_wrapper
return writeBedGraph_worker(*args)
File "/home/szu/mambaforge/lib/python3.10/site-packages/deeptools/writeBedGraph_bam_and_bw.py", line 88, in writeBedGraph_worker
vectorStart, vectorEnd = getSmoothRange(
NameError: name 'getSmoothRange' is not defined
Thanks!
Sincerely,
Songpeng
The text was updated successfully, but these errors were encountered:
For some more information, "getSmoothRange" is defined as a class method of "CountReadsPerBin", with no references to self within the function countReadsPerBin.py line 906.
I addressed the issue on my own end by copying the function to writeBedGraph_bam_and_bw.py, and simply removing "self" from the function inputs.
Welcome to deepTools GitHub repository! Before opening the issue please check
that the following requirements are met :
Search whether this issue (or a similar issue) has been solved before
using the search tab above. Link the previous issue if appropriate below.
Paste your deepTools version (
deeptools --version
) and your pythonversion (
python --version
) below.deeptools 3.5.5
Python 3.10.12
(ignore if you simply spotted the issue in the code/documentation).
The error is generated when using the function
writeBedGraph_bam_and_bw.writeBedGraph
.below (ignore if you simply spotted the issue in the code/documentation).
Thanks!
Sincerely,
Songpeng
The text was updated successfully, but these errors were encountered: