GUI commands to call for a protein from protein data bank

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

GUI commands to call for a protein from protein data bank

Amitoj S. Chopra

What I am trying to do is use GUI function, traitr, and to call for a pdb file and save it and then display it. I want to call for it by taking it from the user and then displaying it on the screen. I am having problems with that. The line pdb <- read.pdb(""ProteinCode) where proteincode should be the name of the protein, for example 1ly2, but it always ends up being protein. My question is how to you make the input for read.pdb actually be the input by the user and not protein code. I want to be able to type 1ly2, and for the program to actually display the contents of 1ly2. Thanks!




Code:

dlg <- aDialog(items=list(
ProteinCode=stringItem("")
),
OK_handler=function(.) { # . is reference to dlg object
values <- .$to_R()
f <- function(ProteinCode)
pdb <- read.pdb("ProteinCode")
do.call(f, values)
}
)
dlg$make_gui()
Reply | Threaded
Open this post in threaded view
|

Re: GUI commands to call for a protein from protein data bank

jverzaniNWBKZ
Amitoj S. Chopra <amitojc <at> gmail.com> writes:

>
>
> What I am trying to do is use GUI function, traitr, and to call for a pdb
> file and save it and then display it. I want to call for it by taking it
> from the user and then displaying it on the screen. I am having problems
> with that. The line pdb <- read.pdb(""ProteinCode) where proteincode should
> be the name of the protein, for example 1ly2, but it always ends up being
> protein. My question is how to you make the input for read.pdb actually be
> the input by the user and not protein code. I want to be able to type 1ly2,
> and for the program to actually display the contents of 1ly2. Thanks!
>

I'm just guessing, but you might try this for your OK_handler:

OK_handler=function(.) {
  pdb <- read.pdb(.$get_ProteinCode())
}

(Or use yours, but drop the quotes around "ProteinCode".)

That doesn't modify pdb outside the scope of the handler, so likely you need to
do something else with it.

--John


> Code:
>
> dlg <- aDialog(items=list(
> ProteinCode=stringItem("")
> ),
> OK_handler=function(.) { # . is reference to dlg object
> values <- .$to_R()
> f <- function(ProteinCode)
> pdb <- read.pdb("ProteinCode")
> do.call(f, values)
> }
> )
> dlg$make_gui()

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: GUI commands to call for a protein from protein data bank

Amitoj S. Chopra
I tried doing that and this is what I go:


dlg <- aDialog(items=list(
ProtienCode=stringItem("")
),
OK_handler=function(.) { # . is reference to dlg object
values <- .$to_R()
f <- function(ProtienCode)
pdb <- read.pdb(.$get_ProteinCode())
#cat("ProteinCode is",ProtienCode,"\n")
do.call(f, values)
}
)
dlg$make_gui()


with this error message

Error in function (ProtienCode)  : could not find function "read.pdb"

Do you know how to get rid of this error?

On Tue, May 18, 2010 at 5:53 AM, jverzaniNWBKZ [via R] <[hidden email]> wrote:
Amitoj S. Chopra <amitojc <at> gmail.com> writes:

>
>
> What I am trying to do is use GUI function, traitr, and to call for a pdb
> file and save it and then display it. I want to call for it by taking it
> from the user and then displaying it on the screen. I am having problems
> with that. The line pdb <- read.pdb(""ProteinCode) where proteincode should
> be the name of the protein, for example 1ly2, but it always ends up being
> protein. My question is how to you make the input for read.pdb actually be
> the input by the user and not protein code. I want to be able to type 1ly2,
> and for the program to actually display the contents of 1ly2. Thanks!
>
I'm just guessing, but you might try this for your OK_handler:

OK_handler=function(.) {
  pdb <- read.pdb(.$get_ProteinCode())
}

(Or use yours, but drop the quotes around "ProteinCode".)

That doesn't modify pdb outside the scope of the handler, so likely you need to
do something else with it.

