Browse code

one more adjustment in response to the 'vals' -> 'filter' renaming in GenomicFeatures

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@115844 bc3139a8-67e5-0310-9ffc-ced21a209358

Herve Pages authored on 05/04/2016 23:53:00
Showing 1 changed files
... ...
@@ -64,7 +64,7 @@ test_GmapGenome_spliceSites_replacement <- function() {
64 64
     library(org.Hs.eg.db)
65 65
     eg <- org.Hs.egSYMBOL2EG[["TP53"]]
66 66
     txTP53 <- transcripts(TxDb.Hsapiens.UCSC.hg19.knownGene,
67
-                          vals = list(gene_id = eg))
67
+                          filter = list(gene_id = eg))
68 68
     rngs <- GRanges(ranges=IRanges(start(range(txTP53)), end(range(txTP53))),
69 69
                     seqnames="chr17")
70 70
     rngs + 1e6
Browse code

general cleanup and fixes, doc updates

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@111183 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 03/12/2015 21:11:09
Showing 1 changed files
... ...
@@ -49,6 +49,7 @@ test_GmapGenome_accessors <- function() {
49 49
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
50 50
   dir.create(genomeDir, recursive=TRUE)
51 51
   on.exit(unlink(genomeDir, recursive=TRUE))
52
+  genomeDir <- normalizePath(genomeDir)
52 53
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
53 54
                            name=genomeName, create=FALSE, k=12)
54 55
   checkIdentical(path(gmapGenome), file.path(genomeDir, genomeName))
Browse code

add codon tally support. No vbump yet

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@93316 bc3139a8-67e5-0310-9ffc-ced21a209358

Gabriel Becker authored on 11/08/2014 23:42:48
Showing 1 changed files
... ...
@@ -49,7 +49,6 @@ test_GmapGenome_accessors <- function() {
49 49
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
50 50
   dir.create(genomeDir, recursive=TRUE)
51 51
   on.exit(unlink(genomeDir, recursive=TRUE))
52
-  genomeDir <- tools::file_path_as_absolute(genomeDir)
53 52
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
54 53
                            name=genomeName, create=FALSE, k=12)
55 54
   checkIdentical(path(gmapGenome), file.path(genomeDir, genomeName))
Browse code

attempt to fix unit tests for the Mac (OS X Mavericks)

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@91006 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 04/06/2014 23:33:32
Showing 1 changed files
... ...
@@ -49,6 +49,7 @@ test_GmapGenome_accessors <- function() {
49 49
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
50 50
   dir.create(genomeDir, recursive=TRUE)
51 51
   on.exit(unlink(genomeDir, recursive=TRUE))
52
+  genomeDir <- tools::file_path_as_absolute(genomeDir)
52 53
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
53 54
                            name=genomeName, create=FALSE, k=12)
54 55
   checkIdentical(path(gmapGenome), file.path(genomeDir, genomeName))
Browse code

Use %over% instead of %in% (now defunct) between a GRangesList and a GRanges object.

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@75584 bc3139a8-67e5-0310-9ffc-ced21a209358

