Skip to content

Commit

Permalink
Merge branch '216-ancestry-triangle-plot-bug' into default
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Liao committed Mar 21, 2024
2 parents 93ebb0e + abc3449 commit bbcdad8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cgr_gwas_qc/workflow/scripts/sample_qc_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,10 @@ def _read_GRAF(file_name: Path, Sample_IDs: pd.Index) -> pd.DataFrame:
.. _manuscript: https://pubmed.ncbi.nlm.nih.gov/31151998/
"""

return (
pd.read_csv(file_name, sep="\t")
.rename({"Subject": "Sample_ID"}, axis=1)
.assign(Sample_ID=lambda x: x["Subject"].astype(str)) #Issue 216: When subject IDs are numeric reindex fails. This makes sure index Sample_ID will always be as a character
.assign(Ancestry=lambda x: x["Computed population"].str.replace(" ", "_"))
.assign(AFR=lambda x: x["P_f (%)"] / 100)
.assign(EUR=lambda x: x["P_e (%)"] / 100)
Expand Down

0 comments on commit bbcdad8

Please sign in to comment.