Skip to content

Commit

Permalink
resolve bug pass fit
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed Oct 23, 2019
1 parent 07cf578 commit 10720d8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ Imports:
ttBulk,
testthat,
benchmarkme,
multidplyr
multidplyr,
KernSmooth,
cluster,
survival
Remotes:
github::stemangiola/ttBulk, github::stan-dev/rstantools, github::tidyverse/multidplyr
LinkingTo:
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ importFrom(tidyr,nest)
importFrom(tidyr,separate)
importFrom(tidyr,spread)
importFrom(tidyr,unnest)
importFrom(ttBulk,normalise_abundance)
importFrom(ttBulk,scale_abundance)
useDynLib(ppcSeq, .registration = TRUE)
14 changes: 7 additions & 7 deletions R/ppcSeq.R
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ check_if_any_NA = function(input.df, sample_column, gene_column, value_column, s
#' @importFrom magrittr multiply_by
#' @importFrom purrr map2
#' @importFrom purrr map_int
#' @importFrom ttBulk normalise_abundance
#' @importFrom ttBulk scale_abundance
#'
#' @param my_df A tibble including a gene name column | sample name column | read counts column | covariates column
#' @param formula A formula
Expand Down Expand Up @@ -1149,7 +1149,7 @@ format_input = function(input.df, formula, sample_column, gene_column, value_col
#' @importFrom magrittr multiply_by
#' @importFrom purrr map2
#' @importFrom purrr map_int
#' @importFrom ttBulk normalise_abundance
#' @importFrom ttBulk scale_abundance
#' @importFrom benchmarkme get_ram
#' @importFrom magrittr multiply_by
#'
Expand Down Expand Up @@ -1289,7 +1289,7 @@ ppc_seq = function(input.df,
# Build better scales for the inference
exposure_rate_multiplier =
my_df %>%
normalise_abundance(!!sample_column,!!gene_column,!!value_column) %>%
scale_abundance(!!sample_column,!!gene_column,!!value_column) %>%
distinct(!!sample_column, TMM, multiplier) %>%
mutate(l = multiplier %>% log) %>%
summarise(l %>% sd) %>%
Expand All @@ -1298,7 +1298,7 @@ ppc_seq = function(input.df,
# Build better scales for the inference
intercept_shift_scale =
my_df %>%
normalise_abundance(!!sample_column,!!gene_column,!!value_column) %>%
scale_abundance(!!sample_column,!!gene_column,!!value_column) %>%
mutate(cc =
!!as.symbol(sprintf(
"%s normalised", quo_name(value_column)
Expand Down Expand Up @@ -1376,6 +1376,7 @@ ppc_seq = function(input.df,
adj_prob_theshold = adj_prob_theshold_2, # If check only deleterious is one side test
# * 2 because we just test one side of the distribution
how_many_posterior_draws = how_many_posterior_draws_2,
pass_fit = pass_fit,
to_exclude = to_exclude,
save_generated_quantities = save_generated_quantities,
tol_rel_obj = tol_rel_obj,
Expand All @@ -1387,11 +1388,10 @@ ppc_seq = function(input.df,
merge_results(res_discovery, res_test, formula, gene_column, value_column, sample_column, do_check_only_on_detrimental) %>%

# Add fit attribute if any
add_attr(res_test %>% attr("fit"), "fit") %>%
add_attr(res_discovery %>% attr("fit"), "fit 1") %>%
add_attr(res_test %>% attr("fit"), "fit 2") %>%

# Add total draws
add_attr(res_test %>% attr("total_draws"), "total_draws")



}
2 changes: 1 addition & 1 deletion tests/testthat/test-ppcSeq.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test_that("VB post approx",{
approximate_posterior_inference = T,
approximate_posterior_analysis = T,
how_many_negative_controls = 50,
cores=1
cores=1,pass_fit = T
)

expect_equal(
Expand Down

0 comments on commit 10720d8

Please sign in to comment.