Herve Pages authored on 11/04/2013 16:40:41
Showing 1 changed files
... ...
@@ -71,7 +71,7 @@ test_GmapGenome_spliceSites_replacement <- function() {
71 71
   rngTP53 <- getTP53Range()
72 72
   
73 73
   exonsByTx <- exonsBy(txdb, by="tx")
74
-  exonsInRegion <- exonsByTx[exonsByTx %in% rngTP53]
74
+  exonsInRegion <- exonsByTx[exonsByTx %over% rngTP53]
75 75
   
76 76
   ##shift coords of retrieved exons so the ranges match the 
77 77
   ##region of the genome used for this example
Browse code

Add getSeq,GmapGenome method

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@74875 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 26/03/2013 21:44:17
Showing 1 changed files
... ...
@@ -93,3 +93,25 @@ test_GmapGenome_spliceSites_replacement <- function() {
93 93
 test_if_GmapGenome_dir_does_not_exist <- function() {
94 94
   checkException(GmapGenome(genome="NoGenome", directory = file.path(tempdir(), "DoesNotExist")))
95 95
 }
96
+
97
+test_GmapGenome_getSeq <- function() {
98
+  genomeName <- "testGenome"
99
+  dna <- Biostrings::DNAStringSet(c(testA = "ACTGTGTCAGTTCATGGGACCGTTGC",
100
+                                    testB = "CAACAAATCCGGG"))
101
+  genomeDir <- tempfile()
102
+  if (file.exists(genomeDir))
103
+    unlink(genomeDir, recursive=TRUE)
104
+  dir.create(genomeDir, recursive=TRUE)
105
+  on.exit(unlink(genomeDir, recursive=TRUE))
106
+  genome <- GmapGenome(genome=dna, directory=genomeDir,
107
+                       name=genomeName, create=TRUE, k=12)
108
+  
109
+  gr <- GRanges(rep(c("testA", "testB"), 2),
110
+                IRanges(c(1, 5, 5, 11), c(1, 10, 7, 10)),
111
+                c("+", "-", "*", "+"))
112
+  seqs <- getSeq(genome, gr)
113
+  checkIdentical(seqs, c("A", "GGATTT", "TGT", ""))
114
+
115
+  seqs <- getSeq(genome, GRanges())
116
+  checkIdentical(seqs, character())
117
+}
Browse code

force all tests to build 12mer indices to save memory (and thus hopefully build on the Hutch build machines)

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@74113 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 09/03/2013 01:04:14
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 test_GmapGenome_constructor_DNAStringSet_noCreate <- function() {
2 2
   dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
3 3
   names(dna) <- "test"
4
-  gmapGenome <- GmapGenome(genome=dna, name="thing", create=FALSE)
4
+  gmapGenome <- GmapGenome(genome=dna, name="thing", create=FALSE, k = 12)
5 5
   checkTrue(is(gmapGenome, "GmapGenome"))
6 6
 }
7 7
 
... ...
@@ -15,10 +15,10 @@ test_GmapGenome_constructor_DNAStringSet_create <- function() {
15 15
   dir.create(genomeDir, recursive=TRUE)
16 16
   on.exit(unlink(genomeDir, recursive=TRUE))
17 17
   checkException(GmapGenome(genome=dna, directory=genomeDir,
18
-                            name="thing", create=TRUE))
18
+                            name="thing", create=TRUE, k=12))
19 19
   names(dna) <- "sampleDNAStringSet"
20 20
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
21
-                           name="thing", create=TRUE)
21
+                           name="thing", create=TRUE, k=12)
22 22
   checkTrue(is(gmapGenome, "GmapGenome"))
23 23
 }
24 24
 
... ...
@@ -30,14 +30,14 @@ test_GmapGenome_constructor_BSgenome_create <- function() {
30 30
   dir.create(genomeDir, recursive=TRUE)  
31 31
   on.exit(unlink(genomeDir, recursive=TRUE))
32 32
   gmapGenome <- GmapGenome(genome=Scerevisiae, directory=genomeDir,
33
-                           name=genomeName, create=TRUE)                           
33
+                           name=genomeName, create=TRUE, k=12) 
34 34
   checkTrue(is(gmapGenome, "GmapGenome"))
35 35
 }
36 36
 
37 37
 testGmapGenome_constructor_FastaFile_create <- function() {
38 38
   fa <- system.file("extdata/hg19.p53.fasta", package="gmapR", mustWork=TRUE)
39 39
   fastaFile <- rtracklayer::FastaFile(fa)
40
-  gmapGenome <- GmapGenome(fastaFile, create=TRUE)
40
+  gmapGenome <- GmapGenome(fastaFile, create=TRUE, k=12)
41 41
   checkTrue(is(gmapGenome, "GmapGenome"))
42 42
 }
43 43
 
... ...
@@ -50,7 +50,7 @@ test_GmapGenome_accessors <- function() {
50 50
   dir.create(genomeDir, recursive=TRUE)
51 51
   on.exit(unlink(genomeDir, recursive=TRUE))
52 52
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
53
-                           name=genomeName, create=FALSE)
53
+                           name=genomeName, create=FALSE, k=12)
54 54
   checkIdentical(path(gmapGenome), file.path(genomeDir, genomeName))
55 55
   checkTrue(is(directory(gmapGenome), "GmapGenomeDirectory"))
56 56
   checkIdentical(genome(gmapGenome), genomeName)
Browse code

*added test to GmapGenome construct when directory is passed that doesn't exist

*added test to bam_tally to check for exception when a GmapGenome that
has not yet been created is used


git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@71412 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 22/11/2012 00:43:04
Showing 1 changed files
... ...
@@ -89,3 +89,7 @@ test_GmapGenome_spliceSites_replacement <- function() {
89 89
   x <- spliceSites(genome, name="dbSnp") <- shiftedExons
90 90
   checkIdentical(class(x), class(GRangesList()))
91 91
 }
92
+
93
+test_if_GmapGenome_dir_does_not_exist <- function() {
94
+  checkException(GmapGenome(genome="NoGenome", directory = file.path(tempdir(), "DoesNotExist")))
95
+}
Browse code

