[Bioc-devel] To use knitr, how to write the right Makefile for bioconductor devel and released branch?
Martin Morgan
mtmorgan at fhcrc.org
Thu Sep 27 22:10:01 CEST 2012
On 09/27/2012 01:05 PM, Tengfei Yin wrote:
>
>
> On Thu, Sep 27, 2012 at 2:42 PM, Hervé Pagès <hpages at fhcrc.org
> <mailto:hpages at fhcrc.org>> wrote:
>
> Hi Tengfei,
>
> Yes, as Dan said, that should work. Make sure you indent the Makefile
> properly though (normally with a tab), or it won't work:
>
> ------------------------------__------------------------------__-----------
>
> PDFS= ggbio.pdf
>
> all: $(PDFS)
>
> clean:
> rm -f *.tex *.bbl *.blg *.aux *.out *.log *.spl *tikzDictionary
>
> %.pdf: %.Rnw
> $(R_HOME)/bin/Rscript -e "library(knitr); knit2pdf('$*.Rnw')"
> ------------------------------__------------------------------__-----------
>
> Also note the use of a regexpr in the call to knit2pdf() so that all
> Sweave files in the folder will be processed.
>
> I would suggest 3 more things:
>
> 1. Add *.toc to the rm command above.
>
> 2. Don't forget to add knitr to the Suggests field of your package.
>
> 3. If you've not done it already, add library(knitr) right before the
> knit_hooks$... line in the set-options code chunk in each of your
> Rnw files, so that people can still run Sweave() on them if they
> want.
>
> Cheers,
> H.
>
> Hi Hervé,
>
> Thanks a lot for your suggestion, I haven't done that yet, so I could
> make all those changes.
> Potential issues is that(actually as Martin just mentioned), if my Rnw
> won't be running through sweave(sweave first run on my Rnw) which
> because knitr-specified tag is included in my Rnw file, and Sweave won't
> recognize, for example, may be tag, fig.cap = " with quotes", there is
> no such tag and I guess I cannot use quotes, I guess I am hitting a
> potential problem like that, one solution could be that I have to put a
> fake Rnw first, then remove fake vignette and run knitr on real Rnw file
> somewhere and copy it to the right location to replace the fake vignette...
As you go down that road, you'll want to make sure that
vignette(package="ggbio") and help.start() pages for ggbio list
appropriate files -- the pdf, Rnw, and R files for your real vignette.
Also, although the Bioconductor build system runs R CMD check
--no-vignettes, it seems like you'd like to have the R code in the
vignette run as part of the check. Hacking might be quite painful! Martin
>
> I am experimenting on my machine now... hope that would work, I heard
> from knitr designer that Rcpp did similar things like that.
>
> Tengfei
>
>
>
>
> On 09/27/2012 08:08 AM, Dan Tenenbaum wrote:
>
> On Wed, Sep 26, 2012 at 11:41 PM, Tengfei Yin
> <yintengfei at gmail.com <mailto:yintengfei at gmail.com>> wrote:
>
> Dear maintainers and developers,
>
> I am wondering, is there a way to use knitr to built my
> vignette, I am
> trying to write a Makefile under my inst/doc, something like
>
> # Makefile to use knitr for package vignettes
> # put all PDF targets here, separated by spaces
> PDFS= ggbio.pdf
> all: $(PDFS)
> clean:
> rm -f *.tex *.bbl *.blg *.aux *.out *.log *.spl *tikzDictionary
> %.pdf: %.Rnw
> $(R_HOME)/bin/Rscript -e "library(knitr); knit2pdf('ggbio.Rnw')"
>
> Then I realize the bioc maintained two branch, released and
> development, so
> the R version it used to check each branch must be
> different, I don't
> really know how to specify those in my Makefile, especially
> after next
> Monday, the devel-branch become released version
> automatically, there must
> be a problem if I set up a fixed point to some */bin/Rscript?
>
> I don't really know how it works with bioconductor, the
> example above
> should work for cran, but I guess things are very different
> between cran
> and bioc.
>
>
>
> If you use "$(R_HOME)/bin/R" in your Makefile, as you do, the
> correct
> R will be used.
> Dan
>
>
>
> thanks a lot!
>
> Tengfei
>
>
>
> --
> Tengfei Yin
> MCDB PhD student
> 1620 Howe Hall, 2274,
> Iowa State University
> Ames, IA,50011-2274
>
> [[alternative HTML version deleted]]
>
> _________________________________________________
> Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org>
> mailing list
> https://stat.ethz.ch/mailman/__listinfo/bioc-devel
> <https://stat.ethz.ch/mailman/listinfo/bioc-devel>
>
>
> _________________________________________________
> Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org>
> mailing list
> https://stat.ethz.ch/mailman/__listinfo/bioc-devel
> <https://stat.ethz.ch/mailman/listinfo/bioc-devel>
>
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages at fhcrc.org <mailto:hpages at fhcrc.org>
> Phone: (206) 667-5791 <tel:%28206%29%20667-5791>
> Fax: (206) 667-1319 <tel:%28206%29%20667-1319>
>
>
>
>
> --
> Tengfei Yin
> MCDB PhD student
> 1620 Howe Hall, 2274,
> Iowa State University
> Ames, IA,50011-2274
>
>
>
--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
More information about the Bioc-devel
mailing list