de novo assembly with velvet
0
0
Entering edit mode
7.0 years ago
bio90029 ▴ 10

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 • 1.8k views
ADD COMMENT
1
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 2937 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6