AttributeError: 'numpy.float64' object has no attribute 'split' while runnink dpeak

22 views
Skip to first unread message

Maciej Kotliński

unread,
Oct 3, 2023, 9:32:42 AM10/3/23
to DANPOS
Hi,
I'm getting this problem when I try to run danpos dpeak.
Maybe somebody could help with this?
Regards,
Maciej Kotliński

command I use:
python ./danpos.py dpeak ../../dane/bed/Flag_pH7-W1-chr/:../../dane/bed/8081_pH7-W1-chr/ -o ../../dane/DanOut/Flag-vs-8081-pH7-dpeak-chr

...

differential test for Flag_pH7-W1-chr:8081_pH7-W1-chr...
Poisson test
chr1
region: 0-461591
chr2
region: 0-6773
saving  to ../../dane/DanOut/Flag-vs-8081-pH7-dpeak-chr/diff/Flag_pH7-W1-chr-8081_pH7-W1-chr.pois_diff.wig
chr1
chr2
completed
time elapsed: 416.66956186294556 seconds

peak calling for Flag_pH7-W1-chr ...
Traceback (most recent call last):
 File "./danpos.py", line 1366, in <module>
   elif sys.argv[1]=='dpeak':runDANPOS(command='dpeak')
 File "./danpos.py", line 394, in runDANPOS
   pcfer=0)#args.pcfer)#0)
 File "/home/mk/yersinia-chip-seq/Python-3.7.17-env/DANPOS3/functions.py", line 340, in danpos
   mode='w',title_line=1,pos_only=False)
 File "/home/mk/yersinia-chip-seq/Python-3.7.17-env/DANPOS3/wig.py", line 202, in callRegions
   while( (0-functions.div(float(functions.ppois(height,m.item()).split()[-1]),log(10))) < pheight):height+=1
AttributeError: 'numpy.float64' object has no attribute 'split'

____________________
python: 3.7.17
numpy: 1.18.5
rpy2: 3.3.3
argparse: 1.1
pysam: 0.16.0.1


Maciej Kotliński

unread,
Oct 13, 2023, 9:28:05 AM10/13/23
to DANPOS
Hi,
This problem is solved in developmental branch od Danpos from SimHolz (https://github.com/SimHolz/DANPOS3/tree/develop 13.10.2023) but there are still other bugs causing errors while using dpeak or dtriple (AttributeError: 'numpy.float64' object has no attribute 'split').

I managed to run dpeak (and dtriple) by removing ".split()[-1]" from two places in functions.py.

functions.py line 731
-        else:sdiff=float((ppois(unnumpy(max(s1,s2)+1),unnumpy(min(s1,s2)+1))/log(10)).split()[-1])
+       gdiff,ldiff=float(gcol[6]),float(lcol[6])# (0-log10Pval) of gain and loss

functions.py line 807
-        else:sdiff=float((ppois(unnumpy(max(s1,s2)+1),unnumpy(min(s1,s2)+1))/log(10)).split()[-1])  #Oryginalna linia
+       else:sdiff=float((ppois(unnumpy(max(s1,s2)+1),unnumpy(min(s1,s2)+1))/log(10)))

Regards,
Maciek

danpos dpeak error in  SimHolz develop branch (https://github.com/SimHolz/DANPOS3/tree/develop 13.10.2023):

peak level integrative analysis for Flag_pH7-W1-chr:8081_pH7-W1-chr ...
FDR simulation...
0 simulated
Traceback (most recent call last):
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/danpos.py", line 1366, in <module>
   elif sys.argv[1]=='dpeak':runDANPOS(command='dpeak')
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/danpos.py", line 365, in runDANPOS
   danpos(\
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/functions.py", line 549, in danpos
   fdrlist=peakFDR(peakFile1=os.path.join(opath,'pooled',groupnames[1]+addname+"refpeaks.xls"),\
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/functions.py", line 807, in peakFDR
   else:sdiff=float((ppois(unnumpy(max(s1,s2)+1),unnumpy(min(s1,s2)+1))/log(10)).split()[-1])
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'numpy.float64' object has no attribute 'split'

After removing split() from line 807:

Traceback (most recent call last):
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/danpos.py", line 1366, in <module>
   elif sys.argv[1]=='dpeak':runDANPOS(command='dpeak')
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/danpos.py", line 365, in runDANPOS
   danpos(\
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/functions.py", line 552, in danpos
   region_differential(file1=os.path.join(opath,'pooled',groupnames[1]+addname+"refpeaks.xls"),\
 File "/home/mk/yersinia-chip-seq/DANPOS3-SimHolz-Dev/functions.py", line 731, in region_differential
   else:sdiff=float((ppois(unnumpy(max(s1,s2)+1),unnumpy(min(s1,s2)+1))/log(10)).split()[-1])
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'numpy.float64' object has no attribute 'split'

simon holzinger

unread,
Oct 13, 2023, 9:44:23 AM10/13/23
to DANPOS
Hi Maciek,

sorry for not coming back to you earlier. 
Thanks for finding (and fixing) the bug. I never use dtriple, therefore I missed it. 
I updated the development branch with your fix (and the pull request as well). 

This bug occurred because the ppois function was changed from a r implementation to a python implementation which is much faster. In the course of the change the return of the function was changed slightly as well, abolishing the need for the split[-1] step. I thought I updated every occurrence of ppois but somehow I missed these two... sorry! 

Best wishes
Simon  

Reply all
Reply to author
Forward
0 new messages