Beispiel #1
0
 def test_generated_vcf_feed_outputs_equal_vcfs(self):
     h5_vars = VariationsH5(
         join(TEST_DATA_DIR, 'tomato.apeki_gbs.calmd.1stchunk.h5'), "r")
     with NamedTemporaryFile(mode='wb') as vcf_vars_from_h5:
         write_vcf(h5_vars, vcf_vars_from_h5)
         vcf_vars_from_h5.flush()
         vcf_fhand = open(vcf_vars_from_h5.name, 'rb')
         vcf = VCFParser(vcf_fhand)
         vcf_vars_parsed = VariationsArrays()
         vcf_vars_parsed.put_vars(vcf)
         with NamedTemporaryFile(mode='wb') as vcf_vars_from_vcf:
             vcf_vars_parsed.write_vcf(vcf_vars_from_vcf)
             vcf_vars_from_vcf.flush()
             vcf_from_h5_fhand = open(vcf_vars_from_h5.name, 'rb')
             vcf_from_vcf_fhand = open(vcf_vars_from_vcf.name, 'rb')
             for line_parsed_from_h5, line_parsed_from_vcf in zip(
                     vcf_from_h5_fhand, vcf_from_vcf_fhand):
                 assert line_parsed_from_h5 == line_parsed_from_vcf, "when importing from a generated VCF and exporting to a new VCF both files must be the same"