Skip to content

Commit

Permalink
change pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed Feb 7, 2024
1 parent 7df194c commit 32b7488
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions tests/testthat/test-bulk_methods_SummarizedExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ context('Bulk methods SummarizedExperiment')
data("se_mini")
data("breast_tcga_mini_SE")

input_df = se_mini |> tidybulk() |> as_tibble() |> setNames( c( "b","a", "c", "Cell type", "time" , "condition", "days", "dead", "entrez"))
input_df_breast = setNames( breast_tcga_mini_SE |> tidybulk() |> as_tibble(), c( "b", "a","c", "c norm", "call" ))

input_df =
se_mini |>
tidybulk() |>
as_tibble() |>
setNames( c( "b","a", "c", "Cell type", "time" , "condition", "days", "dead", "entrez"))

input_df_breast =
breast_tcga_mini_SE |>
tidybulk() |>
as_tibble() |>
setNames( c( "b", "a","c", "c norm", "call" ))


test_that("tidybulk SummarizedExperiment conversion",{

Expand All @@ -28,12 +39,28 @@ test_that("tidybulk SummarizedExperiment conversion",{

test_that("tidybulk SummarizedExperiment normalisation manual",{

res = tidybulk(tidybulk:::tidybulk_to_SummarizedExperiment(scale_abundance(tidybulk(se) |> identify_abundant())))

res2 = tidybulk(se) |> identify_abundant() |> scale_abundance()
res = se |>
tidybulk() |>
identify_abundant() |>
scale_abundance() |>
tidybulk:::tidybulk_to_SummarizedExperiment() |>
tidybulk()

res2 =
se |>
tidybulk() |>
identify_abundant() |>
scale_abundance()

res |>
distinct(.sample, multiplier) |>
pull(multiplier)

res2 |>
distinct(.sample, multiplier) |>
pull(multiplier)

res |> distinct(.sample, multiplier) |> pull(multiplier)
res2 |> distinct(.sample, multiplier) |> pull(multiplier)


expect_equal(
Expand All @@ -55,6 +82,7 @@ test_that("tidybulk SummarizedExperiment normalisation manual",{

test_that("tidybulk SummarizedExperiment normalisation",{


res = se |> identify_abundant() |> scale_abundance()

expect_equal(
Expand Down Expand Up @@ -565,6 +593,7 @@ test_that("impute missing",{
tidybulk:::tidybulk_to_SummarizedExperiment(a, b, c) |>
impute_missing_abundance( ~ condition )


list_SE = SummarizedExperiment::assays(res) |> as.list()

list_SE[[1]]["TNFRSF4", "SRR1740034"] |>
Expand Down

0 comments on commit 32b7488

Please sign in to comment.