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
The script 00_rmChr.py produces the following error:
Traceback (most recent call last):
File "/Users/usr/programs/ATACgraph/script/ATACgraph", line 38, in <module>
module.main()
File "/Users/usr/programs/ATACgraph/script/00_rmChr.py", line 80, in main
rmChr(infile,outfile,targetChr)
File "/Users/usr/programs/ATACgraph/script/00_rmChr.py", line 49, in rmChr
dupread += 1
UnboundLocalError: local variable 'dupread' referenced before assignment
I resolved this issue by editing the script:
def rmChr (infile,outfile,targetChr):
samfile = openBamFile(infile)
samout = pysam.AlignmentFile(outfile, "wb", template=samfile)
chrs = samfile.references
chrs_keep,chrs_rm = processInput (targetChr,chrs)
keepread = 0
dupread = 0 #added to fix error
for chrom in chrs_keep:
fetchread = samfile.fetch(chrom)
for read in fetchread:
samout.write(read)
keepread += 1
if read.is_duplicate:
dupread += 1
totalread = sum([x.total for x in samfile.get_index_statistics()])
removeread = totalread - keepread
removeratio = float(removeread) / totalread
for chrom in samfile.get_index_statistics():
if chrom.contig in chrs_rm:
rmcount = chrom.total
print "Remove %s %d reads" % (chrom.contig,rmcount)
print "Remove total %d out of %d (%.3f)" % (removeread,totalread,removeratio)
samout.close()
samfile.close()
Not 100% sure this was an appropriate solution.
The text was updated successfully, but these errors were encountered:
The script 00_rmChr.py produces the following error:
I resolved this issue by editing the script:
Not 100% sure this was an appropriate solution.
The text was updated successfully, but these errors were encountered: