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

Fix scaling: take chromsizes from header #239

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Phlya
Copy link
Member

@Phlya Phlya commented May 3, 2024

Scaling without a view was broken! Docs said it would use the chromsizes from the header, but there was no code that was doing it...

@Phlya Phlya requested a review from golobor May 3, 2024 13:18
@Phlya
Copy link
Member Author

Phlya commented May 3, 2024

) # double unmapped pairs are currently ignored by lib.scaling

Are single unmapped pairs somehow supposed to contribute to scaling? I think this might be why the test fails...

@golobor
Copy link
Member

golobor commented May 3, 2024 via email

@Phlya
Copy link
Member Author

Phlya commented May 3, 2024

Then why does the test assert 9 total pairs? It doesn't make sense to me, but somehow I guess this test was passing before?

@Phlya
Copy link
Member Author

Phlya commented May 3, 2024

(As an aside, in the file there is a pair with both sides beyond the end of the chromosome... should that actually error or warn at least?)

@Phlya
Copy link
Member Author

Phlya commented May 3, 2024

OK, I think I know where the problem is: when not chromsizes are provided, internally they are created from the data, and then there is a fake chrom "!" which I guess just behaves like any other chromosome...

if chromsizes is None:

So I would say the test is wrong in this case?

)

if isinstance(pairs, pd.DataFrame):
pairs_df = pairs

elif isinstance(pairs, str) or hasattr(pairs, "buffer") or hasattr(pairs, "peek"):
pairs_df, _, _ = pairsio.read_pairs(pairs, nproc=nproc_in, chunksize=chunksize)
pairs_df, _, chromsizes = pairsio.read_pairs(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main change

@Phlya
Copy link
Member Author

Phlya commented Jun 4, 2024

@golobor can we merge this?

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

Successfully merging this pull request may close these issues.

2 participants