refer to txTP53 in unit test instead of undeclared tx

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@69926 bc3139a8-67e5-0310-9ffc-ced21a209358

Dan Tenenbaum authored on 28/09/2012 01:23:00
Showing 1 changed files
... ...
@@ -64,7 +64,7 @@ test_GmapGenome_spliceSites_replacement <- function() {
64 64
     eg <- org.Hs.egSYMBOL2EG[["TP53"]]
65 65
     txTP53 <- transcripts(TxDb.Hsapiens.UCSC.hg19.knownGene,
66 66
                           vals = list(gene_id = eg))
67
-    rngs <- GRanges(ranges=IRanges(start(range(tx)), end(range(tx))),
67
+    rngs <- GRanges(ranges=IRanges(start(range(txTP53)), end(range(txTP53))),
68 68
                     seqnames="chr17")
69 69
     rngs + 1e6
70 70
   }
Browse code

added test for spliceSites<- method

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@69874 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 26/09/2012 21:22:34
Showing 1 changed files
... ...
@@ -55,3 +55,37 @@ test_GmapGenome_accessors <- function() {
55 55
   checkTrue(is(directory(gmapGenome), "GmapGenomeDirectory"))
56 56
   checkIdentical(genome(gmapGenome), genomeName)
57 57
 }
58
+
59
+test_GmapGenome_spliceSites_replacement <- function() {
60
+  library("TxDb.Hsapiens.UCSC.hg19.knownGene")
61
+  txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
62
+  getTP53Range <- function() {
63
+    library(org.Hs.eg.db)
64
+    eg <- org.Hs.egSYMBOL2EG[["TP53"]]
65
+    txTP53 <- transcripts(TxDb.Hsapiens.UCSC.hg19.knownGene,
66
+                          vals = list(gene_id = eg))
67
+    rngs <- GRanges(ranges=IRanges(start(range(tx)), end(range(tx))),
68
+                    seqnames="chr17")
69
+    rngs + 1e6
70
+  }
71
+  rngTP53 <- getTP53Range()
72
+  
73
+  exonsByTx <- exonsBy(txdb, by="tx")
74
+  exonsInRegion <- exonsByTx[exonsByTx %in% rngTP53]
75
+  
76
+  ##shift coords of retrieved exons so the ranges match the 
77
+  ##region of the genome used for this example
78
+  shiftCoords <- function(x) {
79
+    x <- exonsInRegion
80
+    w <- width(x)
81
+    r <- ranges(x)
82
+    r <- r + start(rngTP53)
83
+    width(r) <- w
84
+    ranges(x) <- r
85
+    return(x)
86
+  }
87
+  shiftedExons <- shiftCoords(exonsInRegion)
88
+  genome <- TP53Genome()
89
+  x <- spliceSites(genome, name="dbSnp") <- shiftedExons
90
+  checkIdentical(class(x), class(GRangesList()))
91
+}
Browse code

*drop passing of ... arg to method snps<- eventually dispatches on

*doc'ed ... arg to GmapSnps constructor

*added aliases for snps<- when first arg is a GmapGenomeDirectory

*test case for creating a GmapGenome via a DNAStringSet was
broken. Example sequence was too short for gmap_build to work


git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@69386 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 12/09/2012 22:29:42
Showing 1 changed files
... ...
@@ -6,8 +6,10 @@ test_GmapGenome_constructor_DNAStringSet_noCreate <- function() {
6 6
 }
7 7
 
8 8
 test_GmapGenome_constructor_DNAStringSet_create <- function() {
9
-  dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
10
-  names(dna) <- "test"
9
+  set.seed(1)
10
+  seq <- paste0(sample(c("A", "C", "G", "T"), 2000, replace=TRUE),
11
+                collapse="")
12
+  dna <- Biostrings::DNAStringSet(seq)
11 13
   genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
12 14
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
13 15
   dir.create(genomeDir, recursive=TRUE)
Browse code

tests updated since if DNAStringSet obj is now used to create a GmapGenome, DNAStringSet obj needs names() set

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@69377 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 12/09/2012 18:11:41
Showing 1 changed files
... ...
@@ -1,11 +1,13 @@
1 1
 test_GmapGenome_constructor_DNAStringSet_noCreate <- function() {
2 2
   dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
3
-  gmapGenome <- GmapGenome(genome=dna, name="thing")
3
+  names(dna) <- "test"
4
+  gmapGenome <- GmapGenome(genome=dna, name="thing", create=FALSE)
4 5
   checkTrue(is(gmapGenome, "GmapGenome"))
5 6
 }
6 7
 
7 8
 test_GmapGenome_constructor_DNAStringSet_create <- function() {
8 9
   dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
10
+  names(dna) <- "test"
9 11
   genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
10 12
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
11 13
   dir.create(genomeDir, recursive=TRUE)
... ...
@@ -40,14 +42,13 @@ testGmapGenome_constructor_FastaFile_create <- function() {
40 42
 test_GmapGenome_accessors <- function() {
41 43
   genomeName <- "testGenome"
42 44
   dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
45
+  names(dna) <- "testDNAString"
43 46
   genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
44 47
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
45 48
   dir.create(genomeDir, recursive=TRUE)
46
-  
47 49
   on.exit(unlink(genomeDir, recursive=TRUE))
48 50
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
49
-                           name=genomeName, create=TRUE)
50
-
51
+                           name=genomeName, create=FALSE)
51 52
   checkIdentical(path(gmapGenome), file.path(genomeDir, genomeName))
52 53
   checkTrue(is(directory(gmapGenome), "GmapGenomeDirectory"))
53 54
   checkIdentical(genome(gmapGenome), genomeName)
Browse code

if GmapGenome constructor is called with a DNAStringSet, now requiring that object to have names set (gmap_build does not like empty names). Test added

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@69343 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 12/09/2012 00:06:17
Showing 1 changed files
... ...
@@ -9,10 +9,12 @@ test_GmapGenome_constructor_DNAStringSet_create <- function() {
9 9
   genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
10 10
   if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
11 11
   dir.create(genomeDir, recursive=TRUE)
12
-  
13 12
   on.exit(unlink(genomeDir, recursive=TRUE))
13
+  checkException(GmapGenome(genome=dna, directory=genomeDir,
14
+                            name="thing", create=TRUE))
15
+  names(dna) <- "sampleDNAStringSet"
14 16
   gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
15
-                           name="thing", create=TRUE)                           
17
+                           name="thing", create=TRUE)
16 18
   checkTrue(is(gmapGenome, "GmapGenome"))
17 19
 }
18 20
 
Browse code

exporting GmapSnps and GmapSnpDirectory

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@68698 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 21/08/2012 23:52:09
Showing 1 changed files
... ...
@@ -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")
Browse code

renaming gmapR2 to gmapR: it lives again

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@68172 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 02/08/2012 22:24:24
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,45 @@
1
+test_GmapGenome_constructor_DNAStringSet_noCreate <- function() {
2
+  dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
3
+  gmapGenome <- GmapGenome(genome=dna, name="thing")
4
+  checkTrue(is(gmapGenome, "GmapGenome"))
5
+}
6
+
7
+test_GmapGenome_constructor_DNAStringSet_create <- function() {
8
+  dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
9
+  genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
10
+  if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
11
+  dir.create(genomeDir, recursive=TRUE)
12
+  
13
+  on.exit(unlink(genomeDir, recursive=TRUE))
14
+  gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
15
+                           name="thing", create=TRUE)                           
16
+  checkTrue(is(gmapGenome, "GmapGenome"))
17
+}
18
+
19
+test_GmapGenome_constructor_BSgenome_create <- function() {
20
+  library("BSgenome.Scerevisiae.UCSC.sacCer3")
21
+  genomeName <- "yeast"  
22
+  genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
23
+  if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
24
+  dir.create(genomeDir, recursive=TRUE)  
25
+  on.exit(unlink(genomeDir, recursive=TRUE))
26
+  gmapGenome <- GmapGenome(genome=Scerevisiae, directory=genomeDir,
27
+                           name=genomeName, create=TRUE)                           
28
+  checkTrue(is(gmapGenome, "GmapGenome"))
29
+}
30
+
31
+test_GmapGenome_accessors <- function() {
32
+  genomeName <- "testGenome"
33
+  dna <- Biostrings::DNAStringSet("ACTGTGTCAG")
34
+  genomeDir <- file.path(tempdir(), as.integer(runif(1) * 1000000000))
35
+  if (file.exists(genomeDir)) unlink(genomeDir, recursive=TRUE)
36
+  dir.create(genomeDir, recursive=TRUE)
37
+  
38
+  on.exit(unlink(genomeDir, recursive=TRUE))
39
+  gmapGenome <- GmapGenome(genome=dna, directory=genomeDir,
40
+                           name=genomeName, create=TRUE)
41
+
42
+  checkIdentical(path(gmapGenome), file.path(genomeDir, genomeName))
43
+  checkTrue(is(directory(gmapGenome), "GmapGenomeDirectory"))
44
+  checkIdentical(genome(gmapGenome), genomeName)
45
+}