This is a test version of Biostars. For the public version, visit https://www.biostars.org.
de novo assembly with velvet

I have produced a code to run velvet. I have not problem to run velveth but it will not run velvetg as it cannot recognise the given parameters. I have checked the documentation, and I cannot see any mistake. I post the code below, and hopefully someone can help me with this.

import glob, sys, os, subprocess
def velvet_project():
    print 'starting_velvet' 
    folders = glob.glob('/home/myname/fastqs_test/H*')
    for folder in folders:
        print folder
        #looking for fastqs in each folder
        fastqs=glob.glob(folder + '/*.fastq.gz')
        #print fastqs
        #extract name of folder
        strain_id = os.path.basename(folder)
        output= '/home/myname/velvet_results/' + strain_id + '_velvet'
        if os.path.exists(output):
            print 'velevet folder already exist'
        else:
            os.makedirs(output)
        #cmd is a command line within the programme#
        cmd=['velveth', output, '59', '-fastq.gz', '-shortPaired',fastqs[0],fastqs[1]]
        #print cmd
        my_file=subprocess.Popen(cmd)#I got this from the documentation.
        my_file.wait()
        print 'velveth has finished'
        cmd_2=['velvetg', output, '-ins_length 500', '-exp_cov auto', '-scaffoding no']
        print cmd_2
        my_file_2=subprocess.Popen(cmd_2)
        my_file_2.wait()
        print "velvet has finished :)"

print 'start'
velvet_project()
assembly

Try using the command you would use on the CLI for velvet, inside subprocess with shell=True:

subprocess(*your_velvet comand*, shell=True)

Where variables in your python script are going to be used, use '+' and quotations to make it a single string.

0 answers

No answers yet.

Log in to answer this question.