git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@68698 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -15,7 +15,7 @@ Depends: R (>= 2.15.0), methods, GenomicRanges |
15 | 15 |
Imports: IRanges, Rsamtools (>= 1.7.4), rtracklayer (>= 1.17.15), GenomicRanges, |
16 | 16 |
GenomicFeatures, Biostrings, VariantAnnotation, tools, Biobase |
17 | 17 |
Suggests: RUnit, BSgenome.Dmelanogaster.UCSC.dm3, pasillaBamSubset, |
18 |
- BSgenome.Scerevisiae.UCSC.sacCer3 |
|
18 |
+ BSgenome.Scerevisiae.UCSC.sacCer3, VariantAnnotation |
|
19 | 19 |
License: Artistic-2.0 |
20 | 20 |
Collate: GmapBamReader-class.R |
21 | 21 |
GmapGenomeDirectory-class.R |
... | ... |
@@ -23,11 +23,9 @@ importClassesFrom(VariantAnnotation, "VCF") |
23 | 23 |
|
24 | 24 |
export(bam_tally, GmapGenome, GmapGenomeDirectory, GsnapParam, |
25 | 25 |
directory, BamTallyParam, makeGmapGenomePackage, GsnapOutput, |
26 |
- flankingCycleBreaks) |
|
26 |
+ GmapSnps, GmapSnpDirectory) |
|
27 |
+ |
|
27 | 28 |
exportClasses(GmapGenome, GmapGenomeDirectory, GmapSnpDirectory, |
28 | 29 |
GsnapOutput, GmapSnps, BamTallyParam, GsnapParam) |
29 |
-exportMethods(bamPaths, path, genome, seqinfo, gsnap) |
|
30 |
- |
|
31 |
-## gsnap API |
|
32 | 30 |
|
33 |
-## export("snps<-", getDefaultGmapGenomePath) |
|
31 |
+exportMethods(bamPaths, path, genome, seqinfo, gsnap, "snps<-") |
... | ... |
@@ -28,6 +28,13 @@ test_GmapGenome_constructor_BSgenome_create <- function() { |
28 | 28 |
checkTrue(is(gmapGenome, "GmapGenome")) |
29 | 29 |
} |
30 | 30 |
|
31 |
+testGmapGenome_constructor_FastaFile_create <- function() { |
|
32 |
+ fa <- system.file("extdata/hg19.p53.fasta", package="gmapR", mustWork=TRUE) |
|
33 |
+ fastaFile <- rtracklayer::FastaFile(fa) |
|
34 |
+ gmapGenome <- GmapGenome(fastaFile, create=TRUE) |
|
35 |
+ checkTrue(is(gmapGenome, "GmapGenome")) |
|
36 |
+} |
|
37 |
+ |
|
31 | 38 |
test_GmapGenome_accessors <- function() { |
32 | 39 |
genomeName <- "testGenome" |
33 | 40 |
dna <- Biostrings::DNAStringSet("ACTGTGTCAG") |
... | ... |
@@ -77,6 +77,12 @@ flyGG <- GmapGenome(Dmelanogaster, create = TRUE) |
77 | 77 |
## access system-wide genome using a key |
78 | 78 |
flyGG <- GmapGenome(genome = "dm3", |
79 | 79 |
directory = path.expand("/usr/share/gmap")) |
80 |
+ |
|
81 |
+##create a GmapGenome from a FASTA file |
|
82 |
+fa <- system.file("extdata/hg19.MT.fasta", package="gmapR") |
|
83 |
+fastaFile <- rtracklayer::FastaFile(fa) |
|
84 |
+gmapGenome <- GmapGenome(fastaFile, create=TRUE) |
|
80 | 85 |
} |
86 |
+ |
|
81 | 87 |
} |
82 | 88 |
\keyword{classes} |
... | ... |
@@ -3,6 +3,7 @@ |
3 | 3 |
\docType{class} |
4 | 4 |
\alias{GmapSnps-class} |
5 | 5 |
\alias{directory,GmapSnps-method} |
6 |
+\alias{GmapSnps} |
|
6 | 7 |
|
7 | 8 |
\title{Class \code{"GmapSnps"}} |
8 | 9 |
\description{ |
... | ... |
@@ -14,6 +15,29 @@ |
14 | 15 |
Objects can be created by calls of the form \code{GmapSnps(snps, |
15 | 16 |
directory, name, create)}. |
16 | 17 |
} |
18 |
+ |
|
19 |
+\usage{GmapSnps(snps, directory, name = snps, create = FALSE, ...)} |
|
20 |
+ |
|
21 |
+\arguments{ |
|
22 |
+ \item{snps}{A path to a VCF file} |
|
23 |
+ \item{directory}{The directory to create the IIT files used by GMAP |
|
24 |
+ and GSNAP} |
|
25 |
+ \item{name}{If provided, the name to give the database of SNPs. If not |
|
26 |
+ provided, defauts to the \code{snps} argument.} |
|
27 |
+ \item{create}{If the directory provided in the \code{directory} |
|
28 |
+ argument does not exist, create it.} |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+\section{Accessors}{ |
|
32 |
+ \describe{ |
|
33 |
+ \item{}{\code{name(x)}: returns the name of the \code{GmapSnps} object} |
|
34 |
+ \item{}{\code{directory(x)}: returns the \code{GmapGenomeDirectory} |
|
35 |
+ that is the parent of the directory containing the index files for |
|
36 |
+ this \code{GmapSnps} object.} |
|
37 |
+ } |
|
38 |
+} |
|
39 |
+ |
|
40 |
+ |
|
17 | 41 |
\section{Methods}{ |
18 | 42 |
\describe{ |
19 | 43 |
\item{directory}{\code{signature(x = "GmapSnps")}: ... } |
... | ... |
@@ -1,5 +1,8 @@ |
1 | 1 |
/* src/config.h.in. Generated from configure.ac by autoheader. */ |
2 | 2 |
|
3 |
+/* Define if building universal (internal helper macro) */ |
|
4 |
+#undef AC_APPLE_UNIVERSAL_BUILD |
|
5 |
+ |
|
3 | 6 |
/* Define to 1 if bsr command is available in assembly */ |
4 | 7 |
#undef HAVE_ASM_BSR |
5 | 8 |
|
... | ... |
@@ -221,9 +224,17 @@ |
221 | 224 |
/* Version number of package */ |
222 | 225 |
#undef VERSION |
223 | 226 |
|
224 |
-/* Define to 1 if your processor stores words with the most significant byte |
|
225 |
- first (like Motorola and SPARC, unlike Intel and VAX). */ |
|
226 |
-#undef WORDS_BIGENDIAN |
|
227 |
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most |
|
228 |
+ significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
229 |
+#if defined AC_APPLE_UNIVERSAL_BUILD |
|
230 |
+# if defined __BIG_ENDIAN__ |
|
231 |
+# define WORDS_BIGENDIAN 1 |
|
232 |
+# endif |
|
233 |
+#else |
|
234 |
+# ifndef WORDS_BIGENDIAN |
|
235 |
+# undef WORDS_BIGENDIAN |
|
236 |
+# endif |
|
237 |
+#endif |
|
227 | 238 |
|
228 | 239 |
/* Number of bits in a file offset, on hosts where this is settable. */ |
229 | 240 |
#undef _FILE_OFFSET_BITS |
... | ... |
@@ -1,6 +1,9 @@ |
1 | 1 |
/* src/config.h. Generated from config.h.in by configure. */ |
2 | 2 |
/* src/config.h.in. Generated from configure.ac by autoheader. */ |
3 | 3 |
|
4 |
+/* Define if building universal (internal helper macro) */ |
|
5 |
+/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
6 |
+ |
|
4 | 7 |
/* Define to 1 if the system has the type `caddr_t'. */ |
5 | 8 |
#define HAVE_CADDR_T 1 |
6 | 9 |
|
... | ... |
@@ -146,7 +149,7 @@ |
146 | 149 |
#define HAVE_ZLIB 1 |
147 | 150 |
|
148 | 151 |
/* Define to 1 if your zlib library has a gzbuffer function. */ |
149 |
-#define HAVE_ZLIB_GZBUFFER 1 |
|
152 |
+/* #undef HAVE_ZLIB_GZBUFFER */ |
|
150 | 153 |
|
151 | 154 |
/* Define to the sub-directory in which libtool stores uninstalled libraries. |
152 | 155 |
*/ |
... | ... |
@@ -203,9 +206,17 @@ |
203 | 206 |
/* Version number of package */ |
204 | 207 |
#define VERSION "2012-07-06" |
205 | 208 |
|
206 |
-/* Define to 1 if your processor stores words with the most significant byte |
|
207 |
- first (like Motorola and SPARC, unlike Intel and VAX). */ |
|
208 |
-/* #undef WORDS_BIGENDIAN */ |
|
209 |
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most |
|
210 |
+ significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
211 |
+#if defined AC_APPLE_UNIVERSAL_BUILD |
|
212 |
+# if defined __BIG_ENDIAN__ |
|
213 |
+# define WORDS_BIGENDIAN 1 |
|
214 |
+# endif |
|
215 |
+#else |
|
216 |
+# ifndef WORDS_BIGENDIAN |
|
217 |
+/* # undef WORDS_BIGENDIAN */ |
|
218 |
+# endif |
|
219 |
+#endif |
|
209 | 220 |
|
210 | 221 |
/* Enable large inode numbers on Mac OS X 10.5. */ |
211 | 222 |
#ifndef _DARWIN_USE_64_BIT_INODE |
... | ... |
@@ -1,5 +1,8 @@ |
1 | 1 |
/* src/config.h.in. Generated from configure.ac by autoheader. */ |
2 | 2 |
|
3 |
+/* Define if building universal (internal helper macro) */ |
|
4 |
+#undef AC_APPLE_UNIVERSAL_BUILD |
|
5 |
+ |
|
3 | 6 |
/* Define to 1 if the system has the type `caddr_t'. */ |
4 | 7 |
#undef HAVE_CADDR_T |
5 | 8 |
|
... | ... |
@@ -202,9 +205,17 @@ |
202 | 205 |
/* Version number of package */ |
203 | 206 |
#undef VERSION |
204 | 207 |
|
205 |
-/* Define to 1 if your processor stores words with the most significant byte |
|
206 |
- first (like Motorola and SPARC, unlike Intel and VAX). */ |
|
207 |
-#undef WORDS_BIGENDIAN |
|
208 |
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most |
|
209 |
+ significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
210 |
+#if defined AC_APPLE_UNIVERSAL_BUILD |
|
211 |
+# if defined __BIG_ENDIAN__ |
|
212 |
+# define WORDS_BIGENDIAN 1 |
|
213 |
+# endif |
|
214 |
+#else |
|
215 |
+# ifndef WORDS_BIGENDIAN |
|
216 |
+# undef WORDS_BIGENDIAN |
|
217 |
+# endif |
|
218 |
+#endif |
|
208 | 219 |
|
209 | 220 |
/* Enable large inode numbers on Mac OS X 10.5. */ |
210 | 221 |
#ifndef _DARWIN_USE_64_BIT_INODE |
... | ... |
@@ -295,6 +295,61 @@ After creating the package, you can run \Rcode{R CMD INSTALL |
295 | 295 |
myDestDir} to install it, or run \Rcode{R CMD build myDestDir} to |
296 | 296 |
create a distribution of the package. |
297 | 297 |
|
298 |
+Many users with be working with the human genome. Many of the examples |
|
299 |
+used in \software{gmapR} make use of a particular build of the human |
|
300 |
+genome. As such, creating a \Rclass{GmapGenome} of hg19 is |
|
301 |
+recommended. Here is one way to create it, using a \Rclass{BSgenome} |
|
302 |
+object: |
|
303 |
+ |
|
304 |
+<<create_hg19_GmapGenome, eval=FALSE>>= |
|
305 |
+if (!suppressWarnings(require(BSgenome.Hsapiens.UCSC.hg19))) { |
|
306 |
+ source("http://bioconductor.org/biocLite.R") |
|
307 |
+ biocLite("BSgenome.Hsapiens.UCSC.hg19") |
|
308 |
+ library(BSgenome.Hsapiens.UCSC.hg19) |
|
309 |
+} |
|
310 |
+gmapGenome <- GmapGenome(genome=Hsapiens, |
|
311 |
+ directory = "Hsapiens", |
|
312 |
+ name = "hg19", |
|
313 |
+ create = TRUE) |
|
314 |
+destDir <- "HsapiensGmapGenome" |
|
315 |
+pkgName <- "GmapGenome.Hsapiens.UCSC.hg19" |
|
316 |
+makeGmapGenomePackage(gmapGenome=gmapGenome, |
|
317 |
+ version="1.0.0", |
|
318 |
+ maintainer="<your.name@somewhere.com>", |
|
319 |
+ author="Your Name", |
|
320 |
+ destDir=destDir, |
|
321 |
+ license="Artistic-2.0", |
|
322 |
+ pkgName="GmapGenome.Hsapiens.UCSC.hg19") |
|
323 |
+@ |
|
324 |
+ |
|
325 |
+After running the above code, you should be able to run \Rcode{R CMD |
|
326 |
+ INSTALL GmapGenome.Hsapiens.UCSC.hg19} in the appropriate directory |
|
327 |
+from the command line, submit GmapGenome.Hsapiens.UCSC.hg19 to a |
|
328 |
+repository, etc. After installation, |
|
329 |
+\Rcode{library("GmapGenome.Hsapiens.UCSC.hg19")} will load a |
|
330 |
+\Rclass{GmapGenome} object that has the same name as the package. |
|
331 |
+ |
|
332 |
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
333 |
+\section{Aligning with SNP Tolerance} |
|
334 |
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
335 |
+ |
|
336 |
+Both \software{GSNAP} and \software{GMAP} have the ability to perform |
|
337 |
+alignment without penalizing against a set of known SNPs. In this |
|
338 |
+section, we work through an example of aligning with this SNP |
|
339 |
+tolerance. By using SNP-tolerance, we'll perform alignments without |
|
340 |
+penalizing reads that match SNPs contained in the provided SNPs. In |
|
341 |
+this case, we'll use dbSNP to provide the SNPs. |
|
342 |
+ |
|
343 |
+This example will use hg19. If you have not installed |
|
344 |
+\Rcode{GmapGenome.Hsapiens.UCSC.hg19}, please refer to the section |
|
345 |
+\ref{create_hg19_GmapGenome}. |
|
346 |
+ |
|
347 |
+First we load the Hsapiens \Rclass{GmapGenome} object: |
|
348 |
+ |
|
349 |
+<<<load_GmapGenomeHsapiens>>= |
|
350 |
+library("GmapGenome.Hsapiens.UCSC.hg19") |
|
351 |
+@ |
|
352 |
+ |
|
298 | 353 |
<<SessionInfo>>= |
299 | 354 |
sessionInfo() |
300 | 355 |
@ |