Example #1
0
 def manage_annotation(self):
     blastn_out = ''
     metacv_out = ''
     # run the annotation functions when the module is initialized
     if self.mode.lower() == 'blastn':
         # is executable existing and runnable?
         if is_executable(self.blastn_exe):
             # start annotation with blastn
             self.blastn(self.blast_dir)
             # set the output file for further steps
             blastn_out = update_reads(self.blast_dir,
                                      'blastn',
                                      blast_output(self.outfmt).split('.')[1])
             # raise step_number
             self.step_number += 1
             
     elif self.mode.lower() == 'metacv':
         # is executable existing and runnable?
         if is_executable(self.metacv_exe):
             # start annotation with metacv
             self.metacv(self.metacv_dir)
             # set the output file for further steps
             metacv_out = update_reads(self.metacv_dir,
                                       self.metacv_name,
                                       'res')
             # raise step_number
             self.step_number += 1
             
     else: 
         # is executable existing and runnable?
         if is_executable(self.blastn_exe) and is_executable(self.metacv_exe):
             # start annotation with both tools 
             self.blastn(self.blast_dir)
             # test for ending and set the right blast output
             blastn_out = update_reads(self.blast_dir,
                                      'blastn',
                                      blast_output(self.outfmt).split('.')[1])
             self.metacv(self.metacv_dir)
             metacv_out = update_reads(self.metacv_dir,
                                       self.metacv_name,
                                       'res')
             # raise step_number
             self.step_number += 1
     
     return [self.step_number, blastn_out, metacv_out]
Example #2
0
 def manage_preprocessing(self):
     # run the preprocessing functions when the module is initialized
     try:
         is_fastq(self.input)
     except FastQException:
         self.quality = False
         self.trim = False
         
     if self.quality:
         # is executable existing and runnable?
         if is_executable(self.fastqc_exe):
             self.qualityCheck()
             # raise the step number for cmd output
             self.step_number += 1
             #self.files.set_quality_report()
               
     if self.trim:
         if is_executable(self.trim_exe):
             self.trim_and_filter()
             # raise the step number for cmd output
             self.step_number += 1
             return [self.step_number, update_reads(self.trim_dir, 'val', 'fq')]
     else:
         return [self.step_number]
Example #3
0
    def manage_assembly(self):
        
        concatinated = ''
        assembled = ''
        # run the assembling functions when the module is initialized
        if self.mode.lower() == 'flash':
            # is executable existing and runnable?
            if is_executable(self.flash_exe):
                # start concatination and update the input for next step
                self.concatinate(self.concat_out)
                self.step_number += 1
                # merge the concatinated reads with non concatinated rest
                if (self.merge_uncombined):
                    self.input = merge_files([to_string(update_reads(self.concat_out, 'extendedFrags', 'fastq')),
                                             to_string(update_reads(self.concat_out, 'out.notCombined', 'fastq'))],
                                             self.concat_out,
                                             'merged_concat','fastq')
                else:
                    concatinated = update_reads(self.concat_out, 'extendedFrags', 'fastq')
                    self.input = concatinated
                

        if self.mode.lower() == 'metavelvet':
            # is executable existing and runnable?
            if is_executable(self.velveth_exe) and is_executable(self.velveth_exe) and is_executable(self.metavelvet_exe):
                # start assembly and update the input for next step
                self.assemble_reads(self.assembly_out)
                assembled = update_reads(self.assembly_out, 'meta-velvetg', 'fa')
                self.input = assembled
                self.step_number += 1
                
        if self.mode.lower() == 'both':
            #TODO: not working because of auto mode --> see logs
            
            # is executable existing and runnable?
            if is_executable(self.flash_exe) and is_executable(self.velveth_exe) and is_executable(self.velveth_exe) and is_executable(self.metavelvet_exe):
                # start processing and update the input for next step
                self.concatinate(self.concat_out)
                concatinated = update_reads(self.out, 'extendedFrags', 'fastq')
                self.input = concatinated
                self.assemble_reads(self.assembly_out)
                assembled = update_reads(self.assembly_out, 'meta-velvetg', 'fa')
                self.step_number += 1
                self.input = assembled
        return [self.step_number, self.input, concatinated, assembled]