@@ -198,6 +198,26 @@ def test_validation_invalid_two_samples_normal(vcf_class):
198198 assert warning == ""
199199
200200
201+ def test_validation_invalid_format_has_nas (vcf_class ):
202+ vcfDf = pd .DataFrame (
203+ {
204+ "#CHROM" : ["2" , "9" , "12" ],
205+ "POS" : [69688533 , 99401860 , 53701241 ],
206+ "ID" : ["AAK1" , "AAED1" , "AAAS" ],
207+ "REF" : ["AANT" , "AACG" , "AAAN" ],
208+ "ALT" : ["AAK1" , "AAED1" , "AAAS" ],
209+ "QUAL" : ["AAK1" , "AAED1" , "AAAS" ],
210+ "FILTER" : ["AAK1" , "AAED1" , "AAAS" ],
211+ "INFO" : ["AAK1" , "AAED1" , "AAAS" ],
212+ "FORMAT" : [None , "AAED1" , "AAAS" ],
213+ "TUMOR" : ["AAK1" , "AAED1" , "AAAS" ],
214+ }
215+ )
216+ error , warning = vcf_class ._validate (vcfDf )
217+ assert error == "vcf: Must not have missing values in FORMAT column.\n "
218+ assert warning == ""
219+
220+
201221def test_validation_invalid_white_space (vcf_class ):
202222 vcfDf = pd .DataFrame (
203223 {
@@ -427,11 +447,11 @@ def test_that__get_dataframe_uses_correct_columns_to_replace(
427447 "FILTER" ,
428448 "INFO" ,
429449 "FORMAT" ,
430- "GENIE-SAGE-1-1-normal" ,
431450 "GENIE-SAGE-1-1-tumor" ,
451+ "GENIE-SAGE-1-1-normal" ,
432452 ],
433453 [[1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , "a" , None ]],
434- "vcf: Must not have missing values in GENIE-SAGE-1-1-tumor column.\n " ,
454+ "vcf: Must not have missing values in GENIE-SAGE-1-1-normal column.\n " ,
435455 ),
436456 # Case 7: 11 columns, wrong normal/tumor naming
437457 (
@@ -480,13 +500,14 @@ def test_that__get_dataframe_uses_correct_columns_to_replace(
480500 "invalid_tumor_sample_name" ,
481501 "tumor_sample_col_has_nas" ,
482502 "valid_matched_tumor_normal" ,
503+ "normal_sample_col_has_nas" ,
483504 "invalid_normal_sample_name" ,
484505 "more_than_11_cols" ,
485506 ],
486507)
487- def test_validate_tumor_and_normal_sample_columns_exist (
508+ def test_validate_tumor_and_normal_sample_columns (
488509 columns , data , expected_in_error , vcf_class
489510):
490511 df = pd .DataFrame (data , columns = columns )
491- result = vcf_class .validate_tumor_and_normal_sample_columns_exist (df )
512+ result = vcf_class .validate_tumor_and_normal_sample_columns (df )
492513 assert expected_in_error == result
0 commit comments