1
1
import logging
2
2
import pathlib
3
- from collections import namedtuple
4
3
5
4
import pandas as pd
6
5
7
- from .ancestry .tools import choose_pval_threshold , compare_ancestry
8
6
from .principalcomponents import PopulationType
9
7
from .ancestry import read
10
8
@@ -67,6 +65,7 @@ def _check_overlap(self, ref_pc, target_pc):
67
65
def adjust (self , * , ref_pc , target_pc , ** kwargs ):
68
66
"""
69
67
>>> from ._config import Config
68
+ >>> from .principalcomponents import PrincipalComponents
70
69
>>> ref_pc = PrincipalComponents(pcs_path=[Config.ROOT_DIR / "tests" / "ref.pcs"], dataset="reference", psam_path=Config.ROOT_DIR / "tests" / "ref.psam", pop_type=PopulationType.REFERENCE)
71
70
>>> target_pcs = PrincipalComponents(pcs_path=Config.ROOT_DIR / "tests" / "target.pcs", dataset="target", pop_type=PopulationType.TARGET)
72
71
>>> score_path = Config.ROOT_DIR / "tests" / "aggregated_scores.txt.gz"
@@ -81,28 +80,28 @@ def adjust(self, *, ref_pc, target_pc, **kwargs):
81
80
self ._check_overlap (ref_pc = ref_pc , target_pc = target_pc )
82
81
83
82
# join pgs + pca data
84
- target_df = target_pc .df .join (self .df .loc [self .target_name ], on = "IID" )
85
- reference_df = ref_pc .df .join (self .df .loc ["reference" ], on = "IID" )
86
-
87
- # set up
88
- ancestry_args = namedtuple ("ancestry_args" , ["method_compare" , "pThreshold" ])
89
- args = ancestry_args (
90
- kwargs .get ("method_compare" , "RandomForest" ), kwargs .get ("pThreshold" , None )
91
- )
92
- assignment_threshold_p = choose_pval_threshold (args )
83
+ # target_df = target_pc.df.join(self.df.loc[self.target_name], on="IID")
84
+ # reference_df = ref_pc.df.join(self.df.loc["reference"], on="IID")
85
+ #
86
+ # # set up
87
+ # ancestry_args = namedtuple("ancestry_args", ["method_compare", "pThreshold"])
88
+ # args = ancestry_args(
89
+ # kwargs.get("method_compare", "RandomForest"), kwargs.get("pThreshold", None)
90
+ # )
91
+ # assignment_threshold_p = choose_pval_threshold(args)
93
92
94
93
# TODO: bork
95
- ancestry_ref , ancestry_target , compare_info = compare_ancestry (
96
- ref_df = reference_df ,
97
- ref_pop_col = ref_pc .poplabel ,
98
- ref_train_col = "Unrelated" ,
99
- target_df = target_df ,
100
- n_pcs = ref_pc .npcs_popcomp ,
101
- method = args .method_compare ,
102
- p_threshold = assignment_threshold_p ,
103
- )
104
-
105
- pass
94
+ # ancestry_ref, ancestry_target, compare_info = compare_ancestry(
95
+ # ref_df=reference_df,
96
+ # ref_pop_col=ref_pc.poplabel,
97
+ # ref_train_col="Unrelated",
98
+ # target_df=target_df,
99
+ # n_pcs=ref_pc.npcs_popcomp,
100
+ # method=args.method_compare,
101
+ # p_threshold=assignment_threshold_p,
102
+ # )
103
+
104
+ raise NotImplementedError
106
105
107
106
108
107
class PolygenicScore :
0 commit comments