Skip to content

Fix scaling: take chromsizes from header#239

Open
Phlya wants to merge 5 commits into
masterfrom
fix-scaling-chromsizes
Open

Fix scaling: take chromsizes from header#239
Phlya wants to merge 5 commits into
masterfrom
fix-scaling-chromsizes

Conversation

@Phlya

@Phlya Phlya commented May 3, 2024

Copy link
Copy Markdown
Member

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

Phlya commented May 3, 2024

Copy link
Copy Markdown
Member Author

) # 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

golobor commented May 3, 2024 via email

Copy link
Copy Markdown
Member

@Phlya

Phlya commented May 3, 2024

Copy link
Copy Markdown
Member Author

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

Phlya commented May 3, 2024

Copy link
Copy Markdown
Member Author

(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

Phlya commented May 3, 2024

Copy link
Copy Markdown
Member Author

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?

Comment thread pairtools/lib/scaling.py

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
Copy Markdown
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

Phlya commented Jun 4, 2024

Copy link
Copy Markdown
Member Author

@golobor can we merge this?

@Phlya

Phlya commented Jan 9, 2026

Copy link
Copy Markdown
Member Author

Shall we merge this? I realize the PR is full of blackification, sorry it's annoying...

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