Permalink
Browse files

Major updates

Preparing for release
  • Loading branch information...
1 parent 513c81c commit 9846977f7db13638b08cae898649fd8df7ca7c2f @cheeyeelim committed Nov 29, 2015
Showing with 2,372 additions and 1,161 deletions.
  1. +12 −6 DESCRIPTION
  2. +5 −7 NAMESPACE
  3. +0 −43 R/RcppExports.R
  4. +35 −21 R/compression.R
  5. +15 −33 R/data_desc.R
  6. +26 −212 R/general.R
  7. +40 −0 R/methods.R
  8. +72 −48 R/model_modification.R
  9. +108 −64 R/output_format.R
  10. +20 −20 R/rand_model.R
  11. +60 −7 R/score_calculation.R
  12. +211 −103 R/search.R
  13. +0 −1 README.md
  14. +18 −0 booltrainer.Rproj
  15. BIN data/bon_moig_istate.rda
  16. BIN data/bon_sstate.rda
  17. BIN data/bon_wilson_istate.rda
  18. BIN data/bonkrum_geneid_map.rda
  19. BIN data/example_models.rda
  20. BIN data/krum_sstate.rda
  21. BIN data/krum_wilson_istate.rda
  22. BIN data/moig_raw_data.rda
  23. BIN data/real_param.rda
  24. +0 −17 man/bin_to_real.Rd
  25. +0 −19 man/bon_moig_istate.Rd
  26. +15 −0 man/check_and.Rd
  27. +0 −19 man/check_bmodel.Rd
  28. +0 −21 man/equi_model.Rd
  29. +14 −0 man/example_models.Rd
  30. +2 −2 man/gen_one_rmodel.Rd
  31. +2 −2 man/gen_randata.Rd
  32. +1 −3 man/gen_randata_bn.Rd
  33. +2 −2 man/gen_singlerule.Rd
  34. +2 −2 man/gen_two_rmodel.Rd
  35. +1 −3 man/get_encodings.Rd
  36. +4 −4 man/grow_bmodel.Rd
  37. +17 −0 man/man_dist.Rd
  38. +0 −18 man/match_state.Rd
  39. +0 −17 man/match_state_loop.Rd
  40. +1 −1 man/minmod_model.Rd
  41. +3 −5 man/model_consensus.Rd
  42. +1 −3 man/model_dist.Rd
  43. +1 −3 man/model_setdiff.Rd
  44. +0 −24 man/model_simplify.Rd
  45. +15 −10 man/model_train.Rd
  46. +31 −0 man/model_train_sa.Rd
  47. +0 −17 man/moig_data.Rd
  48. +0 −17 man/outcyto_model.Rd
  49. +4 −2 man/outgenysis_model.Rd
  50. +21 −0 man/outgraph_model.Rd
  51. +5 −5 man/{outcyto_stategraph.Rd → outstate_graph.Rd}
  52. +0 −17 man/param_bimodal.Rd
  53. +19 −0 man/plotBM.Rd
  54. +0 −17 man/rcpp_ham_dist.Rd
  55. +0 −15 man/rcpp_m_score.Rd
  56. +0 −17 man/rcpp_man_dist.Rd
  57. +0 −14 man/real_param.Rd
  58. +5 −5 man/{moig_raw_data.Rd → wilson_raw_data.Rd}
  59. +17 −0 man/wilson_raw_rnaseq.Rd
  60. BIN src/BoolTraineR.dll
  61. +0 −47 src/RcppExports.cpp
  62. BIN src/RcppExports.o
  63. +0 −56 src/general.cpp
  64. +0 −192 src/score_calculation.cpp
  65. BIN src/score_calculation.o
  66. BIN src/simulation.o
  67. +479 −0 vignettes/booltrainer.Rmd
  68. +594 −0 vignettes/booltrainer.html
  69. +494 −0 vignettes/booltrainer.md
  70. BIN vignettes/booltrainer.pdf
  71. BIN vignettes/booltrainer_files/figure-markdown_github/unnamed-chunk-15-1.png
  72. BIN vignettes/booltrainer_files/figure-markdown_github/unnamed-chunk-21-1.png
  73. BIN vignettes/booltrainer_files/figure-markdown_github/unnamed-chunk-29-1.png
