Skip to content

Commit

Permalink
Merge pull request #290 from NCI-CGR/281-ancestry-=-unknown-not-shown…
Browse files Browse the repository at this point in the history
…-in-table-3-subject-counts-by-ancestry-group

281 ancestry = unknown not shown in table 3 subject counts by ancestry group
  • Loading branch information
kliao12 authored May 24, 2024
2 parents 709cc32 + afed114 commit 9c065cc
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 9c065cc

Please sign in to comment.