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

Automated ploidy cutoffs for karyotype assignment in sample_qc #127

Merged
merged 13 commits into from
Jan 15, 2020

Conversation

ch-kr
Copy link
Contributor

@ch-kr ch-kr commented Dec 6, 2019

I decided to have the code check for X and Y for each case, as that made the most sense to me, but I'm open to any feedback!

@ch-kr ch-kr requested a review from lfrancioli December 6, 2019 20:38
Copy link
Contributor

@lfrancioli lfrancioli left a comment

Choose a reason for hiding this comment

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

Looks great! A few additional things to think about ...

utils/sample_qc.py Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Show resolved Hide resolved
@ch-kr
Copy link
Contributor Author

ch-kr commented Dec 13, 2019

thanks for the review, Laurent -- I made a few more changes based on your comments. let me know what you think!

Copy link
Contributor

@lfrancioli lfrancioli left a comment

Choose a reason for hiding this comment

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

This looks good! I have a few more things, some suggestions and some small problems caused by the change in interface..

utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
@ch-kr ch-kr requested a review from lfrancioli January 14, 2020 15:55
@ch-kr
Copy link
Contributor Author

ch-kr commented Jan 14, 2020

thanks for the review -- I tried some new changes, let me know what you think! happy to also sit down and chat through this sometime instead in case that's easier

Copy link
Contributor

@lfrancioli lfrancioli left a comment

Choose a reason for hiding this comment

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

Looking better and better!

utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
xx_x_stats.mean + (upper_SD_cutoff * xx_x_stats.stdev)
]
cutoffs["Y"] = [
abs(xx_y_stats.mean - (upper_SD_cutoff * xx_y_stats.stdev)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want abs here. I think max(0, ...) is what we want in theory. Although I don't even think we need this as coverage can never be negative 0 is the same as any negative number in practice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe I misunderstood the purpose of abs here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this abs because i wanted to use the upper cutoff of Y ploidy in XX samples as the lower cutoff for a single copy of Y (any samples above this cutoff will get marked as at least having one copy of Y). Unfortunately, I realized when testing the code that Y ploidy distribution in the XX samples was so tight that this value was negative (and in this case, max(0, ...) wouldn't work, as every sample would get called as having at least one copy of Y). Happy to change this, let me know what you think!

utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
@ch-kr ch-kr requested a review from lfrancioli January 15, 2020 14:46
@ch-kr
Copy link
Contributor Author

ch-kr commented Jan 15, 2020

thanks for the suggestions -- the code looks much tidier now! I think we're getting close, let me know what you think about the lower cutoff for single copy of Y (#127 (comment))

utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Show resolved Hide resolved
@ch-kr ch-kr requested a review from lfrancioli January 15, 2020 16:51
@ch-kr
Copy link
Contributor Author

ch-kr commented Jan 15, 2020

I updated the cutoffs and unnested get_ploidy_cutoffs, as we discussed. Let me know if I've missed anything!

Copy link
Contributor

@lfrancioli lfrancioli left a comment

Choose a reason for hiding this comment

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

A las bit of nit-picking about interface types for the cutoffs

utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
utils/sample_qc.py Outdated Show resolved Hide resolved
@ch-kr ch-kr requested a review from lfrancioli January 15, 2020 17:31
@ch-kr
Copy link
Contributor Author

ch-kr commented Jan 15, 2020

Thanks for those suggestions -- I added the edits and an additional set of logging statements (just to send the XX/XY stats and X/Y cutoffs to stdout)

@lfrancioli lfrancioli merged commit 0191cb1 into master Jan 15, 2020
@lfrancioli lfrancioli deleted the add_sex_annotations branch January 15, 2020 19:02
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