Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: cannot convert the series to <class 'float'> #259

Closed
aakashsur opened this issue Aug 10, 2021 · 1 comment
Closed

TypeError: cannot convert the series to <class 'float'> #259

aakashsur opened this issue Aug 10, 2021 · 1 comment

Comments

@aakashsur
Copy link

I'm have a lot of "chromosomes" (genome assembly), and it is causing me to hit this line during zoomify -

maxres = int(ceil(genome_length / mean_fragsize / HIGLASS_TILE_DIM))

In particular, the previous line seems to result in a series rather than a number -

mean_fragsize = clr.bins()[['end', 'start']][:].diff(axis=1).mean()

end             NaN
start   -643.747129
dtype: float64

If I understand the code correctly, perhaps a line like this would work -

mean_fragsize = (clr.bins()['end'][:] - clr.bins()['start'][:]).mean()

Then I hit another error -

TypeError: '<' not supported between instances of 'NoneType' and 'int'

Which stems from -

if bases is None:

bases going in was {None} for me, but since a set contain None is True, it goes to the else statement. If I change the if statement to list(bases)[0] it seems to resolve the issue.

And then a final error -

KeyError: "Unable to open object (object '1000' doesn't exist)"

Ultimately I believe this is because my cooler file doesn't have a fixed bin width. Since many contigs were below the lowest bin size (1kb) it probably defaulted to a variable bin size and fails during zoomify.

Here is the output of cooler info

{
    "bin-size": null,
    "bin-type": "variable",
    "creation-date": "2021-08-09T14:32:55.765059",
    "format": "HDF5::Cooler",
    "format-url": "https://github.com/open2c/cooler",
    "format-version": 3,
    "generated-by": "cooler-0.8.11",
    "genome-assembly": "ltarentolae_50000split",
    "nbins": 50061,
    "nchroms": 50061,
    "nnz": 13231173,
    "storage-mode": "symmetric-upper",
    "sum": 30387255
}

Not really sure what the resolution might be, also I don't know if those particular lines are correct per se, but thought I would just point the issue out.

@nvictus
Copy link
Member

nvictus commented Mar 8, 2024

@aakashsur thank you for reporting this - indeed the issue was with variable bin sizes - and sorry for not getting back sooner. Closing as this was fixed by @Phlya in #332

@nvictus nvictus closed this as completed Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants