本文整理汇总了Python中SampleData.sample_weights_2方法的典型用法代码示例。如果您正苦于以下问题:Python SampleData.sample_weights_2方法的具体用法?Python SampleData.sample_weights_2怎么用?Python SampleData.sample_weights_2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SampleData
的用法示例。
在下文中一共展示了SampleData.sample_weights_2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_model
# 需要导入模块: import SampleData [as 别名]
# 或者: from SampleData import sample_weights_2 [as 别名]
def test_load_model(self):
snp_model = PredictionModel.load_model("tests/_td/dbs/test_1.db")
e_e = SampleData.dataframe_from_extra(SampleData.sample_extra_2())
numpy.testing.assert_array_equal(snp_model.extra[PredictionModel.WDBEQF.K_GENE], e_e[PredictionModel.WDBEQF.K_GENE])
numpy.testing.assert_array_equal(snp_model.extra[PredictionModel.WDBEQF.K_GENE_NAME], e_e[PredictionModel.WDBEQF.K_GENE_NAME])
numpy.testing.assert_array_equal(snp_model.extra[PredictionModel.WDBEQF.K_N_SNP_IN_MODEL], e_e[PredictionModel.WDBEQF.K_N_SNP_IN_MODEL])
numpy.testing.assert_array_equal(snp_model.extra[PredictionModel.WDBEQF.K_PRED_PERF_R2], e_e[PredictionModel.WDBEQF.K_PRED_PERF_R2])
numpy.testing.assert_array_equal(snp_model.extra[PredictionModel.WDBEQF.K_PRED_PERF_PVAL], e_e[PredictionModel.WDBEQF.K_PRED_PERF_PVAL])
numpy.testing.assert_array_equal(snp_model.extra[PredictionModel.WDBEQF.K_PRED_PERF_QVAL], e_e[PredictionModel.WDBEQF.K_PRED_PERF_QVAL])
e_w = SampleData.dataframe_from_weights(SampleData.sample_weights_2())
numpy.testing.assert_array_equal(snp_model.weights[PredictionModel.WDBQF.K_RSID], e_w[PredictionModel.WDBQF.K_RSID])
numpy.testing.assert_array_equal(snp_model.weights[PredictionModel.WDBQF.K_GENE], e_w[PredictionModel.WDBQF.K_GENE])
numpy.testing.assert_array_equal(snp_model.weights[PredictionModel.WDBQF.K_WEIGHT], e_w[PredictionModel.WDBQF.K_WEIGHT])
numpy.testing.assert_array_equal(snp_model.weights[PredictionModel.WDBQF.K_NON_EFFECT_ALLELE], e_w[PredictionModel.WDBQF.K_NON_EFFECT_ALLELE])
numpy.testing.assert_array_equal(snp_model.weights[PredictionModel.WDBQF.K_EFFECT_ALLELE], e_w[PredictionModel.WDBQF.K_EFFECT_ALLELE])
示例2: test_load
# 需要导入模块: import SampleData [as 别名]
# 或者: from SampleData import sample_weights_2 [as 别名]
def test_load(self):
t = PredictionModel.ModelDB("tests/_td/dbs/test_1.db")
extra = t.load_extra()
self.assertEqual(len(extra), 6)
e_e = zip(*(SampleData.sample_extra_2()))
self.assertEqual(extra[PredictionModel.WDBEQF.GENE], e_e[PredictionModel.WDBEQF.GENE])
self.assertEqual(extra[PredictionModel.WDBEQF.GENE_NAME], e_e[PredictionModel.WDBEQF.GENE_NAME])
self.assertEqual(extra[PredictionModel.WDBEQF.N_SNP_IN_MODEL], e_e[PredictionModel.WDBEQF.N_SNP_IN_MODEL])
self.assertEqual(extra[PredictionModel.WDBEQF.PRED_PERF_R2], e_e[PredictionModel.WDBEQF.PRED_PERF_R2])
self.assertEqual(extra[PredictionModel.WDBEQF.PRED_PERF_PVAL], e_e[PredictionModel.WDBEQF.PRED_PERF_PVAL])
self.assertEqual(extra[PredictionModel.WDBEQF.PRED_PERF_QVAL], e_e[PredictionModel.WDBEQF.PRED_PERF_QVAL])
weights = t.load_weights()
self.assertEqual(len(weights), 5)
e_w = zip(*(SampleData.sample_weights_2()))
self.assertEqual(weights[PredictionModel.WDBQF.RSID], e_w[PredictionModel.WDBQF.RSID])
self.assertEqual(weights[PredictionModel.WDBQF.GENE], e_w[PredictionModel.WDBQF.GENE])
self.assertEqual(weights[PredictionModel.WDBQF.WEIGHT], e_w[PredictionModel.WDBQF.WEIGHT])
self.assertEqual(weights[PredictionModel.WDBQF.REF_ALLELE], e_w[PredictionModel.WDBQF.REF_ALLELE])
self.assertEqual(weights[PredictionModel.WDBQF.EFF_ALLELE], e_w[PredictionModel.WDBQF.EFF_ALLELE])