[Phylobase-commits] r179 - branches branches/pdcgsoc branches/pdcgsoc/R pkg pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 31 21:42:00 CEST 2008


Author: pdc
Date: 2008-05-31 21:42:00 +0200 (Sat, 31 May 2008)
New Revision: 179

Added:
   branches/pdcgsoc/
Modified:
   branches/pdcgsoc/R/ReadWithNCL.R
   branches/pdcgsoc/TODO
   pkg/R/ReadWithNCL.R
   pkg/TODO
Log:
Creating a branch for Peter's GSOC contributions

Copied: branches/pdcgsoc (from rev 178, pkg)

Modified: branches/pdcgsoc/R/ReadWithNCL.R
===================================================================
--- pkg/R/ReadWithNCL.R	2008-05-26 13:58:29 UTC (rev 178)
+++ branches/pdcgsoc/R/ReadWithNCL.R	2008-05-31 19:42:00 UTC (rev 179)
@@ -82,22 +82,28 @@
 #X<-c(X)
 #print(X)
 #print(mode(X))
+## speedier removal of comments pc 13 April 2008
+X <- lapply(X, gsub, pattern = "\\[[^\\]]*\\]", replacement = "")
+
 	X<-unlist(strsplit(unlist(X),c("\n")))
 #	print(X)
 #	print(mode(X))
-    LEFT <- grep("\\[", X)
-    RIGHT <- grep("\\]", X)
-    if (length(LEFT)) {
-        for (i in length(LEFT):1) {
-            if (LEFT[i] == RIGHT[i]) {
-                X[LEFT[i]] <- gsub("\\[.*\\]", "", X[LEFT[i]])
-            } else {
-                X[LEFT[i]] <- gsub("\\[.*", "", X[LEFT[i]])
-                X[RIGHT[i]] <- gsub(".*\\]", "", X[RIGHT[i]])
-                if (LEFT[i] < RIGHT[i] - 1) X <- X[-((LEFT[i] + 1):(RIGHT[i] - 1))]
-            }
-        }
-    }
+
+## Old comment removal code
+    ## LEFT <- grep("\\[", X)
+    ## RIGHT <- grep("\\]", X)
+    ## if (length(LEFT)) {
+    ##     for (i in length(LEFT):1) {
+    ##         if (LEFT[i] == RIGHT[i]) {
+    ##             X[LEFT[i]] <- gsub("\\[.*\\]", "", X[LEFT[i]])
+    ##         } else {
+    ##             X[LEFT[i]] <- gsub("\\[.*", "", X[LEFT[i]])
+    ##             X[RIGHT[i]] <- gsub(".*\\]", "", X[RIGHT[i]])
+    ##             if (LEFT[i] < RIGHT[i] - 1) X <- X[-((LEFT[i] + 1):(RIGHT[i] - 1))]
+    ##         }
+    ##     }
+    ## }
+
     X <- gsub("ENDBLOCK;", "END;", X, ignore.case = TRUE)
     endblock <- grep("END;", X, ignore.case = TRUE)
     semico <- grep(";", X)