View
@@ -1,12 +1,13 @@
Package: BoolTraineR
Type: Package
Title: Tools For Training and Analysing Asynchronous Boolean Models
-Version: 1.0.1
+Version: 1.1.1
Date: 2015-10-22
Author: Chee Yee Lim
-Maintainer: Chee Yee Lim <cyl49@cam.ac.uk> <cheeyee.lim@gmail.com>
-Description: This package contains tools for Boolean model manipulation, as well as the search for the best Boolean model.
-Depends:
+Maintainer: Chee Yee Lim <cyl49@cam.ac.uk>
+Description: This package contains tools for inferring asynchronous Boolean
+ models from single-cell expression data.
+Depends:
R (>= 3.0.3),
methods
Imports:
@@ -15,8 +16,13 @@ Imports:
foreach (>= 1.4.1),
doParallel (>= 1.0.8),
poweRlaw (>= 0.30.0),
- MASS (>= 7.3-44),
- diptest (>= 0.75-7)
+ diptest (>= 0.75-7),
+ igraph (>= 1.0.1)
LinkingTo: Rcpp
License: GPL-3
LazyData: true
+Suggests:
+ knitr,
+ rmarkdown
+VignetteBuilder: knitr
+RoxygenNote: 5.0.1
View
@@ -2,16 +2,13 @@
export(BoolModel)
export(amat_to_bm)
-export(bin_to_real)
export(bm_to_amat)
export(bm_to_df)
export(calc_mscore)
export(calc_roc)
-export(check_bmodel)
export(compress_bmodel)
export(decompress_bmodel)
export(df_to_bm)
-export(equi_model)
export(gen_randata)
export(gen_randata_bn)
export(gen_two_rmodel)
@@ -21,14 +18,15 @@ export(grow_bmodel)
export(initialise_data)
export(initialise_model)
export(initialise_raw_data)
-export(model_consensus)
+export(minmod_model)
export(model_dist)
export(model_setdiff)
export(model_train)
-export(outcyto_model)
-export(outcyto_stategraph)
+export(model_train_sa)
export(outgenysis_model)
-export(param_bimodal)
+export(outgraph_model)
+export(outstate_graph)
+export(plotBM)
export(printBM)
export(simulate_model)
export(unique_raw_data)
View
@@ -1,49 +1,6 @@
# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
-#' @title Find a match between two data frames.
-#'
-#' @description
-#' (&&&Not for public use&&&)This function finds a match between two df of states. Used in match_state(). Return an row index vector indicating which row of mstate matches the rows in xstate.
-#'
-#' @param mstate data frame. It should be a state(row) x gene(column) df.
-#' @param xstate data frame. It should be a state(row) x gene(column) df.
-match_state_loop <- function(mstate, xstate) {
- .Call('BoolTraineR_match_state_loop', PACKAGE = 'BoolTraineR', mstate, xstate)
-}
-
-#' @title Calculating pairwise scores between model and data states.
-#'
-#' @description
-#' This function calculates the pairwise scores between each row of model and data states. The score is calculated using a custom binary distance measure.
-#'
-#' @param x_df matrix. It should be numerical matrix of model states.
-#' @param y_df matrix. It should be numerical matrix of data states.
-rcpp_man_dist <- function(x_df, y_df) {
- .Call('BoolTraineR_rcpp_man_dist', PACKAGE = 'BoolTraineR', x_df, y_df)
-}
-
-#' @title Calculating Hamming pairwise scores between model and data states.
-#'
-#' @description
-#' This function calculates the pairwise scores between each row of model and data states. The score is calculated using a custom binary distance measure.
-#'
-#' @param x_df matrix. It should be logical matrix of model states.
-#' @param y_df matrix. It should be logical matrix of data states.
-rcpp_ham_dist <- function(x_df, y_df) {
- .Call('BoolTraineR_rcpp_ham_dist', PACKAGE = 'BoolTraineR', x_df, y_df)
-}
-
-#' @title Inner core for m_score()
-#'
-#' @description
-#' This function takes in a df with columns ranked wrt each row, and try to assign each row to a unique column without repetition.
-#'
-#' @param x_df matrix. Matrix with columns ranked wrt each row.
-rcpp_m_score <- function(x_df) {
- .Call('BoolTraineR_rcpp_m_score', PACKAGE = 'BoolTraineR', x_df)
-}
-
#' @title Calculating validation scores between two adjacency matrices
#'
#' @description
View
@@ -5,39 +5,53 @@
#' This function limits the number of possible variables in the model to 999.
#'
#' @param bmodel S4 BoolModel object.
-#' @param inter_bool logical. Indicate whether to consider AND terms.
#'
#' @export
-get_encodings = function(bmodel, inter_bool)
+get_encodings = function(bmodel)
{
+ and_bool = check_and(bmodel)
+
#Get all possible terms.
svar = bmodel@target_var
- if(inter_bool)
+ if(and_bool)
{
dvar = sapply(combn(svar, 2, simplify=F), function(x) paste(x, collapse='&')) #get all possible interacting pairs.
dvar = c(dvar, sapply(combn(svar, 2, simplify=F), function(x) paste(rev(x), collapse='&'))) #get the reversed pattern as well.
+
+ term_pool = c(svar, dvar)
+ term_pool = c('0', term_pool, '!0', paste('!', term_pool, sep='')) #add in inh terms.
+
+ #Generate index for activation terms.
+ num_pool = seq(1, length(svar)+1) #get numbers for svar.
+ num_pool = c(num_pool, as.vector(replicate(2, seq(max(num_pool)+1, max(num_pool)+(length(dvar)/2))))) #get numbers for both forward and reverse dvar.
+
+ #Generate index for inhibition terms.
+ num_pool = c(num_pool, seq(max(num_pool)+1, max(num_pool)+length(svar)+1)) #get numbers for svar.
+ num_pool = c(num_pool, as.vector(replicate(2, seq(max(num_pool)+1, max(num_pool)+(length(dvar)/2))))) #get numbers for both forward and reverse dvar.
+
+ num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==1, paste('0', x, sep=''), x))) #convert single digit to double digit.
+ num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==2, paste('0', x, sep=''), x))) #convert double digit to triple digit.
+ num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==3, paste('0', x, sep=''), x))) #convert triple digit to quadruple digit.
+
+ names(num_pool) = term_pool
} else
{
- dvar = c()
+ term_pool = svar
+ term_pool = c('0', term_pool, '!0', paste('!', term_pool, sep='')) #add in inh terms.
+
+ #Generate index for activation terms.
+ num_pool = seq(1, length(svar)+1) #get numbers for svar.
+
+ #Generate index for inhibition terms.
+ num_pool = c(num_pool, seq(max(num_pool)+1, max(num_pool)+length(svar)+1)) #get numbers for svar.
+
+ num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==1, paste('0', x, sep=''), x))) #convert single digit to double digit.
+ num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==2, paste('0', x, sep=''), x))) #convert double digit to triple digit.
+ num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==3, paste('0', x, sep=''), x))) #convert triple digit to quadruple digit.
+
+ names(num_pool) = term_pool
}
- term_pool = c(svar, dvar)
- term_pool = c('0', term_pool, '!0', paste('!', term_pool, sep='')) #add in inh terms.
-
- #Generate index for activation terms.
- num_pool = seq(1, length(svar)+1) #get numbers for svar.
- num_pool = c(num_pool, as.vector(replicate(2, seq(max(num_pool)+1, max(num_pool)+(length(dvar)/2))))) #get numbers for both forward and reverse dvar.
-
- #Generate index for inhibition terms.
- num_pool = c(num_pool, seq(max(num_pool)+1, max(num_pool)+length(svar)+1)) #get numbers for svar.
- num_pool = c(num_pool, as.vector(replicate(2, seq(max(num_pool)+1, max(num_pool)+(length(dvar)/2))))) #get numbers for both forward and reverse dvar.
-
- num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==1, paste('0', x, sep=''), x))) #convert single digit to double digit.
- num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==2, paste('0', x, sep=''), x))) #convert double digit to triple digit.
- num_pool = unname(sapply(num_pool, function(x) ifelse(nchar(x)==3, paste('0', x, sep=''), x))) #convert triple digit to quadruple digit.
-
- names(num_pool) = term_pool
-
stopifnot(all(!is.na(names(num_pool))))
stopifnot(all(!is.na(term_pool)))
View
@@ -31,24 +31,6 @@ NULL
#' @usage data(bon_istate)
NULL
-#' @title Initial state from Moignard et al.
-#'
-#' @description
-#' An intial state obtained from data in Moignard et al, determined by taking colMeans over unique rows, and rounding the means to 0-1.
-#' Values for genes that are missing in Moignard et al, but are present in Bonzanni et al, are determined by taking values from the original initial state supplied in Bonzanni et al.
-#' It contains a set of Boolean values for 20 genes.
-#'
-#' @format
-#' A data frame with 1 row and 20 columns.
-#'
-#' Rows: each row consists of 1 set of Boolean state.
-#' Columns: each column is for 1 gene/variable.
-#'
-#' @docType data
-#' @name bon_moig_istate
-#' @usage data(bon_moig_istate)
-NULL
-
#' @title Myeloid Boolean Model from Krumsiek et al.
#'
#' @description
@@ -82,47 +64,47 @@ NULL
#' @usage data(krum_istate)
NULL
-#' @title Raw single cell qRT-PCR expression data from Moignard et al.
+#' @title Raw single cell qRT-PCR expression data from Wilson et al.
#'
#' @description
#' A raw single cell expression data obtained from multiple cell types.
#'
#' @format
-#' A data frame with 597 rows and 18 columns.
+#' A data frame with 1626 rows and 44 columns.
#'
#' Rows: each row consists of raw expression values from 1 cell.
#' Columns: each column is for 1 gene/variable.
#'
#' @docType data
-#' @name moig_raw_data
-#' @usage data(moig_raw_data)
+#' @name wilson_raw_data
+#' @usage data(wilson_raw_data)
NULL
-#' @title Discretised single cell qRT-PCR expression data from Moignard et al.
+#' @title Raw single cell RNAseq expression data from Wilson et al.
#'
#' @description
-#' A discretised single cell expression data obtained from multiple cell types.
+#' A raw single cell expression data obtained from multiple cell types.
#'
#' @format
-#' A data frame with 597 rows and 18 columns.
+#' A data frame with 96 rows and 38498 columns.
#'
-#' Rows: each row consists of discretised expression values from 1 cell.
+#' Rows: each row consists of raw expression values from 1 cell.
#' Columns: each column is for 1 gene/variable.
#'
#' @docType data
-#' @name moig_data
-#' @usage data(moig_data)
+#' @name wilson_raw_rnaseq
+#' @usage data(wilson_raw_rnaseq)
NULL
-#' @title Estimated parameters from Wilson et al. data
+#' @title Example Boolean Models used in the vignette
#'
#' @description
-#' A list of parameters (based on log normal distribution) estimated from Wilson et al. single-cell qPCR expression data.
+#' 3 Boolean models used in the examples of the vignette.
#'
#' @format
-#' A list with 4 numeric vectors, all_mu1, all_mu2, all_sig1, all_sig2. Note that each element in the vector is estimated from a single gene.
+#' Each Boolean model is a BoolModel object.
#'
#' @docType data
-#' @name real_param
-#' @usage data(real_param)
+#' @name example_models
+#' @usage data(example_models)
NULL
Oops, something went wrong.

0 comments on commit 9846977

Please sign in to comment.