Biologist new to cgi in python

Discussion in 'Python' started by Shane Neeley, Mar 7, 2012.

  1. Shane Neeley

    Shane Neeley Guest

    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
    Shane Neeley, Mar 7, 2012
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. LarsenMTL
    Replies:
    4
    Views:
    656
    Eric Walstad
    Nov 4, 2004
  2. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    512
    Michael Sparks
    Jul 30, 2005
  3. Amir  Michail

    cgi relay for python cgi script

    Amir Michail, Oct 4, 2005, in forum: Python
    Replies:
    7
    Views:
    383
    Michael Ekstrand
    Oct 4, 2005
  4. Gavri Savio Fernandez

    cgi = CGI.new causes the script to hang

    Gavri Savio Fernandez, Nov 30, 2003, in forum: Ruby
    Replies:
    2
    Views:
    216
    Ara.T.Howard
    Dec 1, 2003
  5. Ara.T.Howard
    Replies:
    2
    Views:
    117
    Ara.T.Howard
    Aug 15, 2005
Loading...

Share This Page