Esempio n. 1
0
    def run(self, input_file, run_locally=True) :
        print input_file
        bname = splitext( basename(input_file) )[0]
        output_dir = "%s/%s/output" % (globes.INT_DIR, self.name)
        print output_dir
        output_file = "%s/%s.csv" \
                        % (output_dir, bname)
        if not run_locally :
            commands = ['cd /projects/gleeson-lab/bin/snpEff_v1_9_5',
                        'java -Xmx20g -jar snpEff.jar -f hg37 %s' \
                           % input_file,
                        'mv %s/output/%s_out.txt %s' \
                           % (globes.BATCH_DIR,self.name,output_file) ]
            batchJob = batch.writeBatchFile('snpeff', commands )
            batchJob.submit()
        else :
            commands = ['cd %s/bin/snpEff_v2_0_2' % (globes.ROOT_DIR), \
                        'java -Xmx5g -jar snpEff.jar hg37 %s' \
                           % input_file] #,

            filename = "run_snpeff.sh"
            shellfile = open(filename, 'wb')
            shellfile.write( '\n'.join(commands) )
            shellfile.close()
            chmod( filename, 0775 )

            pop = Popen( ['sh',  filename], \
                          stdout = open( "%s/stdout.txt" % output_dir, 'wb' ), \
                          stderr = open( "%s/std.err" % output_dir, 'wb' ) )
            pop.wait()
            print 'snpeff Popen finished'
Esempio n. 2
0
    def run(self, i="", o="", args={'run_locally':True}) :
        if not i : i = self.input_file
        if not o : o = self.output_dir
        run_locally = args['run_locally']
        #-i : input
        #-o : output
        #-d : variation db directory
        #-c : coding info directory
        snp_exec = "./SIFT_exome_nssnvs.pl" #% (globes.SIFT_BIN)
        snp_exec_and_args = [ snp_exec, \
                     '-i', i, \
                     '-o', o, \
                     '-d', \
                     '%s/db/Human_db_37' % (globes.SIFT_HOME), \
                     '-A', '1', \
                     '-B', '1', \
                     '-C', '1', \
                     '-J', '1', \
                     '-K', '1', \
                     '-L', '1']

        indel_exec = ['perl', "%s/SIFT_exome_indels.pl" % (globes.SIFT_BIN)]
        indel_exec_and_args = \
            indel_exec + \
             ['-i', i, \
             '-o', o, \
             '-c', \
             '%s/coding_info/Homo_sapien_37' % (globes.SIFT_HOME), \
             '-d', \
             '%s/db/Human_db_37' % (globes.SIFT_HOME) ]

        #choose which version to run
        if self.switch == 'snp' :
            exec_and_args = snp_exec_and_args
        else :
            exec_and_args = indel_exec_and_args

        if run_locally :
            pop = subprocess.Popen(
                     exec_and_args, \
                     stdout = open( "%s/stdout" % globes.SIFT_OUTPUT, 'wb' ), \
                     stderr = open( "%s/stderr"% globes.SIFT_OUTPUT, 'wb' ) )

            pop.wait()
        else :
            params = {'out' : 'sift_out.txt' , \
                   'err' : 'sift_err.txt' }
            commands = ['cd %s' % globes.SIFT_BIN, ' '.join( exec_and_args )]
            batchJob = batch.writeBatchFile( "sift_%s.csh" % self.switch, commands )
            batchJob.submit()