Exemple #1
0
 def execute(self, executable):
     """The method execute checks which program has to be executed and executes this program
     :param executable: the argument of the commandline which determines which program has to be executed
     :type executable: str
     """
     if executable == "haplotyping":
         if Grid.useGrid == True:
             Haplotyper.executeBeagleCluster(self.pool)
         else:
             Haplotyper.executeBeagleMultiThread(self.pool)
     elif executable == "snvCalling":
         if Program.config.snvCaller == "samtools":  # @UndefinedVariable
             SamtoolsMpileup.executeSamtoolsMultiThreaded(self.pool)
         elif Program.config.snvCaller == "GATK":  # @UndefinedVariable
             Gatk.Gatk(self.pool).callSnvs()
     elif executable == "mapping":
         mapper = Mapper.Mapper()
         for sample in self.samples:
             mapper.map(sample)
     elif executable == "allelicDiversity":
         if Program.config.gffFile == None:  # @UndefinedVariable
             print("When calculating the allelic diversity, a gff file is needed, this option can be set with the option --gff <file>")
             exit()
         allelicDiverityCalculator = AllelicDiversity.AllelicDiversity(self.pool, Program.config.gffFile)  # @UndefinedVariable
         allelicDiverityCalculator.getAllelicDiversity()
     elif executable == "findLoci":
         if Program.config.phenoData == None:  # @UndefinedVariable
             print("When finding loci, a csv file is needed with the phenotype data, this option can be set with the option --phen <file>")
             exit()
         if Program.config.gffFile == None:  # @UndefinedVariable
             print("When finding loci, a file with phenotype data is needed, this option can be set with the option --gff <file>")
             exit()
         lociFinder = LociFinder.LociFinder()
         lociFinder.findLoci(self.pool)
Exemple #2
0
 def testSamtoolsMpileupMultiThread(self):
     expOutFile = "../testFiles/output/testPool/testPool_SL2.40ch11_22900-24100.vcf"
     SamtoolsMpileup.executeSamtoolsMultiThreaded(TestSnvCaller.testPool)
     outputFile = TestSnvCaller.testPool.vcf["SL2.40ch11_22900-24100"].fileName
     self.assertEqual(
         os.path.abspath(outputFile),
         os.path.abspath(expOutFile),
         os.path.abspath(outputFile) + " not is " + os.path.abspath(expOutFile),
     )
     # Check if the file contains exactly one snp
     self.checkNoOfSnps(expOutFile)
Exemple #3
0
 def testSamtoolsMpileupMultiThread(self):
     expOutFile = "../testFiles/output/testPool/testPool_SL2.40ch11_22900-24100.vcf"
     SamtoolsMpileup.executeSamtoolsMultiThreaded(TestSnvCaller.testPool)
     outputFile = TestSnvCaller.testPool.vcf[
         "SL2.40ch11_22900-24100"].fileName
     self.assertEqual(
         os.path.abspath(outputFile), os.path.abspath(expOutFile),
         os.path.abspath(outputFile) + " not is " +
         os.path.abspath(expOutFile))
     #Check if the file contains exactly one snp
     self.checkNoOfSnps(expOutFile)
Exemple #4
0
 def execute(self, executable):
     """The method execute checks which program has to be executed and executes this program
     :param executable: the argument of the commandline which determines which program has to be executed
     :type executable: str
     """
     if executable == "haplotyping":
         if Grid.useGrid == True:
             Haplotyper.executeBeagleCluster(self.pool)
         else:
             Haplotyper.executeBeagleMultiThread(self.pool)
     elif executable == "snvCalling":
         if Program.config.snvCaller == "samtools":  # @UndefinedVariable
             SamtoolsMpileup.executeSamtoolsMultiThreaded(self.pool)
         elif Program.config.snvCaller == "GATK":  # @UndefinedVariable
             Gatk.Gatk(self.pool).callSnvs()
     elif executable == "mapping":
         mapper = Mapper.Mapper()
         for sample in self.samples:
             mapper.map(sample)
     elif executable == "allelicDiversity":
         if Program.config.gffFile == None:  # @UndefinedVariable
             print(
                 "When calculating the allelic diversity, a gff file is needed, this option can be set with the option --gff <file>"
             )
             exit()
         allelicDiverityCalculator = AllelicDiversity.AllelicDiversity(
             self.pool, Program.config.gffFile)  # @UndefinedVariable
         allelicDiverityCalculator.getAllelicDiversity()
     elif executable == "findLoci":
         if Program.config.phenoData == None:  # @UndefinedVariable
             print(
                 "When finding loci, a csv file is needed with the phenotype data, this option can be set with the option --phen <file>"
             )
             exit()
         if Program.config.gffFile == None:  # @UndefinedVariable
             print(
                 "When finding loci, a file with phenotype data is needed, this option can be set with the option --gff <file>"
             )
             exit()
         lociFinder = LociFinder.LociFinder()
         lociFinder.findLoci(self.pool)