-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add additional_samples_to_drop option to run_pca_with_relateds
#489
Conversation
run_pca_with_relateds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly one comment that will change a few names and comments/docstrings if you agree.
gnomad/sample_qc/ancestry.py
Outdated
@@ -259,52 +259,60 @@ def assign_population_pcs( | |||
def run_pca_with_relateds( | |||
qc_mt: hl.MatrixTable, | |||
related_samples_to_drop: Optional[hl.Table], | |||
outlier_samples_to_drop: Optional[hl.Table], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thought is to modify this to additional samples to drop or something like that. Right now for removing unreleasable samples we just combine them with the related sample HT that we pass to this function, but we could just pass that table here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like additional samples to drop. Don't we drop the unreleasable samples and non-high-quality samples completely before running this step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not include_unreleasable_samples:
logger.info("Excluding unreleasable samples for PCA.")
samples_to_drop = samples_to_drop.union(
qc_mt.filter_cols(
~project_meta.ht()[qc_mt.col_key].releasable
| project_meta.ht()[qc_mt.col_key].exclude
)
.cols()
.select()
)
else:
logger.info("Including unreleasable samples for PCA")
return run_pca_with_relateds(qc_mt, samples_to_drop, n_pcs=n_pcs)
We do drop samples that fail hard filtering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, for the subpop analysis the unreleasable samples are dropped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's fine
run_pca_with_relateds
run_pca_with_relateds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, only thing is that we might want to add a breaking change label because if anyone used run_pca_with_relateds(qc_mt, related_samples_to_drop_table, n_pcs)
it won't work
Co-authored-by: jkgoodrich <33063077+jkgoodrich@users.noreply.github.com>
-Resolves issue where the
autosomes_only
filter was ignored ifrelated_samples_to_drop
was provided torun_pca_with_relateds
-Adds an additional_samples_to_drop option to
run_pca_with_relateds
, which will remove additional provided samples when generating the PCs and then project them in the PC space