Example #1
0
 def test1_3(self):
     input_vcf = self.strelka_vcf
     class_name = type(self).__name__
     test_name = sys._getframe().f_code.co_name
     output_vcf = os.path.join(self.OUTPUT_FOLDER, "%s.%s.vcf" % (class_name, test_name))
     vcf_transformer = StrelkaVcfDedupper(input_vcf, output_vcf, VariantComparerNoAlternate(),
                                          SELECTION_METHOD_QUALITY, 1)
     vcf_transformer.process_vcf()
     del vcf_transformer
Example #2
0
 def test1_0_1(self):
     input_vcf = self.strelka_vcf
     class_name = type(self).__name__
     test_name = sys._getframe().f_code.co_name
     output_vcf = os.path.join(self.OUTPUT_FOLDER, "%s.%s.vcf" % (class_name, test_name))
     vcf_transformer = StrelkaVcfDedupper(input_vcf, output_vcf, VariantComparerNoAlternate(),
                                          SELECTION_METHOD_AF, 1, "none")
     try:
         vcf_transformer.process_vcf()
         self.assertTrue(False)
     except VcfFormatError:
         self.assertTrue(True)
     del vcf_transformer
Example #3
0
 def run(self):
     logging.info("Starting the VCF duplication removal...")
     if self.sort_vcf:
         # sorts the input VCF
         self.__sort()
     else:
         # assumes input is sorted
         self.sorted_vcf = self.input_vcf
     # selects the appropriate comparer
     if self.equality_mode == INCLUDE_ALTERNATE:
         comparer = VariantComparerWithAlternate()
     elif self.equality_mode == EXCLUDE_ALTERNATE:
         comparer = VariantComparerNoAlternate()
     # selects the appropriate transformer
     if self.variant_caller == STRELKA_VARIANT_CALLER:
         transformer = StrelkaVcfDedupper(self.sorted_vcf, self.output_vcf,
                                          comparer, self.selection_method,
                                          self.sample_idx, self.sample_name)
     elif self.variant_caller == STARLING_VARIANT_CALLER:
         transformer = StarlingVcfDedupper(self.sorted_vcf, self.output_vcf,
                                           comparer, self.selection_method,
                                           self.sample_idx,
                                           self.sample_name)
     elif self.variant_caller == PLATYPUS_VARIANT_CALLER:
         transformer = PlatypusVcfDedupper(self.sorted_vcf, self.output_vcf,
                                           comparer, self.selection_method)
     elif self.variant_caller == GENERIC_VARIANT_CALLER:
         transformer = GenericVcfDedupper(self.sorted_vcf, self.output_vcf,
                                          comparer, self.selection_method)
     elif self.variant_caller == DUPLICATION_FINDER:
         transformer = DuplicationFinder(self.sorted_vcf, self.output_vcf,
                                         comparer)
     # run the transformation
     transformer.process_vcf()
     # forces closing the resources
     transformer.__del__()
     # delete temporary files
     if self.sort_vcf:
         os.remove(self.sorted_vcf)
     logging.info("Duplication removal finished!")