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

281 ancestry = unknown not shown in table 3 subject counts by ancestry group #290

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cgr_gwas_qc/reporting/sample_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def construct(
call_rate_png: Path,
ancestry_png: Path,
) -> "SampleQC":

return cls(
ArrayProcessing.construct(sample_sheet),
CompletionRate.construct(snp_qc, sample_qc, call_rate_png),
Expand Down Expand Up @@ -206,7 +205,6 @@ def _count_subjects(sample_qc: pd.DataFrame) -> int:

@dataclass
class Ancestry:

table: str
png: str

Expand All @@ -216,6 +214,12 @@ def construct(cls, sample_qc: pd.DataFrame, png: Path) -> "Ancestry":

@staticmethod
def _build_table(sample_qc: pd.DataFrame) -> str:
# Issue 281: Ensure 'Other' ancestry output from graf-pop captured in table 3

# Add 'Other' to the categories and full blanks with "Other"
sample_qc["Ancestry"] = sample_qc["Ancestry"].cat.add_categories(["Other"])
sample_qc["Ancestry"] = sample_qc["Ancestry"].fillna("Other")

return (
sample_qc.query("is_subject_representative")
.groupby("Ancestry")
Expand Down
Loading