I want to submit a protein sequence online for HMM comparison using HHpred tool and collect its job id so that I can collect the output later and process. But I have 1200 such sequences and I need to automate the process very badly. I tried to use mechanize package in Python but I couldn't understand properly as there is no documentation available.
import mechanize
ur = "http://toolkit.tuebingen.mpg.de/hhpred/"
request = mechanize.Request(ur)
response = mechanize.urlopen(request)
forms = mechanize.ParseResponse(response, backwards_compat=False)
print response.code
form = forms[0]
print form
original_text = form["jobid"]
form["jobid"] = '''MNDKSKNMMKNFIRTFAGLLLAILLILGFFLLVFPKAGDRFLADKKVSTLSAKNLTYAALGDSLTEGVGDATGQGGF VPLFAKDIENKTDSSVSSQNFGKAGDTSTQIYNRMMKSKKITDGLKKADIITITIGGNDVLKV
IRDNVSKLSSMTEKDFTKPEELYQARVKKLLDKIREDNPKAQIYVLGIYNPFYLNFPELTVMQNVIDSWNTATAGVVSQE KNTYFIPINDLLYKGSGDKQAVESGSTSDAVSNNLLYTEDHFHPNNVGYQLMADAVFASY
KEVNQK'''
control = form.find_control("jobid")
print control.name, control.value, control.type
control = form.find_control("showres")
print control.name, control.value, control.type
print control.disabled
request2 = form.click("showres")
response2 = mechanize.urlopen(request2)
forms2 = mechanize.ParseResponse(response2, backwards_compat=False)
form2 = forms2[0]
print form2
The website http://toolkit.tuebingen.mpg.de/hhpred/ has many input fields but i could see only the "jobid" and "showres" in the control list using 'mechanize' parser. Code above is what i tried to do but its totally incorrect. I actually want to paste the sequence in the text box and hit on submit and if possible give my own job-id at the bottom. And save the url of the resulting page after hitting submit. Kindly help me. (I'm using windows)