Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21325

Biologist new to cgi in python

From Shane Neeley <shane.neeley@gmail.com>
Newsgroups comp.lang.python
Subject Biologist new to cgi in python
Date 2012-03-07 08:58 -0800
Organization http://groups.google.com
Message-ID <28641624.970.1331139509579.JavaMail.geo-discussion-forums@pbcgw3> (permalink)

Show all headers | View raw


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 there is 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 the url. 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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Biologist new to cgi in python Shane Neeley <shane.neeley@gmail.com> - 2012-03-07 08:58 -0800
  Re: Biologist new to cgi in python Tim Roberts <timr@probo.com> - 2012-03-07 22:11 -0800

csiph-web