@@ -127,6 +133,7 @@
     STRING <- as.list(tree)
     trees <- list()
     for (i in 1:nb.tree) {
+        ## TODO tree.build and clado.build are ape functions
         obj <- if (length(grep(":", STRING[[i]]))) tree.build(STRING[[i]]) else clado.build(STRING[[i]])
         if (translation) {
             for (j in 1:length(obj$tip.label)) {

Modified: branches/pdcgsoc/TODO
===================================================================
--- pkg/TODO	2008-05-26 13:58:29 UTC (rev 178)
+++ branches/pdcgsoc/TODO	2008-05-31 19:42:00 UTC (rev 179)
@@ -10,14 +10,11 @@
    rather than "data.frame")
 
 ## Plotting
-### phylo4d objects
-  * multiPhylo4x plotting
 
 ## Data classes
 ### Tree model:
 * assigning edge and node labels -- is there/should there be an option to turn this off?  assign empty ("") labels? how about assigning the node number if there are no user-supplied labels?(mb)
 * should default node labels start at N(nTips+1), to match internal node numbers?
-* should coercing phylo4d to phylo4 give a warning message about losing data?   Should phylo4d to phylo4?  Yes(mb)
 * order: All phylo4 edge matrices are internally stored as "cladewise"/Newick traversal order.  Extend edges accessor method with optional argument that allows edges to be extracted in a different order (possibly with an attribute as in ape); need to steal 'reorder' from ape, extend for phylo4d keeping track of traits also see ape::ladderize
 * root node data characteristics (compare what OUCH does): root node doesn't have corresponding entry in the edge matrix:  ouch adds a row to the edge matrix (1-row data frame matching node column info). Not entirely clear how we should deal with this, MB has a proposal.
 * Data model: There seems to be consensus that the data model should be at least a little bit richer than a straight data frame, that we should create a new data class.  There's a draft standard in pdata.R in the current package.  
@@ -36,9 +33,6 @@
 * Still need many basic methods
 * `show()`, `summary()`, `plot()` methods can mimic `ape`'s new `multiphylo` class, though multiPhylo4d will need to match what we do for phylo4d
 
-### Documentation
-* Complete full example in vignette
-
 FOR VERSION 0.4
 =======================================================
 ### Options
@@ -60,9 +54,6 @@
     * allDescend gets tips only -- option to get list including internal nodes?
     * time slices: prune back by time ?
 
-### Documentation
-* work through Sidlauskas wiki page
-
 FUTURE DISCUSSIONS
 ==================
 ## Terminology

Modified: pkg/R/ReadWithNCL.R
===================================================================
--- pkg/R/ReadWithNCL.R	2008-05-26 13:58:29 UTC (rev 178)
+++ pkg/R/ReadWithNCL.R	2008-05-31 19:42:00 UTC (rev 179)
@@ -82,22 +82,28 @@
 #X<-c(X)
 #print(X)
 #print(mode(X))
+## speedier removal of comments pc 13 April 2008
+X <- lapply(X, gsub, pattern = "\\[[^\\]]*\\]", replacement = "")
+
 	X<-unlist(strsplit(unlist(X),c("\n")))
 #	print(X)
 #	print(mode(X))
-    LEFT <- grep("\\[", X)
-    RIGHT <- grep("\\]", X)
-    if (length(LEFT)) {
-        for (i in length(LEFT):1) {
-            if (LEFT[i] == RIGHT[i]) {
-                X[LEFT[i]] <- gsub("\\[.*\\]", "", X[LEFT[i]])
-            } else {
-                X[LEFT[i]] <- gsub("\\[.*", "", X[LEFT[i]])
-                X[RIGHT[i]] <- gsub(".*\\]", "", X[RIGHT[i]])
-                if (LEFT[i] < RIGHT[i] - 1) X <- X[-((LEFT[i] + 1):(RIGHT[i] - 1))]
-            }
-        }
-    }
+
+## Old comment removal code
+    ## LEFT <- grep("\\[", X)
+    ## RIGHT <- grep("\\]", X)
+    ## if (length(LEFT)) {
+    ##     for (i in length(LEFT):1) {
+    ##         if (LEFT[i] == RIGHT[i]) {
+    ##             X[LEFT[i]] <- gsub("\\[.*\\]", "", X[LEFT[i]])
+    ##         } else {
+    ##             X[LEFT[i]] <- gsub("\\[.*", "", X[LEFT[i]])
+    ##             X[RIGHT[i]] <- gsub(".*\\]", "", X[RIGHT[i]])
+    ##             if (LEFT[i] < RIGHT[i] - 1) X <- X[-((LEFT[i] + 1):(RIGHT[i] - 1))]
+    ##         }
+    ##     }
+    ## }
+
     X <- gsub("ENDBLOCK;", "END;", X, ignore.case = TRUE)
     endblock <- grep("END;", X, ignore.case = TRUE)
     semico <- grep(";", X)
@@ -127,6 +133,7 @@
     STRING <- as.list(tree)
     trees <- list()
     for (i in 1:nb.tree) {
+        ## TODO tree.build and clado.build are ape functions
         obj <- if (length(grep(":", STRING[[i]]))) tree.build(STRING[[i]]) else clado.build(STRING[[i]])
         if (translation) {
             for (j in 1:length(obj$tip.label)) {

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2008-05-26 13:58:29 UTC (rev 178)
+++ pkg/TODO	2008-05-31 19:42:00 UTC (rev 179)
@@ -10,14 +10,11 @@
    rather than "data.frame")
 
 ## Plotting
-### phylo4d objects
-  * multiPhylo4x plotting
 
 ## Data classes
 ### Tree model:
 * assigning edge and node labels -- is there/should there be an option to turn this off?  assign empty ("") labels? how about assigning the node number if there are no user-supplied labels?(mb)
 * should default node labels start at N(nTips+1), to match internal node numbers?
-* should coercing phylo4d to phylo4 give a warning message about losing data?   Should phylo4d to phylo4?  Yes(mb)
 * order: All phylo4 edge matrices are internally stored as "cladewise"/Newick traversal order.  Extend edges accessor method with optional argument that allows edges to be extracted in a different order (possibly with an attribute as in ape); need to steal 'reorder' from ape, extend for phylo4d keeping track of traits also see ape::ladderize
 * root node data characteristics (compare what OUCH does): root node doesn't have corresponding entry in the edge matrix:  ouch adds a row to the edge matrix (1-row data frame matching node column info). Not entirely clear how we should deal with this, MB has a proposal.
 * Data model: There seems to be consensus that the data model should be at least a little bit richer than a straight data frame, that we should create a new data class.  There's a draft standard in pdata.R in the current package.  
@@ -36,9 +33,6 @@
 * Still need many basic methods
 * `show()`, `summary()`, `plot()` methods can mimic `ape`'s new `multiphylo` class, though multiPhylo4d will need to match what we do for phylo4d
 
-### Documentation
-* Complete full example in vignette
-
 FOR VERSION 0.4
 =======================================================
 ### Options
@@ -60,9 +54,6 @@
     * allDescend gets tips only -- option to get list including internal nodes?
     * time slices: prune back by time ?
 
-### Documentation
-* work through Sidlauskas wiki page
-
 FUTURE DISCUSSIONS
 ==================
 ## Terminology



More information about the Phylobase-commits mailing list