Hi Duncan,

I finally got this to work, i.e. to extract my file two pages down. Thanks a
lot for your help. I think there is some problem with the HTML source code
of "http://www.expasy.ch/tools/protscale.html";. When I use the
getHtmlFormDescription function the output that I get is not what I would
have expected from just looking at the webpage. For e.g. there is no place
to input the sequence, only way to input is through prot_id. Also the
weight_var can essentially be linear or exponential but in this case I am
stuck with only the exponential option.

Thanks once again for your help

Regards

Sunando

On Sat, Feb 13, 2010 at 8:34 AM, Duncan Temple Lang <dun...@wald.ucdavis.edu
> wrote:

>
>
> Sunando Roy wrote:
> >
> > Hi Duncan,
> >
> > Thanks for your help. I changed the P but the output that I get is not
> > what I expect. The form gets aborted without any actual output. I get
> > the same result with
> >
> > postForm("http://www.expasy.ch/tools/protscale.html";)
>
>
> That URL  (...protscale.html) is the HTML page that contains the form.
> It is not the URL to which you are supposed to submit the form request.
> That information is in the attributes of the <form ..> </form>.
> That is
>
>   http://www.expasy.ch/cgi-bin/protscale.pl?1
>
> So you have to know a little about HTML forms in order to
> figure out how to map the HTML description to a request.
> That is what your browser does ( including hidden fields in
> the form, etc.)
> It is also the purpose of the R package RHTMLForms (
> www.omegahat.org/RHTMLForms
> and
>  install.packages("RHTMLForms", repos = "http://www.omegahat.org/R";, type
> = "source")
> )
>
> e.g.
>
>  library(RHTMLForms)
>  f = getHTMLFormDescription("http://www.expasy.ch/tools/protscale.html";)
>  fun = createFunction(f[[2]])
>
>
>  o = fun(prot_id = "P05130", weight_var = "exponential", style = "POST")
>
> (The protscale.html is malformed with an < that messes up parsing the
>  linear option.)
>
> Now, of course, you have to parse the resulting HTML (in the string given
> in the variable o)
> to get the information the form submission generated.
>
>
>  D.
>
>
> >
> > just with an added message that there was no input passed on. But with
> > the input like I presented I get the same output. I could make some of
> > the examples work like for e.g
> >
> > postForm("http://www.omegahat.org/RCurl/testPassword/form_validation.cgi
> ",
> >             your_name = "Duncan",
> >             your_age = "35-55",
> >             your_sex = "m",
> >             submit = "submit",
> >             .opts = list(userpwd = "bob:welcome"))
> >
> > which would suggest atleast the setup is correct.
> > I parsed the expasy protscale source code to identify the variables but
> > the form does not seem to go through. I can post the html body code if
> > needed.
> >
> > Regards
> >
> > Sunando
> > On Fri, Feb 12, 2010 at 3:54 PM, Duncan Temple Lang
> > <dun...@wald.ucdavis.edu <mailto:dun...@wald.ucdavis.edu>> wrote:
> >
> >
> >
> >     Sunando Roy wrote:
> >     > Hi,
> >     >
> >     > I am trying to submit a form to the EXPASY protscale server (
> >     > http://www.expasy.ch/tools/protscale.html). I am using the RCurl
> >     package and
> >     > the postForm function available in it. I have extracted the
> >     variables for
> >     > the form from the HTML source page. According to the syntax of
> >     postForm, I
> >     > just need to mention the url and assign values to the input
> >     mentioned in the
> >     > HTML code.
> >     > The code that I am using is:
> >     > postForm("http://www.expasy.ch/tools/protscale.html";,
> >     >     "sequence" = "
> >     > AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
> >     >     scale = "Molecular weight",
> >     >     window = "5",
> >     >     weight_edges = "100",
> >     >     weight_var = "linear",
> >     >     norm = "no",
> >     >     submit = "Submit"), .checkparams = TRUE)
> >
> >
> >     I don't think that is what you actually submitted to R.
> >     It is a syntax error as you end the cal to postForm) after "Submit"
> >     and then have an extra  ", .checkparams = TRUE)" afterwards.
> >
> >     But, when you remove the ')' after  "Submit",
> >     the problem you get is that .checkparams is not a parameter
> >     of postForm(), but .checkParams is.  R is case-sensitive
> >     so the problem is that .checkparams is being treated as a parameter
> >     of your form.
> >
> >     So change the p to P in .checkparams, and it works.
> >
> >      D.
> >
> >     > the constant error that I get is:
> >     > Error in postForm("http://www.expasy.ch/tools/protscale.html";,
> >     .params =
> >     > list(sequence = "not",  :  STRING_ELT() can only be applied to a
> >     'character
> >     > vector', not a 'logical'
> >     >
> >     > Is there any other way to submit an HTML form in R ?
> >     >
> >     > Thanks for the help
> >     >
> >     > Regards
> >     >
> >     > Sunando
> >     >
> >     >       [[alternative HTML version deleted]]
> >     >
> >     > ______________________________________________
> >     > R-help@r-project.org <mailto:R-help@r-project.org> mailing list
> >     > https://stat.ethz.ch/mailman/listinfo/r-help
> >     > PLEASE do read the posting guide
> >     http://www.R-project.org/posting-guide.html
> >     > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to