getzlab / deTiN

DeTiN is designed to measure tumor-in-normal contamination and improve somatic variant detection sensitivity when using a contaminated matched control.
BSD 3-Clause "New" or "Revised" License
49 stars 21 forks source link

TypeError: object of type 'numpy.float64' has no len(): len(self.ascna_based_model.centroids) #23

Closed lelagina-broad closed 5 years ago

lelagina-broad commented 5 years ago

I recently encountered this error across several CLL samples:

Traceback (most recent call last):
  File "/root/deTiN/deTiN/deTiN.py", line 606, in <module>
    main()
  File "/root/deTiN/deTiN/deTiN.py", line 565, in main
    do.calculate_joint_estimate()
  File "/root/deTiN/deTiN/deTiN.py", line 266, in calculate_joint_estimate
    if len(self.ascna_based_model.centroids) > 1:
TypeError: object of type 'numpy.float64' has no len()

Here is the code that initializes object ascna_based_model:

import deTiN_aSCNA_based_estimate as dascna
ascna_based_model = dascna.model(di.seg_table, di.het_table, di.resolution)

When I checked the centroids parameter for the object it is initialized to numpy array in the init function:

 self.centroids = np.zeros([3, 1])

I am not sure where in the code it is reinitialized and hence fails this condition:

if len(self.ascna_based_model.centroids) > 1:
amarotaylor commented 5 years ago

I fixed this issue. Please try rerunning