Biologist new to cgi in python

S

Shane Neeley

Hi,

I would greatly appreciate some help for a beginner to python programming.

There is a server here that I am trying to write scripts to access:
http://consurf.tau.ac.il/index_full_form_PROT.php

I have been able to fill out the form simple in the url like this:

Submit_seq = "http://consurf.tau.ac.il/cgi-bin/new_consurf.cgi?Run_Number=NONE&MAX_FILE_SIZE=2000 000&PDB_yes_no=no&MSA_yes_no=no&FASTA_text=%s&MSAp rogram=MAFFT&proteins_DB=UNIREF90&MAX_NUM_HOMOL=15 0&MAX_REDUNDANCY=95&MIN_IDENTITY=35&ITERATIONS=1&E _VALUE=0.0001&Homolog_search_algorithm=BLAST&ALGOR ITHM=Bayes&SUB_MATRIX=JTT&submitForm=Submit" % (text,)

The %s after FASTA_text is connected to a variable of which I am looping through many files of text.

The major problem I am having now is uploading a file. On that server thereis an option to upload a multiple sequence alignment (MSA) when I do that and look at the HTTP headers I see this:

Content-Disposition: form-data; name="MSA_yes_no"

yes
-----------------------------178448449274243042114807987
Content-Disposition: form-data; name="msa_FILE"; filename="MSAfromnakai..ashx.clustalw"
Content-Type: application/octet-stream

And then below is the text of the file I uploaded. I tried pasting that text into the url for msa_FILE= but it said the URL length was too long for the server. That probably wouldnt work anyway because it needs the file uploaded. Do you have any ideas?

Here is the function I am using to insert the variable file text inside theurl. Is it even possible to include the upload command in the url?

def file_exporter():

path = "/Users/chimpsarehungry/Desktop/MSAtests"
MSAtests = os.listdir(path)

for MSA in MSAtests:
file = os.path.join(path, MSA)
MSAread = file

Submit_seq = "http://consurf.tau.ac.il/cgi-bin/new_consurf.cgi?Run_Number=NONE&MAX_FILE_SIZE=2000 0000000&PDB_yes_no=no&MSA_yes_no=yes&msa_FILE=%s&f ilename=MSAfromnakai1&msa_SEQNAME=AAV2&Homolog_sea rch_algorithm=BLAST&ALGORITHM=Bayes&SUB_MATRIX=JTT &submitForm=Submit" % (MSAread,)

Thank you much.

Shane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top