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 uniqueness check in intersect.by_shared_chroms() #581

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

tskir
Copy link
Collaborator

@tskir tskir commented Mar 18, 2021

Closes #574. Thank you @dajana17 for reporting this!

The intended check was to see if the entire table and other only contain one chromosome each (and it's also the same chromosome). However, .is_unique actually does almost the opposite thing: it's true when all values in the chromosome column are unique. For example, it triggers for [chr1, chr2, chr3, chr4, chr5], while the intention was to trigger for [chr1, chr1, chr1, chr1, chr1].

This appears to be a very rare edge case, because in the real world data the list of chromosomes in both tables was probably never or very rarely unique. Actually, the list of FASTA contigs (the first table) is always unique, so only the BED file needs to have non-repeating chromosomes in order for the bug to trigger.

The intended check was to see if the entire `table` and `other` only
contain one chromosome each (and it's also the same chromosome).
However, .is_unique actually does almost the opposite thing: it's true
when all values in the chromosome column are unique.
@etal
Copy link
Owner

etal commented Apr 5, 2021

I think I meant to type if table['chromosome'].nunique() == 1 and other['chromosome'].nunique() == 1: .... This will work, too. Thanks!

@etal etal merged commit eb509e2 into etal:master Apr 5, 2021
@tskir tskir deleted the fix-shared-chroms-unique branch May 9, 2021 21:44
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.

Excluded regions in cnvkit.py access don't work
2 participants