--John


> Code:
>
> dlg <- aDialog(items=list(
> ProteinCode=stringItem("")
> ),
> OK_handler=function(.) { # . is reference to dlg object
> values <- .$to_R()
> f <- function(ProteinCode)
> pdb <- read.pdb("ProteinCode")
> do.call(f, values)
> }
> )
> dlg$make_gui()
______________________________________________
[hidden email] 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.



View message @ http://r.789695.n4.nabble.com/GUI-commands-to-call-for-a-protein-from-protein-data-bank-tp2220754p2221226.html
To unsubscribe from GUI commands to call for a protein from protein data bank, click here.


Reply | Threaded
Open this post in threaded view
|

Re: GUI commands to call for a protein from protein data bank

Amitoj S. Chopra
In reply to this post by jverzaniNWBKZ
Thank you it worked perfectly. I just needed to close the window that was the problem. Do you know how to close the window automatically and why does that matter? Thanks!!!!!


Amitoj

On Tue, May 18, 2010 at 12:10 PM, Amitoj Chopra <[hidden email]> wrote:
I tried doing that and this is what I go:


dlg <- aDialog(items=list(
ProtienCode=stringItem("")

),
OK_handler=function(.) { # . is reference to dlg object
values <- .$to_R()
f <- function(ProtienCode)

pdb <- read.pdb(.$get_ProteinCode())
#cat("ProteinCode is",ProtienCode,"\n")

do.call(f, values)
}
)
dlg$make_gui()


with this error message

Error in function (ProtienCode)  : could not find function "read.pdb"

Do you know how to get rid of this error?


On Tue, May 18, 2010 at 5:53 AM, jverzaniNWBKZ [via R] <[hidden email]> wrote:
Amitoj S. Chopra <amitojc <at> gmail.com> writes:

>
>
> What I am trying to do is use GUI function, traitr, and to call for a pdb
> file and save it and then display it. I want to call for it by taking it
> from the user and then displaying it on the screen. I am having problems
> with that. The line pdb <- read.pdb(""ProteinCode) where proteincode should
> be the name of the protein, for example 1ly2, but it always ends up being
> protein. My question is how to you make the input for read.pdb actually be
> the input by the user and not protein code. I want to be able to type 1ly2,
> and for the program to actually display the contents of 1ly2. Thanks!
>
I'm just guessing, but you might try this for your OK_handler:

OK_handler=function(.) {
  pdb <- read.pdb(.$get_ProteinCode())
}

(Or use yours, but drop the quotes around "ProteinCode".)

That doesn't modify pdb outside the scope of the handler, so likely you need to
do something else with it.

--John


> Code:
>
> dlg <- aDialog(items=list(
> ProteinCode=stringItem("")
> ),
> OK_handler=function(.) { # . is reference to dlg object
> values <- .$to_R()
> f <- function(ProteinCode)
> pdb <- read.pdb("ProteinCode")
> do.call(f, values)
> }
> )
> dlg$make_gui()
______________________________________________
[hidden email] 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.



View message @ http://r.789695.n4.nabble.com/GUI-commands-to-call-for-a-protein-from-protein-data-bank-tp2220754p2221226.html
To unsubscribe from GUI commands to call for a protein from protein data bank, click here.



Reply | Threaded
Open this post in threaded view
|

Re: GUI commands to call for a protein from protein data bank

jverzaniNWBKZ
Amitoj S. Chopra <amitojc <at> gmail.com> writes:

>
>
> Thank you it worked perfectly. I just needed to close the window that was
> the problem. Do you know how to close the window automatically and why does
> that matter? Thanks!!!!!
>
> Amitoj

Not sure why this makes a difference, but if it does great. As to
programattically closing a dialog, the method close_gui is available, as in
dlg$close_gui(). (The proto methods for an object dlg are shown in a web page by
calling dlg$show_help().)

--John

..snipped..

______________________________________________
[hidden email] 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.