Search
Question: Heatmap problem
0
gravatar for hemant ritturaj
9.9 years ago by
hemant ritturaj150 wrote:
Dear All, Thanks for kind help. But I am really not able to understand the way it used. Can any plz help in understanding the way it is used, as when i used the way it is given on manual page, it said figure is beyond the margins..... Also I want to reduce the size of the tree in the heatmap. I shall be very thankful for your kind help On Sat, Jan 31, 2009 at 12:27 AM, James W. MacDonald <jmacdon@med.umich.edu>wrote: > Hi Hemant, > > I think you want to read about the arguments 'lhei' and 'lmat', > specifically in the last paragraph of the details section of ?heatmap.2. You > will also likely want to look at ?layout, which is what these arguments > control. > > Best, > > Jim > > > > > hemant ritturaj wrote: > >> Dear All >> >> I was trying to make a heatmap using library(gplots) >> >> library("gplots") >> t <-(read.table("target_file",header=TRUE)) >> Y <-t$ID >> x<-as.matrix(t[2:7]) >> >> heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=TRUE,scale="row",key=TR UE,symkey=FALSE, >> density.info >> >> ="none",labRow=Y,labCol=c("control","control","control","stress","s tress","stress"),trace="none",cexRow=0.5) >> >> My problem is, it plots a heatmap which looks very odd, I want to control >> the size of box it make in heatmap. >> >> Using margin=c(12,12) in the function reduces the picture as a whole but >> not >> the size of boxes it makes. >> >> Can anyone help me making the pretty heatmap >> >> I shall be very thankful for your kind help >> >> Regards >> >> > -- > James W. MacDonald, M.S. > Biostatistician > Hildebrandt Lab > 8220D MSRB III > 1150 W. Medical Center Drive > Ann Arbor MI 48109-0646 > 734-936-8662 > -- Hemant Ritturaj Kushwaha PhD Student Center for Computational Biology and Bioinformatics Jawaharlal Nehru University New Delhi-110067 Phone: 09868801604 [[alternative HTML version deleted]]
ADD COMMENTlink modified 9.9 years ago • written 9.9 years ago by hemant ritturaj150
0
gravatar for hemant ritturaj
9.9 years ago by
hemant ritturaj150 wrote:
Dear all, Thanks for the kind suggestion I used the with my data in the following way heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=FALSE,scale="row",key=FALS E,symkey=FALSE, density.info="none",labRow=Y,labCol=c("control","stress"),trace="none" ,cexRow=0.5,margin=c(10,10),lhei=c(0.5,1), lwid=c(0.5,1),cexCol=1) But the problem is, i want to control cell width and I am not able to do with the mentioned command. And Also i want to increase the colour variation so that it can pick even very small changes in the values. Thanks in adance Regards On Tue, Feb 3, 2009 at 3:10 AM, James W. MacDonald <jmacdon@med.umich.edu>wrote: > Hi Hemant, > > Does this help? > > > library("gplots") > > z <- matrix(rnorm(600), ncol=6) > > > heatmap.2(z)heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=FALSE,scale= "row",key=FALSE,symkey=FALSE, > density.info="none",labRow=Y,labCol=c("control","stress"),trace="non e",cexRow=0.5,margin=c(10,10),lhei=c(0.5,1), > lwid=c(0.5,1),cexCol=1) > > heatmap.2(z, lhei=c(0.5,1), lwid=c(0.5,1), key=FALSE) > > heatmap.2(z, lhei=c(0.5,3), lwid=c(0.5,3), key=FALSE) > > heatmap.2(z, lhei=c(0.5,4), lwid=c(0.5,3), key=FALSE) > > And yes, you can get the error that figure margins are too large if you use > extreme values for lhei and lwid. > > > Best, > > Jim > > hemant ritturaj wrote: > >> Dear All, >> >> Thanks for kind help. >> >> But I am really not able to understand the way it used. Can any plz help >> in >> understanding the way it is used, as when i used the way it is given on >> manual page, it said figure is beyond the margins..... >> >> Also I want to reduce the size of the tree in the heatmap. >> >> I shall be very thankful for your kind help >> >> On Sat, Jan 31, 2009 at 12:27 AM, James W. MacDonald >> <jmacdon@med.umich.edu>wrote: >> >> Hi Hemant, >>> >>> I think you want to read about the arguments 'lhei' and 'lmat', >>> specifically in the last paragraph of the details section of ?heatmap.2. >>> You >>> will also likely want to look at ?layout, which is what these arguments >>> control. >>> >>> Best, >>> >>> Jim >>> >>> >>> >>> >>> hemant ritturaj wrote: >>> >>> Dear All >>>> >>>> I was trying to make a heatmap using library(gplots) >>>> >>>> library("gplots") >>>> t <-(read.table("target_file",header=TRUE)) >>>> Y <-t$ID >>>> x<-as.matrix(t[2:7]) >>>> >>>> >>>> heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=TRUE,scale="row",key= TRUE,symkey=FALSE, >>>> density.info >>>> >>>> >>>> ="none",labRow=Y,labCol=c("control","control","control","stress", "stress","stress"),trace="none",cexRow=0.5) >>>> >>>> My problem is, it plots a heatmap which looks very odd, I want to >>>> control >>>> the size of box it make in heatmap. >>>> >>>> Using margin=c(12,12) in the function reduces the picture as a whole but >>>> not >>>> the size of boxes it makes. >>>> >>>> Can anyone help me making the pretty heatmap >>>> >>>> I shall be very thankful for your kind help >>>> >>>> Regards >>>> >>>> >>>> -- >>> James W. MacDonald, M.S. >>> Biostatistician >>> Hildebrandt Lab >>> 8220D MSRB III >>> 1150 W. Medical Center Drive >>> Ann Arbor MI 48109-0646 >>> 734-936-8662 >>> >>> >> >> >> > -- > James W. MacDonald, M.S. > Biostatistician > Hildebrandt Lab > 8220D MSRB III > 1150 W. Medical Center Drive > Ann Arbor MI 48109-5646 > 734-936-8662 > -- Hemant Ritturaj Kushwaha PhD Student Center for Computational Biology and Bioinformatics Jawaharlal Nehru University New Delhi-110067 Phone: 09868801604 [[alternative HTML version deleted]]
ADD COMMENTlink written 9.9 years ago by hemant ritturaj150
On Wed, Feb 4, 2009 at 3:57 AM, hemant ritturaj <ritturajhemant@gmail.com>wrote: > Dear all, > > Thanks for the kind suggestion > I used the with my data in the following way > > > heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=FALSE,scale="row",key=FA LSE,symkey=FALSE, > density.info > ="none",labRow=Y,labCol=c("control","stress"),trace="none",cexRow=0. 5,margin=c(10,10),lhei=c(0.5,1), > lwid=c(0.5,1),cexCol=1) > > But the problem is, i want to control cell width and I am not able to do > with the mentioned command. > > And Also i want to increase the colour variation so that it can pick even > very small changes in the values. > Regards You'll want to look at the breaks argument. There are also a number of posts in the archives about this issue. Sean > > > On Tue, Feb 3, 2009 at 3:10 AM, James W. MacDonald <jmacdon@med.umich.edu> >wrote: > > > Hi Hemant, > > > > Does this help? > > > > > library("gplots") > > > z <- matrix(rnorm(600), ncol=6) > > > > > > heatmap.2(z)heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=FALSE,scale= "row",key=FALSE,symkey=FALSE, > > density.info > ="none",labRow=Y,labCol=c("control","stress"),trace="none",cexRow=0. 5,margin=c(10,10),lhei=c(0.5,1), > > lwid=c(0.5,1),cexCol=1) > > > heatmap.2(z, lhei=c(0.5,1), lwid=c(0.5,1), key=FALSE) > > > heatmap.2(z, lhei=c(0.5,3), lwid=c(0.5,3), key=FALSE) > > > heatmap.2(z, lhei=c(0.5,4), lwid=c(0.5,3), key=FALSE) > > > > And yes, you can get the error that figure margins are too large if you > use > > extreme values for lhei and lwid. > > > > > > Best, > > > > Jim > > > > hemant ritturaj wrote: > > > >> Dear All, > >> > >> Thanks for kind help. > >> > >> But I am really not able to understand the way it used. Can any plz help > >> in > >> understanding the way it is used, as when i used the way it is given on > >> manual page, it said figure is beyond the margins..... > >> > >> Also I want to reduce the size of the tree in the heatmap. > >> > >> I shall be very thankful for your kind help > >> > >> On Sat, Jan 31, 2009 at 12:27 AM, James W. MacDonald > >> <jmacdon@med.umich.edu>wrote: > >> > >> Hi Hemant, > >>> > >>> I think you want to read about the arguments 'lhei' and 'lmat', > >>> specifically in the last paragraph of the details section of > ?heatmap.2. > >>> You > >>> will also likely want to look at ?layout, which is what these arguments > >>> control. > >>> > >>> Best, > >>> > >>> Jim > >>> > >>> > >>> > >>> > >>> hemant ritturaj wrote: > >>> > >>> Dear All > >>>> > >>>> I was trying to make a heatmap using library(gplots) > >>>> > >>>> library("gplots") > >>>> t <-(read.table("target_file",header=TRUE)) > >>>> Y <-t$ID > >>>> x<-as.matrix(t[2:7]) > >>>> > >>>> > >>>> > heatmap.2(x,col=redgreen(75),Rowv=TRUE,Colv=TRUE,scale="row",key=TRU E,symkey=FALSE, > >>>> density.info > >>>> > >>>> > >>>> > ="none",labRow=Y,labCol=c("control","control","control","stress","st ress","stress"),trace="none",cexRow=0.5) > >>>> > >>>> My problem is, it plots a heatmap which looks very odd, I want to > >>>> control > >>>> the size of box it make in heatmap. > >>>> > >>>> Using margin=c(12,12) in the function reduces the picture as a whole > but > >>>> not > >>>> the size of boxes it makes. > >>>> > >>>> Can anyone help me making the pretty heatmap > >>>> > >>>> I shall be very thankful for your kind help > >>>> > >>>> Regards > >>>> > >>>> > >>>> -- > >>> James W. MacDonald, M.S. > >>> Biostatistician > >>> Hildebrandt Lab > >>> 8220D MSRB III > >>> 1150 W. Medical Center Drive > >>> Ann Arbor MI 48109-0646 > >>> 734-936-8662 > >>> > >>> > >> > >> > >> > > -- > > James W. MacDonald, M.S. > > Biostatistician > > Hildebrandt Lab > > 8220D MSRB III > > 1150 W. Medical Center Drive > > Ann Arbor MI 48109-5646 > > 734-936-8662 > > > > > > -- > Hemant Ritturaj Kushwaha > PhD Student > Center for Computational Biology and Bioinformatics > Jawaharlal Nehru University > New Delhi-110067 > Phone: 09868801604 > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD REPLYlink written 9.9 years ago by Sean Davis21k
Hello Bioconductor people I am trying to use htmlpage (from the annotate package) so it can generate html links in addition to the types of links already provided. >From the documentation of htmlpage it says: "Additional repositories can easily be added. See getQueryLink for more information." But it does not seem as straightforward as I hoped. Trying to modify the scripts hits difficulties with namespaces and local names. Can anyone tell me if there is a simpler way? I defined my own copy of getQueryLink but htmlpage still called the namespace version. This I could change using: assignInNamespace("getQueryLink", getQueryLink, ns="annotate") But then it did not work because getQueryLink could not see the original internal scripts such as getQuery4Affy. So I modified the script again to remove all the repositories I did not need. But I still needed the getQuery4Affy helper script so I had to redefine that and use assignInNamespace again. This seems too complicated. Have I missed an easier way? Any suggestions? Regards John ###################################################################### ## ################################ > sessionInfo() R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 attached base packages: [1] tools stats graphics grDevices datasets utils methods [8] base other attached packages: [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 [4] Biobase_2.2.1 RWinEdt_1.8-0 loaded via a namespace (and not attached): [1] DBI_0.2-4 RSQLite_0.7-1 > ---
ADD REPLYlink written 9.9 years ago by john seers IFR810
Hi John, john seers (IFR) wrote: > Hello Bioconductor people > > I am trying to use htmlpage (from the annotate package) so it can > generate html links in addition to the types of links already provided. > >>From the documentation of htmlpage it says: > > "Additional repositories can easily be added. See getQueryLink for more > information." Easily is in the eye of the beholder. It is actually quite easy, but you will need to add the functions to the source package and then build/install. As you have noted, the namespace prevents you from easily modifying the package by dumping new functions in the workspace. What repository are you trying to add? It might be easiest to just add the repository to the package itself, if it is something that others might want to use. Best, Jim > > But it does not seem as straightforward as I hoped. Trying to modify the > scripts hits difficulties with namespaces and local names. Can anyone > tell me if there is a simpler way? > > I defined my own copy of getQueryLink but htmlpage still called the > namespace version. This I could change using: > > assignInNamespace("getQueryLink", getQueryLink, ns="annotate") > > But then it did not work because getQueryLink could not see the original > internal scripts such as getQuery4Affy. So I modified the script again > to remove all the repositories I did not need. But I still needed the > getQuery4Affy helper script so I had to redefine that and use > assignInNamespace again. > > This seems too complicated. Have I missed an easier way? Any > suggestions? > > > > > Regards > > > John > > > > #################################################################### #### > ################################ > > >> sessionInfo() > R version 2.8.1 (2008-12-22) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United > Kingdom.1252;LC_MONETARY=English_United > Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 > > attached base packages: > [1] tools stats graphics grDevices datasets utils methods > > [8] base > > other attached packages: > [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 > [4] Biobase_2.2.1 RWinEdt_1.8-0 > > loaded via a namespace (and not attached): > [1] DBI_0.2-4 RSQLite_0.7-1 > > > > > --- > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.9 years ago by James W. MacDonald48k
Hi Jim Thanks for the reply. >Easily is in the eye of the beholder. Easily is in the eye of the user. It could be easier. >you will need to add the functions to the source package and then >build/install. I thought that might be the answer. I do not really want to do that because I do not build R from source. It would also create a maintenance problem. >What repository are you trying to add? I was building links to www.ensembl.org. ###################################################################### ## ################### I notice that you are one of the authors Jim, so can I add a further question/suggested enhancement. One of the links that I am building for www.ensembl.org needs more than the id to build the query. So I need the helper function to use the id plus further information from one of the other columns. Is there a recognised way to do this? That is pass the columns/lists through to getCells/getQueryLink/helper function so it can build the link from multiple values? Regards John --- -----Original Message----- From: James W. MacDonald [mailto:jmacdon@med.umich.edu] Sent: 04 February 2009 15:47 To: john seers (IFR) Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Using htmlpage Hi John, john seers (IFR) wrote: > Hello Bioconductor people > > I am trying to use htmlpage (from the annotate package) so it can > generate html links in addition to the types of links already provided. > >>From the documentation of htmlpage it says: > > "Additional repositories can easily be added. See getQueryLink for more > information." Easily is in the eye of the beholder. It is actually quite easy, but you will need to add the functions to the source package and then build/install. As you have noted, the namespace prevents you from easily modifying the package by dumping new functions in the workspace. What repository are you trying to add? It might be easiest to just add the repository to the package itself, if it is something that others might want to use. Best, Jim > > But it does not seem as straightforward as I hoped. Trying to modify the > scripts hits difficulties with namespaces and local names. Can anyone > tell me if there is a simpler way? > > I defined my own copy of getQueryLink but htmlpage still called the > namespace version. This I could change using: > > assignInNamespace("getQueryLink", getQueryLink, ns="annotate") > > But then it did not work because getQueryLink could not see the original > internal scripts such as getQuery4Affy. So I modified the script again > to remove all the repositories I did not need. But I still needed the > getQuery4Affy helper script so I had to redefine that and use > assignInNamespace again. > > This seems too complicated. Have I missed an easier way? Any > suggestions? > > > > > Regards > > > John > > > > ###################################################################### ## > ################################ > > >> sessionInfo() > R version 2.8.1 (2008-12-22) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United > Kingdom.1252;LC_MONETARY=English_United > Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 > > attached base packages: > [1] tools stats graphics grDevices datasets utils methods > > [8] base > > other attached packages: > [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 > [4] Biobase_2.2.1 RWinEdt_1.8-0 > > loaded via a namespace (and not attached): > [1] DBI_0.2-4 RSQLite_0.7-1 > > > > > --- > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.9 years ago by john seers IFR810
Hi John, john seers (IFR) wrote: > Hi Jim > > Thanks for the reply. > >> Easily is in the eye of the beholder. > > Easily is in the eye of the user. It could be easier. True. However, nothing comes free. The cost of having a namespace is that it is not simple to add functionality. The benefit is the minimization of function masking by other packages and/or things in the workspace. The other side of the coin is the poor soul in a world without namespaces who wonders why htmlpage() doesn't work, unaware that the object getCells in his workspace is clobbering the getCells() function that he knows nothing about. > >> you will need to add the functions to the source package and then >> build/install. > > I thought that might be the answer. I do not really want to do that > because I do not build R from source. It would also create a maintenance > problem. > >> What repository are you trying to add? > > I was building links to www.ensembl.org. > > #################################################################### #### > ################### > > I notice that you are one of the authors Jim, so can I add a further > question/suggested enhancement. > > One of the links that I am building for www.ensembl.org needs more than > the id to build the query. So I need the helper function to use the id > plus further information from one of the other columns. Is there a > recognised way to do this? That is pass the columns/lists through to > getCells/getQueryLink/helper function so it can build the link from > multiple values? I could probably add the functionality for you, but you will have to be less mysterious about what you want. I can divine that you want something like getQuery4ENS(ids, species) so that getQuery4ENS("ENSG00000064961", "Homo_sapiens") will build http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapien s;idx=;q=ENSG00000064961 But then again, I could be completely wrong. Best, Jim > > Regards > > > John > > > > > > > --- > -----Original Message----- > From: James W. MacDonald [mailto:jmacdon at med.umich.edu] > Sent: 04 February 2009 15:47 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > john seers (IFR) wrote: >> Hello Bioconductor people >> >> I am trying to use htmlpage (from the annotate package) so it can >> generate html links in addition to the types of links already > provided. >> >From the documentation of htmlpage it says: >> >> "Additional repositories can easily be added. See getQueryLink for > more >> information." > > Easily is in the eye of the beholder. It is actually quite easy, but you > > will need to add the functions to the source package and then > build/install. As you have noted, the namespace prevents you from easily > > modifying the package by dumping new functions in the workspace. > > What repository are you trying to add? It might be easiest to just add > the repository to the package itself, if it is something that others > might want to use. > > Best, > > Jim > > >> But it does not seem as straightforward as I hoped. Trying to modify > the >> scripts hits difficulties with namespaces and local names. Can anyone >> tell me if there is a simpler way? >> >> I defined my own copy of getQueryLink but htmlpage still called the >> namespace version. This I could change using: >> >> assignInNamespace("getQueryLink", getQueryLink, ns="annotate") >> >> But then it did not work because getQueryLink could not see the > original >> internal scripts such as getQuery4Affy. So I modified the script again >> to remove all the repositories I did not need. But I still needed the >> getQuery4Affy helper script so I had to redefine that and use >> assignInNamespace again. >> >> This seems too complicated. Have I missed an easier way? Any >> suggestions? >> >> >> >> >> Regards >> >> >> John >> >> >> >> > #################################################################### #### >> ################################ >> >> >>> sessionInfo() >> R version 2.8.1 (2008-12-22) >> i386-pc-mingw32 >> >> locale: >> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United >> Kingdom.1252;LC_MONETARY=English_United >> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 >> >> attached base packages: >> [1] tools stats graphics grDevices datasets utils > methods >> [8] base >> >> other attached packages: >> [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 >> [4] Biobase_2.2.1 RWinEdt_1.8-0 >> >> loaded via a namespace (and not attached): >> [1] DBI_0.2-4 RSQLite_0.7-1 >> >> >> >> >> --- >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.9 years ago by James W. MacDonald48k
Hi Jim >True. However, nothing comes free. The cost of having a namespace is >that it is not simple to add functionality. The benefit is the >minimization of function masking by other packages and/or things in the >workspace. Is there no way to call a user function from a namespaced package? >But then again, I could be completely wrong. No, you have it spot on. >I can divine that you want something like >getQuery4ENS(ids, species) I wondered if using the "..." notation would be a good idea. I am not sure how it works exactly but: getQuery4ENS(ids, ...) would mean you could pass through whatever you wanted, I think. If you think adding the functionality is a good idea then great and thank you. You will be the better judge of whether it fits with your design and is a sensible thing to do. I will definitely use it if it comes available. Regards John -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James W. MacDonald Sent: 04 February 2009 20:17 To: john seers (IFR) Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Using htmlpage Hi John, john seers (IFR) wrote: > Hi Jim > > Thanks for the reply. > >> Easily is in the eye of the beholder. > > Easily is in the eye of the user. It could be easier. True. However, nothing comes free. The cost of having a namespace is that it is not simple to add functionality. The benefit is the minimization of function masking by other packages and/or things in the workspace. The other side of the coin is the poor soul in a world without namespaces who wonders why htmlpage() doesn't work, unaware that the object getCells in his workspace is clobbering the getCells() function that he knows nothing about. > >> you will need to add the functions to the source package and then >> build/install. > > I thought that might be the answer. I do not really want to do that > because I do not build R from source. It would also create a maintenance > problem. > >> What repository are you trying to add? > > I was building links to www.ensembl.org. > > ###################################################################### ## > ################### > > I notice that you are one of the authors Jim, so can I add a further > question/suggested enhancement. > > One of the links that I am building for www.ensembl.org needs more than > the id to build the query. So I need the helper function to use the id > plus further information from one of the other columns. Is there a > recognised way to do this? That is pass the columns/lists through to > getCells/getQueryLink/helper function so it can build the link from > multiple values? I could probably add the functionality for you, but you will have to be less mysterious about what you want. I can divine that you want something like getQuery4ENS(ids, species) so that getQuery4ENS("ENSG00000064961", "Homo_sapiens") will build http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapien s; idx=;q=ENSG00000064961 But then again, I could be completely wrong. Best, Jim > > Regards > > > John > > > > > > > --- > -----Original Message----- > From: James W. MacDonald [mailto:jmacdon at med.umich.edu] > Sent: 04 February 2009 15:47 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > john seers (IFR) wrote: >> Hello Bioconductor people >> >> I am trying to use htmlpage (from the annotate package) so it can >> generate html links in addition to the types of links already > provided. >> >From the documentation of htmlpage it says: >> >> "Additional repositories can easily be added. See getQueryLink for > more >> information." > > Easily is in the eye of the beholder. It is actually quite easy, but you > > will need to add the functions to the source package and then > build/install. As you have noted, the namespace prevents you from easily > > modifying the package by dumping new functions in the workspace. > > What repository are you trying to add? It might be easiest to just add > the repository to the package itself, if it is something that others > might want to use. > > Best, > > Jim > > >> But it does not seem as straightforward as I hoped. Trying to modify > the >> scripts hits difficulties with namespaces and local names. Can anyone >> tell me if there is a simpler way? >> >> I defined my own copy of getQueryLink but htmlpage still called the >> namespace version. This I could change using: >> >> assignInNamespace("getQueryLink", getQueryLink, ns="annotate") >> >> But then it did not work because getQueryLink could not see the > original >> internal scripts such as getQuery4Affy. So I modified the script again >> to remove all the repositories I did not need. But I still needed the >> getQuery4Affy helper script so I had to redefine that and use >> assignInNamespace again. >> >> This seems too complicated. Have I missed an easier way? Any >> suggestions? >> >> >> >> >> Regards >> >> >> John >> >> >> >> > ###################################################################### ## >> ################################ >> >> >>> sessionInfo() >> R version 2.8.1 (2008-12-22) >> i386-pc-mingw32 >> >> locale: >> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United >> Kingdom.1252;LC_MONETARY=English_United >> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 >> >> attached base packages: >> [1] tools stats graphics grDevices datasets utils > methods >> [8] base >> >> other attached packages: >> [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 >> [4] Biobase_2.2.1 RWinEdt_1.8-0 >> >> loaded via a namespace (and not attached): >> [1] DBI_0.2-4 RSQLite_0.7-1 >> >> >> >> >> --- >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662 _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLYlink written 9.9 years ago by john seers IFR810
Hi John, john seers (IFR) wrote: > Hi Jim > >> True. However, nothing comes free. The cost of having a namespace is >> that it is not simple to add functionality. The benefit is the >> minimization of function masking by other packages and/or things in the > >> workspace. > > Is there no way to call a user function from a namespaced package? As others have mentioned, you can get unexported things from a namespace using the ':::' function. But I believe you really want the converse - to stuff your function into the namespace and have the package think it belongs there. While there may be programmatic ways around it, by far the easiest way is to add a function to a source package and then build/install. You don't need to build R from source to build and install packages. All you need to do is to get set up to be able to build R, and then you will be able to install packages. In the past this was a semi-difficult thing to do, but these days Duncan Murdoch has an installer that makes it practically painless. http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-install- packages-into-libraries-in-this-version_003f Alternatively, you can modify the sources and use the win-builder to make an installable Windows package. http://win-builder.r-project.org/ But personally, I would recommend getting set up to build packages yourself. It's not that hard, and you gain two really nice things. First, you will be able to install packages for which there is only a source version. I can't tell you how often I have needed this capability. Second, you get all these nice Unix tools that turn out to be exceptionally useful (who knew?). Things like sed, cut, awk, etc can be daunting to use at first, but they are so very useful for doing what they do that I can no longer imagine a life where I would have to muddle along using the exceptionally dull tools that are typically available on Windows. > >> But then again, I could be completely wrong. > > No, you have it spot on. > > >> I can divine that you want something like >> getQuery4ENS(ids, species) > > I wondered if using the "..." notation would be a good idea. > > I am not sure how it works exactly but: > > getQuery4ENS(ids, ...) > > would mean you could pass through whatever you wanted, I think. Yes you could. However, the ellipsis is designed to pass arbitrary variables to underlying code. You would then have to write code to parse whatever random things an end user might pass via that method and then try to divine what they meant to do. And I am just not that imaginative. Since the only additional argument we need is the species, it is much more directed and simpler to add a species argument, and possibly do some error checking to ensure that what is passed will be sensible to the Ensembl web server (e.g., did they give you Homo_sapiens rather than H_sapiens or Homo sapiens or H. sapiens). Here you could either be friendly and try to munge what was passed into the correct format, or just error out with a message stating what the format needs to be. And I am not that friendly ;-D. > > > If you think adding the functionality is a good idea then great and > thank you. You will be the better judge of whether it fits with your > design and is a sensible thing to do. I will definitely use it if it > comes available. I have been meaning to add Ensembl, so this gives me that much more impetus. It won't be for a couple of days though. Best, Jim > > > > > Regards > > > John > > > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James W. > MacDonald > Sent: 04 February 2009 20:17 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > john seers (IFR) wrote: >> Hi Jim >> >> Thanks for the reply. >> >>> Easily is in the eye of the beholder. >> Easily is in the eye of the user. It could be easier. > > True. However, nothing comes free. The cost of having a namespace is > that it is not simple to add functionality. The benefit is the > minimization of function masking by other packages and/or things in the > workspace. > > The other side of the coin is the poor soul in a world without > namespaces who wonders why htmlpage() doesn't work, unaware that the > object getCells in his workspace is clobbering the getCells() function > that he knows nothing about. > >>> you will need to add the functions to the source package and then >>> build/install. >> I thought that might be the answer. I do not really want to do that >> because I do not build R from source. It would also create a > maintenance >> problem. >> >>> What repository are you trying to add? >> I was building links to www.ensembl.org. >> >> > #################################################################### #### >> ################### >> >> I notice that you are one of the authors Jim, so can I add a further >> question/suggested enhancement. >> >> One of the links that I am building for www.ensembl.org needs more > than >> the id to build the query. So I need the helper function to use the id >> plus further information from one of the other columns. Is there a >> recognised way to do this? That is pass the columns/lists through to >> getCells/getQueryLink/helper function so it can build the link from >> multiple values? > > I could probably add the functionality for you, but you will have to be > less mysterious about what you want. > > I can divine that you want something like > > getQuery4ENS(ids, species) > > so that > > getQuery4ENS("ENSG00000064961", "Homo_sapiens") > > will build > > http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapi ens; > idx=;q=ENSG00000064961 > > But then again, I could be completely wrong. > > Best, > > Jim > >> Regards >> >> >> John >> >> >> >> >> >> >> --- >> -----Original Message----- >> From: James W. MacDonald [mailto:jmacdon at med.umich.edu] >> Sent: 04 February 2009 15:47 >> To: john seers (IFR) >> Cc: bioconductor at stat.math.ethz.ch >> Subject: Re: [BioC] Using htmlpage >> >> Hi John, >> >> john seers (IFR) wrote: >>> Hello Bioconductor people >>> >>> I am trying to use htmlpage (from the annotate package) so it can >>> generate html links in addition to the types of links already >> provided. >>> >From the documentation of htmlpage it says: >>> >>> "Additional repositories can easily be added. See getQueryLink for >> more >>> information." >> Easily is in the eye of the beholder. It is actually quite easy, but > you >> will need to add the functions to the source package and then >> build/install. As you have noted, the namespace prevents you from > easily >> modifying the package by dumping new functions in the workspace. >> >> What repository are you trying to add? It might be easiest to just add > >> the repository to the package itself, if it is something that others >> might want to use. >> >> Best, >> >> Jim >> >> >>> But it does not seem as straightforward as I hoped. Trying to modify >> the >>> scripts hits difficulties with namespaces and local names. Can anyone >>> tell me if there is a simpler way? >>> >>> I defined my own copy of getQueryLink but htmlpage still called the >>> namespace version. This I could change using: >>> >>> assignInNamespace("getQueryLink", getQueryLink, ns="annotate") >>> >>> But then it did not work because getQueryLink could not see the >> original >>> internal scripts such as getQuery4Affy. So I modified the script > again >>> to remove all the repositories I did not need. But I still needed the >>> getQuery4Affy helper script so I had to redefine that and use >>> assignInNamespace again. >>> >>> This seems too complicated. Have I missed an easier way? Any >>> suggestions? >>> >>> >>> >>> >>> Regards >>> >>> >>> John >>> >>> >>> >>> > #################################################################### #### >>> ################################ >>> >>> >>>> sessionInfo() >>> R version 2.8.1 (2008-12-22) >>> i386-pc-mingw32 >>> >>> locale: >>> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United >>> Kingdom.1252;LC_MONETARY=English_United >>> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 >>> >>> attached base packages: >>> [1] tools stats graphics grDevices datasets utils >> methods >>> [8] base >>> >>> other attached packages: >>> [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 >>> [4] Biobase_2.2.1 RWinEdt_1.8-0 >>> >>> loaded via a namespace (and not attached): >>> [1] DBI_0.2-4 RSQLite_0.7-1 >>> >>> >>> >>> >>> --- >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor at stat.math.ethz.ch >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.9 years ago by James W. MacDonald48k
Hi Jim Thanks for taking the time to reply. >But I believe you really want the converse - >to stuff your function into the namespace and have the package think it >belongs there. Not quite. I do not want/need my function to be in the namespace. I just want the package to be able to call my function or supply me a way to give it a list of functions or data or something like that. I do not know what R lets you do/does not let you do in this area. I imagine, and you have intimated, it is programmatically possible. >by far the easiest way is to add a function to a source package and then >build/install. I am not so sure about that. Putting on my user hat I would say that if you want to supply extendability to a package that the user can manipulate it should be possible with simple standard R commands. If I did it your way I would have to remember to update my R installation every change. Worse, I would have to maintain all the R installations of the users that use my code, as well as handle all the problems it would raise with them. I want to have clean demarcated and separate interfaces from the packages I use. >You don't need to build R from source to build and install packages. All >you need to do is to get set up to be able to build R, and then you will >be able to install packages. In the past this was a semi-difficult thing >to do, but these days Duncan Murdoch has an installer that makes it >practically painless. I have built R (and packages) many times on Unix but not for some time. I tried once on Windows but at that time it was almost impossible. (More than semi-difficult). The tools were not easily available and were a bit confused with versions etc and the instructions were opaque. However if it has improved that much maybe I will have another look. >But personally, I would recommend getting set up to build packages >yourself. It's not that hard, and you gain two really nice things. >First, you will be able to install packages for which there is only a >source version. I can't tell you how often I have needed this capability. I do not have a great need for this though. If I had a pressing need then yes. >Second, you get all these nice Unix tools that turn out to be >exceptionally useful (who knew?). Things like sed, cut, awk, etc can be >daunting to use at first, but they are so very useful for doing what >they do that I can no longer imagine a life where I would have to muddle >along using the exceptionally dull tools that are typically available on >Windows. I get all this through using Cygwin on Windows. >Yes you could. However, the ellipsis is designed to pass arbitrary >variables to underlying code. You would then have to write code to parse >whatever random things an end user might pass via that method and then >try to divine what they meant to do. And I am just not that imaginative. Hmm - does that mean there is no pass through of the variables? That will not work then. There is something ringing a bell that there is a way to just pass the "..." variables through without parsing. Perhaps that was another language in another universe somewhere. But I think I saw it in R. The word "rest" keeps popping into my mind - I am sure I saw a chunk of code that passed through the "rest" of the variables. I am not sure if I can find it again. I will have a look or ask on R-help perhaps. >Since the only additional argument we need is the species, it is much >more directed and simpler to add a species argument One of the specific problems I had was I had an exon id as the id. But the Ensembl query had to use the transcript name for the query string. Something like: out[i] <-paste("http://www.ensembl.org/Mus_musculus/Transcript/Exons?t=", ids[i], sep = "") So I did not want the ids[i] but a way of getting to my transcript id column to generate t=transcript_id. If you call it species it may give the appearance of being less flexible than it could be. For instance, there was another possible query I considered that needed the gene id and the transcript id and other variables. There are many possibilities and variations I think. The helper script can handle the details if you can get the information to it. Perhaps a list of columns? Rather like the "othernames" in htmlpage. >I have been meaning to add Ensembl, so this gives me that much more >impetus. It won't be for a couple of days though. That is great. If it is just a couple of days would be brilliant but whenever will be welcome. I will be interested in what you come up with. Regards John
ADD REPLYlink written 9.9 years ago by john seers IFR810
Hi Jim Searching on ellipsis and pass through I got the following. "The second argument to boot(), called 'statistic', can be any user-written function you want to cook up, with additional arguments being passed to it through the '...' mechanism after all of the named arguments. (See: `R-intro `Writing your own functions `The ellipsis argument for details.)" Looking at the boot code shows the user function "statistic" in the signature and various calls to statistic of the form t0 <- statistic(data, original, rep(1, sum(m)), ...) function (data, statistic, R, sim = "ordinary", stype = "i", strata = rep(1, n), L = NULL, m = 0, weights = NULL, ran.gen = function(d, p) d, mle = NULL, simple = FALSE, ...) { This is sort of what I had in mind. (Though I have not found the code to pass through the "rest" of the variables.). No parsing needed. >However, the ellipsis is designed to pass arbitrary variables to underlying code. I think that is what I am suggesting needs to be done - pass through arbitrary variables. Perhaps a problem you have is htmlpage calls getCells which calls getQueryLink which calls the helper function(s). Not sure if this is any help to you. Regards John ---
ADD REPLYlink written 9.9 years ago by john seers IFR810
Hi John, Thanks to some help from Martin Morgan (thanks Martin!), the devel version of annotate now has two additions. 1.) You can create links to Ensembl, using the repository 'ens'. Since AFAICT Ensembl requires a species to be part of the URI, you will have to pass an additional argument 'species' to htmlpage(). The form of this argument is species="Homo_sapiens" for e.g, Human. If you forget to pass the argument it will bomb out with an error. This should work with ENSG, ENST, or ENSP identifiers, but let me know if you have problems. 2.) You can also now create links for arbitrary websites. There are three new functions, setRepository(), getRepositories() and clearRepository() that you can use to set up, look at, and remove repositories, respectively. This is all thanks to Martin - he makes smart use of an environment to hold the getQuery4XX() functions, and you can add new ones to the environment, thereby bypassing the namespace. The function you add should have similar form to any of the getQuery4XX() functions. Just write up the function, and use setRepository() to put it into the environment. There are some examples in the help page for these functions that will hopefully get anyone interested in this started. Again, let me know if it is not clear, or if there are any problems. Best, Jim john seers (IFR) wrote: > > Hi Jim > > > Searching on ellipsis and pass through I got the following. > > "The second argument to boot(), called 'statistic', can be > any user-written function you want to cook up, with additional > arguments being passed to it through the '...' mechanism after > all of the named arguments. (See: `R-intro `Writing your own > functions `The ellipsis argument for details.)" > > Looking at the boot code shows the user function "statistic" in the > signature and various calls to statistic of the form > > t0 <- statistic(data, original, rep(1, sum(m)), ...) > > > function (data, statistic, R, sim = "ordinary", stype = "i", > strata = rep(1, n), L = NULL, m = 0, weights = NULL, ran.gen = > function(d, > p) d, mle = NULL, simple = FALSE, ...) > { > > This is sort of what I had in mind. (Though I have not found the code to > pass through the "rest" of the variables.). No parsing needed. > > >> However, the ellipsis is designed to pass arbitrary variables to > underlying code. > > I think that is what I am suggesting needs to be done - pass through > arbitrary variables. Perhaps a problem you have is htmlpage calls > getCells which calls getQueryLink which calls the helper function(s). > > Not sure if this is any help to you. > > Regards > > John > > > > > > > > > > > --- >
ADD REPLYlink written 9.8 years ago by James W. MacDonald48k
Hello Jim Thanks for this. Done impressively quickly. >makes smart use of an environment to hold the getQuery4XX() functions, and you >can add new ones to the environment, thereby bypassing the namespace. It looks like you have found a neat way to do this and to make it a lot easier to use. I look forward to giving it a go. I expect I will be curious enough to look at the code and see how it was done. >You can create links to Ensembl, using the repository 'ens'. Since >AFAICT Ensembl requires a species to be part of the URI, you will have >to pass an additional argument 'species' to htmlpage(). The form of this >argument is species="Homo_sapiens" for e.g, Human. Ensembl is a good addition. But I am not sure if this particular addition addresses the specific problem I described. But I will have a look and report back to you. That involved an Exon search that needs the ensembl transcript id. My workaround for that was to duplicate my transcript column and perform the exon search on that. Perhaps there is another way to do it - I will have another go. I guess this is, or will be soon, available as a new version of annotate. I will have a look and see if it is there. If not perhaps I will have to give in and follow your recommendation to run from source. Thanks again. I will give you some feedback on your efforts. Regards John --- -----Original Message----- From: James W. MacDonald [mailto:jmacdon@med.umich.edu] Sent: 12 February 2009 18:39 To: john seers (IFR) Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Using htmlpage Hi John, Thanks to some help from Martin Morgan (thanks Martin!), the devel version of annotate now has two additions. 1.) You can create links to Ensembl, using the repository 'ens'. Since AFAICT Ensembl requires a species to be part of the URI, you will have to pass an additional argument 'species' to htmlpage(). The form of this argument is species="Homo_sapiens" for e.g, Human. If you forget to pass the argument it will bomb out with an error. This should work with ENSG, ENST, or ENSP identifiers, but let me know if you have problems. 2.) You can also now create links for arbitrary websites. There are three new functions, setRepository(), getRepositories() and clearRepository() that you can use to set up, look at, and remove repositories, respectively. This is all thanks to Martin - he makes smart use of an environment to hold the getQuery4XX() functions, and you can add new ones to the environment, thereby bypassing the namespace. The function you add should have similar form to any of the getQuery4XX() functions. Just write up the function, and use setRepository() to put it into the environment. There are some examples in the help page for these functions that will hopefully get anyone interested in this started. Again, let me know if it is not clear, or if there are any problems. Best, Jim john seers (IFR) wrote: > > Hi Jim > > > Searching on ellipsis and pass through I got the following. > > "The second argument to boot(), called 'statistic', can be > any user-written function you want to cook up, with additional > arguments being passed to it through the '...' mechanism after > all of the named arguments. (See: `R-intro `Writing your own > functions `The ellipsis argument for details.)" > > Looking at the boot code shows the user function "statistic" in the > signature and various calls to statistic of the form > > t0 <- statistic(data, original, rep(1, sum(m)), ...) > > > function (data, statistic, R, sim = "ordinary", stype = "i", > strata = rep(1, n), L = NULL, m = 0, weights = NULL, ran.gen = > function(d, > p) d, mle = NULL, simple = FALSE, ...) > { > > This is sort of what I had in mind. (Though I have not found the code to > pass through the "rest" of the variables.). No parsing needed. > > >> However, the ellipsis is designed to pass arbitrary variables to > underlying code. > > I think that is what I am suggesting needs to be done - pass through > arbitrary variables. Perhaps a problem you have is htmlpage calls > getCells which calls getQueryLink which calls the helper function(s). > > Not sure if this is any help to you. > > Regards > > John > > > > > > > > > > > --- >
ADD REPLYlink written 9.8 years ago by john seers IFR810
Hi John, john seers (IFR) wrote: > Hello Jim > > Thanks for this. Done impressively quickly. > >> makes smart use of an environment to hold the getQuery4XX() functions, > and you >> can add new ones to the environment, thereby bypassing the namespace. > > It looks like you have found a neat way to do this and to make it a lot > easier to use. I look forward to giving it a go. I expect I will be > curious enough to look at the code and see how it was done. As much as I would like to take credit, this is all Martin Morgan. > >> You can create links to Ensembl, using the repository 'ens'. Since >> AFAICT Ensembl requires a species to be part of the URI, you will have >> to pass an additional argument 'species' to htmlpage(). The form of > this >> argument is species="Homo_sapiens" for e.g, Human. > > Ensembl is a good addition. But I am not sure if this particular > addition addresses the specific problem I described. But I will have a > look and report back to you. That involved an Exon search that needs the > ensembl transcript id. My workaround for that was to duplicate my > transcript column and perform the exon search on that. Perhaps there is > another way to do it - I will have another go. OK. Given an Ensembl transcript ID (say, ENST00000405446), do you not want to end up here? http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapien s;idx=;q=ENST00000405446 If not, then where might you want to be? As I said in an earlier email, I can only help if you tell me _exactly_ what you want to do. I'm not smart enough to parse what you have said above or in earlier messages. If someone asked me 'What exactly does John Seers want?', I would only be able to say something about you wanting to do something with some data and end up with links to Ensembl. And that is seriously not enough to go on. > > I guess this is, or will be soon, available as a new version of > annotate. I will have a look and see if it is there. If not perhaps I > will have to give in and follow your recommendation to run from source. You will have to run the devel version of R, as the changes are only in the devel version of BioC. The windows binary _would_ have been up there today if I hadn't left two uncommented underscores in the help page for htmlpage() (which oddly enough doesn't seem to bother either Linux or Mac OS). So if you want to compile from source, you can start today. If you want a windows binary you will have to wait a day or two. Best, Jim > > Thanks again. I will give you some feedback on your efforts. > > Regards > > > John > > > > --- > > -----Original Message----- > From: James W. MacDonald [mailto:jmacdon at med.umich.edu] > Sent: 12 February 2009 18:39 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > Thanks to some help from Martin Morgan (thanks Martin!), the devel > version of annotate now has two additions. > > 1.) You can create links to Ensembl, using the repository 'ens'. Since > AFAICT Ensembl requires a species to be part of the URI, you will have > to pass an additional argument 'species' to htmlpage(). The form of this > > argument is species="Homo_sapiens" for e.g, Human. If you forget to pass > > the argument it will bomb out with an error. > > This should work with ENSG, ENST, or ENSP identifiers, but let me know > if you have problems. > > 2.) You can also now create links for arbitrary websites. There are > three new functions, setRepository(), getRepositories() and > clearRepository() that you can use to set up, look at, and remove > repositories, respectively. This is all thanks to Martin - he makes > smart use of an environment to hold the getQuery4XX() functions, and you > > can add new ones to the environment, thereby bypassing the namespace. > > The function you add should have similar form to any of the > getQuery4XX() functions. Just write up the function, and use > setRepository() to put it into the environment. There are some examples > in the help page for these functions that will hopefully get anyone > interested in this started. Again, let me know if it is not clear, or if > > there are any problems. > > Best, > > Jim > > > > john seers (IFR) wrote: >> Hi Jim >> >> >> Searching on ellipsis and pass through I got the following. >> >> "The second argument to boot(), called 'statistic', can be >> any user-written function you want to cook up, with additional >> arguments being passed to it through the '...' mechanism after >> all of the named arguments. (See: `R-intro `Writing your own >> functions `The ellipsis argument for details.)" >> >> Looking at the boot code shows the user function "statistic" in the >> signature and various calls to statistic of the form >> >> t0 <- statistic(data, original, rep(1, sum(m)), ...) >> >> >> function (data, statistic, R, sim = "ordinary", stype = "i", >> strata = rep(1, n), L = NULL, m = 0, weights = NULL, ran.gen = >> function(d, >> p) d, mle = NULL, simple = FALSE, ...) >> { >> >> This is sort of what I had in mind. (Though I have not found the code > to >> pass through the "rest" of the variables.). No parsing needed. >> >> >>> However, the ellipsis is designed to pass arbitrary variables to >> underlying code. >> >> I think that is what I am suggesting needs to be done - pass through >> arbitrary variables. Perhaps a problem you have is htmlpage calls >> getCells which calls getQueryLink which calls the helper function(s). > >> Not sure if this is any help to you. >> >> Regards >> >> John >> >> >> >> >> >> >> >> >> >> >> --- >> -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.8 years ago by James W. MacDonald48k
Hi Jim >As much as I would like to take credit, this is all Martin Morgan. Ah, but you made it happen, so don't shrink from taking some credit. (But thanks Martin Morgan as well). >As I said in an earlier email, I can only help if you tell me _exactly_ >what you want to do. I'm not smart enough to parse what you have said >above or in earlier messages. If someone asked me 'What exactly does >John Seers want?', I would only be able to say something about you >wanting to do something with some data and end up with links to Ensembl. >And that is seriously not enough to go on. I understand your problem but it is a little unfair to pile it all back on me. The problem is I do not know exactly what I want to do. Or perhaps I do but I do not know if what I want to do is sensible in your world. Remember I am dealing with uncertainty as well and have a user who does not know exactly what they want to do. If I had an exact specification I would give it to you. But I do not know the full capability of www.ensembl.org , what queries/links are available and the best way to do it. I think you are closer to it than me so you are more likely to know the best way forward. I have solved what I wanted to do with a couple of clunky workarounds. If on the way I have helped with stimulating some ideas that lead to some improvements then great. If you think my suggestions are not the way forward then fine. If I could get rid of both my clunky workarounds then excellent. If I can only get rid of one then still pretty good. > about you >wanting to do something with some data and end up with links to Ensembl. >And that is seriously not enough to go on. Well, why not? (That is not sarcastic). That just about sums up what I thought was needed. That is free up the code from specific repositories and link/query structures. What I was saying is that the data needs to get through to the helper function and once there you do not have to worry about the nature of the links. The helper function builds the link and you do not care how. There is complete flexibility and you can build any link/query you want. You can supply a basic list of helper functions (as you do now) and they can be added to by the user as needed. I suggested perhaps it could be done with the "..." notation (or something similar) but that did not appeal to you. I do not know why this does not appeal to you but you are the expert in this area. The specific example I gave was this: >>One of the specific problems I had was I had an exon id as the id. But the Ensembl query had to use the >>transcript name for the query string. >>Something like: >>out[i] <-paste("http://www.ensembl.org/Mus_musculus/Transcript/Exons?t=", ids[i], sep = "") >>So I did not want the ids[i] but a way of getting to my transcript id column to generate t=transcript_id. I am not sure how much more exact I could be in at least giving an example of my (uncertain) problems. >OK. Given an Ensembl transcript ID (say, ENST00000405446), do you not >want to end up here? >http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapie ns ;idx=;q=ENST00000405446 >If not, then where might you want to be? Well no, that is straightforward with the existing code. This is one of the idiocyncrancies of Ensembl (and presumably all database sites have them) and I have not found if there is another way to do what I want. My problem is I have the Exon id (for example ENSE00000012345 with an E for Exon) and there is no direct Ensembl exon query that I have been able to find (yet). The query looks something like (from above): http://www.ensembl.org/Mus_musculus/Transcript/Exons?t=ENST00000405446 (N.B. This will not work without a valid transcript). So I need to pull in the transcript id (ENST00000405446) from another column but I cannot get to it from the helper function. My clunky workaround is to duplicate the transcript column and build the exon query on that. So the user finds the exon they are interested in, backtracks to transcript column 2 and clicks. I would like them to click on the exon id in the exon column. (Transcript column 1 naturally has the standard transcript query). But that approach on a specific query misses the point. I was trying not to bring it down to specific examples because I think it could be completely flexible. But what do I know? I may be completely wrong and this is not the philosophy/design of repositories and htmlpage and ensembl and I have missed the point of how it should be done. I am not in a position to be that prescriptive of how it should be done. Perhaps what you have in the code already can do what I want but I just cannot see it. However I hope that does not sound ungrateful for your efforts because I am very grateful. I have not looked at it yet but I am sure you have improved the useability of modifying getQueryLink etc which was the main difficulty I had. >You will have to run the devel version of R, as the changes are only in >the devel version of BioC. Oh blow! I guess I cannot resist forever. :) Regards and thanks John --- -----Original Message----- From: James W. MacDonald [mailto:jmacdon@med.umich.edu] Sent: 13 February 2009 14:36 To: john seers (IFR) Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Using htmlpage Hi John, john seers (IFR) wrote: > Hello Jim > > Thanks for this. Done impressively quickly. > >> makes smart use of an environment to hold the getQuery4XX() functions, > and you >> can add new ones to the environment, thereby bypassing the namespace. > > It looks like you have found a neat way to do this and to make it a lot > easier to use. I look forward to giving it a go. I expect I will be > curious enough to look at the code and see how it was done. As much as I would like to take credit, this is all Martin Morgan. > >> You can create links to Ensembl, using the repository 'ens'. Since >> AFAICT Ensembl requires a species to be part of the URI, you will have >> to pass an additional argument 'species' to htmlpage(). The form of > this >> argument is species="Homo_sapiens" for e.g, Human. > > Ensembl is a good addition. But I am not sure if this particular > addition addresses the specific problem I described. But I will have a > look and report back to you. That involved an Exon search that needs the > ensembl transcript id. My workaround for that was to duplicate my > transcript column and perform the exon search on that. Perhaps there is > another way to do it - I will have another go. OK. Given an Ensembl transcript ID (say, ENST00000405446), do you not want to end up here? http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapien s; idx=;q=ENST00000405446 If not, then where might you want to be? As I said in an earlier email, I can only help if you tell me _exactly_ what you want to do. I'm not smart enough to parse what you have said above or in earlier messages. If someone asked me 'What exactly does John Seers want?', I would only be able to say something about you wanting to do something with some data and end up with links to Ensembl. And that is seriously not enough to go on. > > I guess this is, or will be soon, available as a new version of > annotate. I will have a look and see if it is there. If not perhaps I > will have to give in and follow your recommendation to run from source. You will have to run the devel version of R, as the changes are only in the devel version of BioC. The windows binary _would_ have been up there today if I hadn't left two uncommented underscores in the help page for htmlpage() (which oddly enough doesn't seem to bother either Linux or Mac OS). So if you want to compile from source, you can start today. If you want a windows binary you will have to wait a day or two. Best, Jim > > Thanks again. I will give you some feedback on your efforts. > > Regards > > > John > > > > --- > > -----Original Message----- > From: James W. MacDonald [mailto:jmacdon at med.umich.edu] > Sent: 12 February 2009 18:39 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > Thanks to some help from Martin Morgan (thanks Martin!), the devel > version of annotate now has two additions. > > 1.) You can create links to Ensembl, using the repository 'ens'. Since > AFAICT Ensembl requires a species to be part of the URI, you will have > to pass an additional argument 'species' to htmlpage(). The form of this > > argument is species="Homo_sapiens" for e.g, Human. If you forget to pass > > the argument it will bomb out with an error. > > This should work with ENSG, ENST, or ENSP identifiers, but let me know > if you have problems. > > 2.) You can also now create links for arbitrary websites. There are > three new functions, setRepository(), getRepositories() and > clearRepository() that you can use to set up, look at, and remove > repositories, respectively. This is all thanks to Martin - he makes > smart use of an environment to hold the getQuery4XX() functions, and you > > can add new ones to the environment, thereby bypassing the namespace. > > The function you add should have similar form to any of the > getQuery4XX() functions. Just write up the function, and use > setRepository() to put it into the environment. There are some examples > in the help page for these functions that will hopefully get anyone > interested in this started. Again, let me know if it is not clear, or if > > there are any problems. > > Best, > > Jim > > > > john seers (IFR) wrote: >> Hi Jim >> >> >> Searching on ellipsis and pass through I got the following. >> >> "The second argument to boot(), called 'statistic', can be >> any user-written function you want to cook up, with additional >> arguments being passed to it through the '...' mechanism after >> all of the named arguments. (See: `R-intro `Writing your own >> functions `The ellipsis argument for details.)" >> >> Looking at the boot code shows the user function "statistic" in the >> signature and various calls to statistic of the form >> >> t0 <- statistic(data, original, rep(1, sum(m)), ...) >> >> >> function (data, statistic, R, sim = "ordinary", stype = "i", >> strata = rep(1, n), L = NULL, m = 0, weights = NULL, ran.gen = >> function(d, >> p) d, mle = NULL, simple = FALSE, ...) >> { >> >> This is sort of what I had in mind. (Though I have not found the code > to >> pass through the "rest" of the variables.). No parsing needed. >> >> >>> However, the ellipsis is designed to pass arbitrary variables to >> underlying code. >> >> I think that is what I am suggesting needs to be done - pass through >> arbitrary variables. Perhaps a problem you have is htmlpage calls >> getCells which calls getQueryLink which calls the helper function(s). > >> Not sure if this is any help to you. >> >> Regards >> >> John >> >> >> >> >> >> >> >> >> >> >> --- >> -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.8 years ago by john seers IFR810
Hi John, john seers (IFR) wrote: > http://www.ensembl.org/Mus_musculus/Transcript/Exons?t=ENST00000405446 > > (N.B. This will not work without a valid transcript). > > So I need to pull in the transcript id (ENST00000405446) from another > column but I cannot get to it from the helper function. My clunky > workaround is to duplicate the transcript column and build the exon > query on that. So the user finds the exon they are interested in, > backtracks to transcript column 2 and clicks. I would like them to click > on the exon id in the exon column. (Transcript column 1 naturally has > the standard transcript query). OK, now I understand. You want to build a link using one ID, but supplying a different ID to the end user for them to click. This functionality still doesn't exist for htmlpage(), as there is no way to pass in two sets of IDs, one to build the query and one for the HTML. And the way htmlpage() is designed, I don't see a simple way to add such functionality without making it more of a kludge-fest than it already is. > > But that approach on a specific query misses the point. I was trying not > to bring it down to specific examples because I think it could be > completely flexible. But what do I know? I may be completely wrong and > this is not the philosophy/design of repositories and htmlpage and > ensembl and I have missed the point of how it should be done. I am not > in a position to be that prescriptive of how it should be done. Perhaps > what you have in the code already can do what I want but I just cannot > see it. I disagree with this statement. The htmlpage() function isn't designed to be completely flexible, nor IMO should it be. It is designed to allow relatively inexperienced end users to be able to build html pages of their results without having to know loads about html markup and all that business. As it stands it is probably too complicated - I allow people to pass in all manner of input and do a lot of probably needless gyrations to figure out if what they passed in is OK and then munge it into a presentable table. It has been argued more than once that it is too complicated (and if I were to simplify, it would almost certainly require more rigid inputs and limited outputs). If you want complete flexibility, then really what you should do is just use the xtable package directly. You can create a data.frame containing URIs in some of the columns, of whatever form you desire, and then use xtable() to build the table and then print it using print(thextable, type="html"), which is what is done in htmlpage() (see the last two lines of the function). Best, Jim > > However I hope that does not sound ungrateful for your efforts because I > am very grateful. I have not looked at it yet but I am sure you have > improved the useability of modifying getQueryLink etc which was the main > difficulty I had. > >> You will have to run the devel version of R, as the changes are only in > >> the devel version of BioC. > > Oh blow! I guess I cannot resist forever. :) > > > Regards and thanks > > > John > > > > > > > > > --- > > > -----Original Message----- > From: James W. MacDonald [mailto:jmacdon at med.umich.edu] > Sent: 13 February 2009 14:36 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > john seers (IFR) wrote: >> Hello Jim >> >> Thanks for this. Done impressively quickly. >> >>> makes smart use of an environment to hold the getQuery4XX() > functions, >> and you >>> can add new ones to the environment, thereby bypassing the namespace. >> It looks like you have found a neat way to do this and to make it a > lot >> easier to use. I look forward to giving it a go. I expect I will be >> curious enough to look at the code and see how it was done. > > As much as I would like to take credit, this is all Martin Morgan. > >>> You can create links to Ensembl, using the repository 'ens'. Since >>> AFAICT Ensembl requires a species to be part of the URI, you will > have >>> to pass an additional argument 'species' to htmlpage(). The form of >> this >>> argument is species="Homo_sapiens" for e.g, Human. >> Ensembl is a good addition. But I am not sure if this particular >> addition addresses the specific problem I described. But I will have a >> look and report back to you. That involved an Exon search that needs > the >> ensembl transcript id. My workaround for that was to duplicate my >> transcript column and perform the exon search on that. Perhaps there > is >> another way to do it - I will have another go. > > OK. Given an Ensembl transcript ID (say, ENST00000405446), do you not > want to end up here? > > http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapi ens; > idx=;q=ENST00000405446 > > If not, then where might you want to be? > > As I said in an earlier email, I can only help if you tell me _exactly_ > what you want to do. I'm not smart enough to parse what you have said > above or in earlier messages. If someone asked me 'What exactly does > John Seers want?', I would only be able to say something about you > wanting to do something with some data and end up with links to Ensembl. > > And that is seriously not enough to go on. > >> I guess this is, or will be soon, available as a new version of >> annotate. I will have a look and see if it is there. If not perhaps I >> will have to give in and follow your recommendation to run from > source. > > You will have to run the devel version of R, as the changes are only in > the devel version of BioC. The windows binary _would_ have been up there > > today if I hadn't left two uncommented underscores in the help page for > htmlpage() (which oddly enough doesn't seem to bother either Linux or > Mac OS). So if you want to compile from source, you can start today. > > If you want a windows binary you will have to wait a day or two. > > Best, > > Jim > > >> Thanks again. I will give you some feedback on your efforts. >> >> Regards >> >> >> John >> >> >> >> --- >> >> -----Original Message----- >> From: James W. MacDonald [mailto:jmacdon at med.umich.edu] >> Sent: 12 February 2009 18:39 >> To: john seers (IFR) >> Cc: bioconductor at stat.math.ethz.ch >> Subject: Re: [BioC] Using htmlpage >> >> Hi John, >> >> Thanks to some help from Martin Morgan (thanks Martin!), the devel >> version of annotate now has two additions. >> >> 1.) You can create links to Ensembl, using the repository 'ens'. Since > >> AFAICT Ensembl requires a species to be part of the URI, you will have > >> to pass an additional argument 'species' to htmlpage(). The form of > this >> argument is species="Homo_sapiens" for e.g, Human. If you forget to > pass >> the argument it will bomb out with an error. >> >> This should work with ENSG, ENST, or ENSP identifiers, but let me know > >> if you have problems. >> >> 2.) You can also now create links for arbitrary websites. There are >> three new functions, setRepository(), getRepositories() and >> clearRepository() that you can use to set up, look at, and remove >> repositories, respectively. This is all thanks to Martin - he makes >> smart use of an environment to hold the getQuery4XX() functions, and > you >> can add new ones to the environment, thereby bypassing the namespace. >> >> The function you add should have similar form to any of the >> getQuery4XX() functions. Just write up the function, and use >> setRepository() to put it into the environment. There are some > examples >> in the help page for these functions that will hopefully get anyone >> interested in this started. Again, let me know if it is not clear, or > if >> there are any problems. >> >> Best, >> >> Jim >> >> >> >> john seers (IFR) wrote: >>> Hi Jim >>> >>> >>> Searching on ellipsis and pass through I got the following. >>> >>> "The second argument to boot(), called 'statistic', can be >>> any user-written function you want to cook up, with additional >>> arguments being passed to it through the '...' mechanism after >>> all of the named arguments. (See: `R-intro `Writing your own >>> functions `The ellipsis argument for details.)" >>> >>> Looking at the boot code shows the user function "statistic" in the >>> signature and various calls to statistic of the form >>> >>> t0 <- statistic(data, original, rep(1, sum(m)), ...) >>> >>> >>> function (data, statistic, R, sim = "ordinary", stype = "i", >>> strata = rep(1, n), L = NULL, m = 0, weights = NULL, ran.gen = >>> function(d, >>> p) d, mle = NULL, simple = FALSE, ...) >>> { >>> >>> This is sort of what I had in mind. (Though I have not found the code >> to >>> pass through the "rest" of the variables.). No parsing needed. >>> >>> >>>> However, the ellipsis is designed to pass arbitrary variables to >>> underlying code. >>> >>> I think that is what I am suggesting needs to be done - pass through >>> arbitrary variables. Perhaps a problem you have is htmlpage calls >>> getCells which calls getQueryLink which calls the helper function(s). >>> Not sure if this is any help to you. >>> >>> Regards >>> >>> John >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> --- >>> > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLYlink written 9.8 years ago by James W. MacDonald48k
By using the triple colon you can use objects/functions that are not exported from the namespace. i.e. annotate:::getQuery4Affy() Jan > Is there no way to call a user function from a namespaced package? >
ADD REPLYlink written 9.9 years ago by Oosting, J. PATH550
Hi Jan Thanks for the reply. >By using the triple colon you can use objects/functions that are not >exported from the namespace. i.e. annotate:::getQuery4Affy() That would help if I do not have to "assignInNamespace" each function. I will try it. Thanks for the suggestion. Really my problem is the other way round though. I want the package to call my (user) function. Is there a currentworkspace:::userfunction() option? Regards John --- -----Original Message----- From: J.Oosting@lumc.nl [mailto:J.Oosting@lumc.nl] Sent: 05 February 2009 11:18 To: john seers (IFR) Cc: bioconductor at stat.math.ethz.ch Subject: RE: [BioC] Using htmlpage By using the triple colon you can use objects/functions that are not exported from the namespace. i.e. annotate:::getQuery4Affy() Jan > Is there no way to call a user function from a namespaced package? >
ADD REPLYlink written 9.9 years ago by john seers IFR810
On Feb 5, 2009, at 3:41 , john seers (IFR) wrote: > > Hi Jan > > Thanks for the reply. > >> By using the triple colon you can use objects/functions that are not >> exported from the namespace. i.e. annotate:::getQuery4Affy() > > That would help if I do not have to "assignInNamespace" each > function. I > will try it. Thanks for the suggestion. > > Really my problem is the other way round though. I want the package to > call my (user) function. Is there a currentworkspace:::userfunction() > option? This is exactly what namespaces were designed to avoid. You can perhaps work around it with assignInNamespace, but it will be ugly and a hell to maintain. Kasper
ADD REPLYlink written 9.9 years ago by Kasper Daniel Hansen6.4k
Hi Kasper Thanks for the reply. >This is exactly what namespaces were designed to avoid. You can >perhaps work around it with assignInNamespace, but it will be ugly and >a hell to maintain. I am not sure that is quite accurate. Namespaces are to avoid altering the namespace code either accidentally or on purpose. If a hook is supplied for a user function that does not break the idea. >You can perhaps work around it with assignInNamespace, but it will be ugly and >a hell to maintain. Exactly. I do not want to alter the namespace code or maintain it. Nor do I want to work around it using the assignInNamespace. (Perhaps you did not read the start of the thread?) Regards John --- -----Original Message----- From: Kasper Daniel Hansen [mailto:khansen@stat.berkeley.edu] Sent: 05 February 2009 16:56 To: john seers (IFR) Cc: J.Oosting at lumc.nl; bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Using htmlpage On Feb 5, 2009, at 3:41 , john seers (IFR) wrote: > > Hi Jan > > Thanks for the reply. > >> By using the triple colon you can use objects/functions that are not >> exported from the namespace. i.e. annotate:::getQuery4Affy() > > That would help if I do not have to "assignInNamespace" each > function. I > will try it. Thanks for the suggestion. > > Really my problem is the other way round though. I want the package to > call my (user) function. Is there a currentworkspace:::userfunction() > option? This is exactly what namespaces were designed to avoid. You can perhaps work around it with assignInNamespace, but it will be ugly and a hell to maintain. Kasper
ADD REPLYlink written 9.9 years ago by john seers IFR810
Hi John, ::: does the trick. If you, e.g., would like to call the function make.tablecode from the siggenes package (which is not exported, i.e. not available by simply calling make.tablecode), then you can use this function by calling siggenes:::make.tablecode Best, Holger -------- Original-Nachricht -------- > Datum: Thu, 5 Feb 2009 10:58:38 -0000 > Von: "john seers \\(IFR\\)" <john.seers at="" bbsrc.ac.uk=""> > An: "James W. MacDonald" <jmacdon at="" med.umich.edu=""> > CC: bioconductor at stat.math.ethz.ch > Betreff: Re: [BioC] Using htmlpage > > Hi Jim > > >True. However, nothing comes free. The cost of having a namespace is > >that it is not simple to add functionality. The benefit is the > >minimization of function masking by other packages and/or things in the > > >workspace. > > Is there no way to call a user function from a namespaced package? > > >But then again, I could be completely wrong. > > No, you have it spot on. > > > >I can divine that you want something like > >getQuery4ENS(ids, species) > > I wondered if using the "..." notation would be a good idea. > > I am not sure how it works exactly but: > > getQuery4ENS(ids, ...) > > would mean you could pass through whatever you wanted, I think. > > > If you think adding the functionality is a good idea then great and > thank you. You will be the better judge of whether it fits with your > design and is a sensible thing to do. I will definitely use it if it > comes available. > > > > > Regards > > > John > > > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James W. > MacDonald > Sent: 04 February 2009 20:17 > To: john seers (IFR) > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Using htmlpage > > Hi John, > > john seers (IFR) wrote: > > Hi Jim > > > > Thanks for the reply. > > > >> Easily is in the eye of the beholder. > > > > Easily is in the eye of the user. It could be easier. > > True. However, nothing comes free. The cost of having a namespace is > that it is not simple to add functionality. The benefit is the > minimization of function masking by other packages and/or things in the > workspace. > > The other side of the coin is the poor soul in a world without > namespaces who wonders why htmlpage() doesn't work, unaware that the > object getCells in his workspace is clobbering the getCells() function > that he knows nothing about. > > > > >> you will need to add the functions to the source package and then > >> build/install. > > > > I thought that might be the answer. I do not really want to do that > > because I do not build R from source. It would also create a > maintenance > > problem. > > > >> What repository are you trying to add? > > > > I was building links to www.ensembl.org. > > > > > #################################################################### #### > > ################### > > > > I notice that you are one of the authors Jim, so can I add a further > > question/suggested enhancement. > > > > One of the links that I am building for www.ensembl.org needs more > than > > the id to build the query. So I need the helper function to use the id > > plus further information from one of the other columns. Is there a > > recognised way to do this? That is pass the columns/lists through to > > getCells/getQueryLink/helper function so it can build the link from > > multiple values? > > I could probably add the functionality for you, but you will have to be > less mysterious about what you want. > > I can divine that you want something like > > getQuery4ENS(ids, species) > > so that > > getQuery4ENS("ENSG00000064961", "Homo_sapiens") > > will build > > http://www.ensembl.org/Homo_sapiens/Search/Summary?species=Homo_sapi ens; > idx=;q=ENSG00000064961 > > But then again, I could be completely wrong. > > Best, > > Jim > > > > > Regards > > > > > > John > > > > > > > > > > > > > > --- > > -----Original Message----- > > From: James W. MacDonald [mailto:jmacdon at med.umich.edu] > > Sent: 04 February 2009 15:47 > > To: john seers (IFR) > > Cc: bioconductor at stat.math.ethz.ch > > Subject: Re: [BioC] Using htmlpage > > > > Hi John, > > > > john seers (IFR) wrote: > >> Hello Bioconductor people > >> > >> I am trying to use htmlpage (from the annotate package) so it can > >> generate html links in addition to the types of links already > > provided. > >> >From the documentation of htmlpage it says: > >> > >> "Additional repositories can easily be added. See getQueryLink for > > more > >> information." > > > > Easily is in the eye of the beholder. It is actually quite easy, but > you > > > > will need to add the functions to the source package and then > > build/install. As you have noted, the namespace prevents you from > easily > > > > modifying the package by dumping new functions in the workspace. > > > > What repository are you trying to add? It might be easiest to just add > > > the repository to the package itself, if it is something that others > > might want to use. > > > > Best, > > > > Jim > > > > > >> But it does not seem as straightforward as I hoped. Trying to modify > > the > >> scripts hits difficulties with namespaces and local names. Can anyone > >> tell me if there is a simpler way? > >> > >> I defined my own copy of getQueryLink but htmlpage still called the > >> namespace version. This I could change using: > >> > >> assignInNamespace("getQueryLink", getQueryLink, ns="annotate") > >> > >> But then it did not work because getQueryLink could not see the > > original > >> internal scripts such as getQuery4Affy. So I modified the script > again > >> to remove all the repositories I did not need. But I still needed the > >> getQuery4Affy helper script so I had to redefine that and use > >> assignInNamespace again. > >> > >> This seems too complicated. Have I missed an easier way? Any > >> suggestions? > >> > >> > >> > >> > >> Regards > >> > >> > >> John > >> > >> > >> > >> > > > #################################################################### #### > >> ################################ > >> > >> > >>> sessionInfo() > >> R version 2.8.1 (2008-12-22) > >> i386-pc-mingw32 > >> > >> locale: > >> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United > >> Kingdom.1252;LC_MONETARY=English_United > >> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 > >> > >> attached base packages: > >> [1] tools stats graphics grDevices datasets utils > > methods > >> [8] base > >> > >> other attached packages: > >> [1] annotate_1.20.1 xtable_1.5-4 AnnotationDbi_1.4.2 > >> [4] Biobase_2.2.1 RWinEdt_1.8-0 > >> > >> loaded via a namespace (and not attached): > >> [1] DBI_0.2-4 RSQLite_0.7-1 > >> > >> > >> > >> > >> --- > >> > >> _______________________________________________ > >> Bioconductor mailing list > >> Bioconductor at stat.math.ethz.ch > >> https://stat.ethz.ch/mailman/listinfo/bioconductor > >> Search the archives: > > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > -- > James W. MacDonald, M.S. > Biostatistician > Hildebrandt Lab > 8220D MSRB III > 1150 W. Medical Center Drive > Ann Arbor MI 48109-0646 > 734-936-8662 > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor --
ADD REPLYlink written 9.9 years ago by Holger Schwender900
Hi Holger Thanks for the suggestion. That will be a help. >siggenes:::make.tablecode Regards John ---
ADD REPLYlink written 9.9 years ago by john seers IFR810
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 160 users visited in the last hour