1

I am building a program in Python that needs to go through this webpage: http://circe.med.uniroma1.it/proABC/index.php

Instead of doing it manually, I wonder how do you send information to the website ? There are two DNA sequences from files, that can be used directly from the file or stored as two strings in Python.

And in the opposite way, how do you access the results through Python ? (I need the positions where there is a pic) Is urllib2 suitable for this ?

Here are two sequences as example :

light = 'DIQMTQSPASLSASVGETVTITCRASGNIHNYLAWYQQKQGKSPQLLVYYTTTLADGVPSRFSGSGSGTQYSLKINSLQPEDFGSYYCQHFWSTPRTFGGGTKLEIKRADAAPTVSIFPPSSEQLTSGGASVVCFLNNFYPKDINVKWKIDGSERQNGVLNSWTDQDSKDSTYSMSSTLTLTKDEYERHNSYTCEATHKTSTSPIVKSFNRNEC'

heavy = 'QVQLKESGPGLVAPSQSLSITCTVSGFSLTGYGVNWVRQPPGKGLEWLGMIWGDGNTDYNSALKSRLSISKDNSKSQVFLKMNSLHTDDTARYYCARERDYRLDYWGQGTTLTVSSASTTPPSVFPLAPGSAAQTNSMVTLGCLVKGYFPEPVTVTWNSGSLSSGVHTFPAVLQSDLYTLSSSVTVPSSPRPSETVTCNVAHPASSTKVDKKIVPRDC'

1 Answer 1

2

You can use robobrowser. Please see the github page: https://github.com/jmcarp/robobrowser

Example code:

from robobrowser import RoboBrowser
browser = RoboBrowser(history=True)
browser.open('http://circe.med.uniroma1.it/proABC/index.php')
form = browser.get_forms()[1]
# Now you can fill each elements in form as given below
form['light']='DIQMTQSPASLSASVGETVTITCRASGNIHNYLAWYQQKQGKSPQLLVYYTTTLADGVPSRFSGSGSGTQYSLKINSLQPEDFGSYYCQHFWSTPRTFGGGTKLEIKRADAAPTVSIFPPSSEQLTSGGASVVCFLNNFYPKDINVKWKIDGSERQNGVLNSWTDQDSKDSTYSMSSTLTLTKDEYERHNSYTCEATHKTSTSPIVKSFNRNEC'
form['heavy']='QVQLKESGPGLVAPSQSLSITCTVSGFSLTGYGVNWVRQPPGKGLEWLGMIWGDGNTDYNSALKSRLSISKDNSKSQVFLKMNSLHTDDTARYYCARERDYRLDYWGQGTTLTVSSASTTPPSVFPLAPGSAAQTNSMVTLGCLVKGYFPEPVTVTWNSGSLSSGVHTFPAVLQSDLYTLSSSVTVPSSPRPSETVTCNVAHPASSTKVDKKIVPRDC'

and so on.. You can simply use form['element-name'] to fill out the form.

Finally submit the form after filling all the mandatory fields:

 browser.submit_form(form)

Please read see the Github Readme for more info on how to access the result.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for this, but none of the code example they gave seems to work. Running them keep giving me TypeError: 'NoneType' object has no attribute '__getitem__' Do you have a example code that should work ?
Ok, but I'm sorry, the documentation is very short and the examples given are not working so I cannot figure out how to use this module... I tried your code, but I can't see any results. Don't you know where I could find more information about this module, not only in the readme ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.