def test_multi_open2(self): from idiva.io.vcf import ReadVCF with ReadVCF.open(vcf_file) as vcf: assert isinstance(vcf, ReadVCF) a = list(map(str, vcf)) with ReadVCF.open(vcf) as vcf: b = list(map(str, vcf)) self.assertListEqual(a, b)
def test_dataline_types(self): from idiva.io.vcf import ReadVCF, RawDataline with ReadVCF.open(vcf_file) as vcf: candidate = first(vcf) self.assertIsInstance(candidate, RawDataline) self.assertIsInstance(candidate.pos, int) self.assertIsInstance(candidate.qual, float) self.assertIsInstance(candidate.info, str)
def test_rewinds(self): from idiva.io.vcf import ReadVCF with ReadVCF.open(vcf_file) as vcf: assert isinstance(vcf, ReadVCF) with vcf.rewind_when_done: a = list(map(str, vcf)) with vcf.rewind_when_done: b = list(map(str, vcf)) self.assertListEqual(a, b)
def test_datalines_accuracy(self): from idiva.io.vcf import ReadVCF with ReadVCF.open(vcf_file) as vcf: reference = [ "20 14370 rs6054257 G A 29 PASS NS=3;DP=14;AF=0.5;DB;H2 GT:GQ:DP:HQ 0|0:48:1:51,51 1|0:48:8:51,51 1/1:43:5:.,.", "20 17330 None T A 3 q10 NS=3;DP=11;AF=0.017 GT:GQ:DP:HQ 0|0:49:3:58,50 0|1:3:5:65,3 0/0:41:3", "20 1110696 rs6040355 A G,T 67 PASS NS=2;DP=10;AF=0.333,0.667;AA=T;DB GT:GQ:DP:HQ 1|2:21:6:23,27 2|1:2:0:18,2 2/2:35:4", "20 1230237 None T None 47 PASS NS=3;DP=13;AA=T GT:GQ:DP:HQ 0|0:54:7:56,60 0|0:48:4:51,51 0/0:61:2", "20 1234567 microsat1 GTCT G,GTACT 50 PASS NS=3;DP=9;AA=G GT:GQ:DP 0/1:35:4 0/2:17:2 1/1:40:3", ] candidate = list(map(str, vcf)) self.assertListEqual(reference, candidate)
def test_db_clf(self): with ReadVCF.open(URLS['case']) as case: result = db_classifier(case=case, ctrl=None) self.assertTrue(len(result.df))
def test_sanity2(self): from idiva.io.vcf import ReadVCF with ReadVCF.open(vcf_file) as vcf: with ReadVCF.open(vcf) as vcf: list(vcf)
def test_db_clf(self): with ReadVCF.open(URLS['case']) as case: result = phenomenet_classifier(case=case) self.assertTrue(len(result.df))
def test_phenom_basic(self): with ReadVCF.open(URLS['case']) as case: result = phenomenet_classifier_basic(case=case, ctrl=None) self.assertTrue(len(result.df)) log.info('passed!')
def test_phenom_clf(self): with ReadVCF.open(URLS['case']) as case, ReadVCF.open( URLS['ctrl']) as ctrl: result = phenomenet_classifier(case=case, ctrl=ctrl) self.assertTrue(len(result.df)) log.info('passed!')