Skip to content

Commit

Permalink
cran check related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jotech committed Jan 6, 2016
1 parent d953ad0 commit 8ce106f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Depends:
deSolve (>= 1.12),
Matrix (>= 1.2)
Imports:
glpkAPI,
igraph,
methods,
utils,
stats,
graphics,
Rcpp
Suggests:
glpkAPI,
sybilSBML,
igraph,
knitr,
rmarkdown
LinkingTo: Rcpp,
Expand Down
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export(diffuseR)
export(emptyHood)
export(evalArena)
export(extractMed)
export(findFeeding)
export(flushSubs)
export(getArena)
export(getCorrM)
Expand Down Expand Up @@ -77,6 +78,7 @@ exportMethods(diffuseR)
exportMethods(emptyHood)
exportMethods(evalArena)
exportMethods(extractMed)
exportMethods(findFeeding)
exportMethods(flushSubs)
exportMethods(getArena)
exportMethods(getCorrM)
Expand Down Expand Up @@ -112,6 +114,15 @@ importFrom(graphics,par)
importFrom(graphics,points)
importFrom(graphics,segments)
importFrom(graphics,text)
importFrom(igraph,E)
importFrom(igraph,V)
importFrom(igraph,add.edges)
importFrom(igraph,degree)
importFrom(igraph,delete.edges)
importFrom(igraph,delete.vertices)
importFrom(igraph,graph.empty)
importFrom(igraph,layout_with_fr)
importFrom(igraph,vcount)
importFrom(stats,cor)
importFrom(stats,dist)
importFrom(stats,hclust)
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BacArena v1.0.1 (Release date: 2016-01-05)
BacArena v1.0.1 (Release date: 2016-01-06)
=============

Changes:
Expand Down
20 changes: 11 additions & 9 deletions R/Arena.R
Original file line number Diff line number Diff line change
Expand Up @@ -1496,16 +1496,18 @@ setMethod("statPheno", "Eval", function(object, type_nr=1, phenotype_nr, dict=NU
#' @description The generic function \code{findFeeding}
#' @export
#' @rdname findFeeding
#' @import igraph
#' @importFrom igraph graph.empty add.edges delete.edges delete.vertices V E degree vcount layout_with_fr
#'
#' @param object An object of class Eval.
#' @param tcut Integer giving the minimal mutual occurence ot be considered (dismiss very seldom feedings)
#' @param scut List of substance names which should be ignored
#' @param legendpos A character variable declaring the position of the legend
#' @param dict List defining new substance names. List entries are intepreted as old names and the list names as the new ones.
#' @return Graph (igraph)
#'
setGeneric("findFeeding", function(object, dict=NULL, tcut=5, scut=list(), legendpos="topleft"){standardGeneric("findFeeding")})
#' @export
#' @rdname findFeeding
setGeneric("findFeeding", function(object, dict=NULL, tcut=5, scut=list(), legendpos="topleft"){standardGeneric("findFeeding")})
setMethod("findFeeding", "Eval", function(object, dict=NULL, tcut=5, scut=list(), legendpos="topleft"){

# possible problem inactive phenotype is not mentioned in object@phenotypes...
Expand Down Expand Up @@ -1554,8 +1556,8 @@ setMethod("findFeeding", "Eval", function(object, dict=NULL, tcut=5, scut=list()
# graph
pindex <- rownames(mat_phen)# phenotype index
cindex <- colnames(res) # substance color index
g <-graph.empty(n=length(pindex), directed=TRUE)
V(g)$name <- gsub("pheno","",pindex)
g <-igraph::graph.empty(n=length(pindex), directed=TRUE)
igraph::V(g)$name <- gsub("pheno","",pindex)


# 3) Combinatorics: check for all pairs of phenotypes if they
Expand All @@ -1580,7 +1582,7 @@ setMethod("findFeeding", "Eval", function(object, dict=NULL, tcut=5, scut=list()
new_edge <- c(which(pindex==combi[,i][1]), which(pindex==combi[,i][2]))
}else new_edge <- c(which(pindex==combi[,i][2]), which(pindex==combi[,i][1]))
col <- colpal3[which(cindex == colnames(feeding)[x])]
g <<- add.edges(g, new_edge, color=col, weight=length(co_occ))
g <<- igraph::add.edges(g, new_edge, color=col, weight=length(co_occ))
})
}
#cat("\npossible cross feeding at time steps\n")
Expand All @@ -1590,11 +1592,11 @@ setMethod("findFeeding", "Eval", function(object, dict=NULL, tcut=5, scut=list()
}
}

g <- delete.edges(g, which(E(g)$weight<tcut)) # delete seldom feedings
g <- delete.vertices(g, which(degree(g, mode="all") == 0)) # delete unconnected
g <- igraph::delete.edges(g, which(igraph::E(g)$weight<tcut)) # delete seldom feedings
g <- igraph::delete.vertices(g, which(igraph::degree(g, mode="all") == 0)) # delete unconnected

if(vcount(g) >= 2){
plot(g, layout=layout_with_fr, vertex.size=5,
if(igraph::vcount(g) >= 2){
plot(g, layout=igraph::layout_with_fr, vertex.size=5,
edge.arrow.size=0.3, edge.width=E(g)$weight/10)
legend(legendpos,legend=cindex, col=colpal3, pch=19, cex=0.7)
}
Expand Down
4 changes: 3 additions & 1 deletion R/Stuff.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ estimate_lrw <- function(grid_n, grid_m){
#'
#' @return Returns an object of class \code{Eval} which can be used for subsequent analysis steps.
#' @examples
#' \donttest{
#' sim <- openArena()
#' evalArena(sim, time=7, phencol = TRUE,
#' plot_items=c("Population", "EX_o2(e)", "EX_for(e)",
#' "EX_glc(e)", "EX_for(e)"))
#'}
openArena <- function(){
data(Ec_core, envir = environment())
bac = Bac(model=Ec_core, growtype="exponential")
bac = Bac(model=Ec_core, type="E. coli")
arena = Arena(n=50, m=50, stir=F, Lx=0.0125, Ly=0.0125)
addOrg(arena, bac, amount=50)
addSubs(arena, smax=0, difspeed=6.7e-6)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Existing genome-scale metabolic models can be used to simulate growth and intera
In BacArena two well established methods are merged: a) Flux balance analysis to predict the activity of
metabolic reactions and b) Agent based modelling in order to provide an environment.

It has been efficiently implemented in R language (with some C++ routines) and is freely available [CRAN](https://cran.r-project.org/web/packages/BacArena/index.html).
It has been efficiently implemented in R language (with some C++ routines) and is freely available [CRAN](https://cran.r-project.org/package=BacArena).

Features:
- Each organism is represented individually
Expand Down
2 changes: 1 addition & 1 deletion examples/pao_sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ library(RcppArmadillo)
library(sybil)
library(compiler)
setwd("/Users/euba/GitRep/BacArena/")
#setwd("uni/bacarena")
#setwd("~/uni/bacarena")
#setwd('P:/GitRep/BacArena')
#setwd('P:/GitRep/BacArena')

Expand Down

0 comments on commit 8ce106f

Please sign in to comment.