tests/testthat/test-alluvialClones.R

# test script for alluvialClones.R - testcases are NOT comprehensive!

test_that("alluvialClones works", {

  data("scRep_example")
  test_obj <- combineExpression(getdata("combineContigs", "combined"), scRep_example)
  test_obj$Patient <- substr(test_obj$orig.ident,1,3)
  test_obj$Type <- substr(test_obj$orig.ident,4,4)
  
  expect_doppelganger(
    "alluvialClones_plot",
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   y.axes = c("Patient", "ident"), 
                   color = "Type")
  )
  
  expect_doppelganger(
    "alluvialClones_TRB_plot",
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   chain = "TRB",
                   y.axes = c("Patient", "ident"), 
                   color = "Type")
  )
  
  expect_doppelganger(
    "alluvialClones_nocolor_plot",
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   y.axes = c("Patient", "ident"), 
                   color = NULL)
  )
  
  expect_doppelganger(
    "alluvialClones_alpha_plot",
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   y.axes = c("Type", "ident"), 
                   alpha = "Patient")
  )
  
  expect_doppelganger(
    "alluvialClones_alphapluscolor_plot",
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   y.axes = c("Type", "ident"), 
                   alpha = "Patient", 
                   color = "Type")
  )

  
  expect_doppelganger(
    "alluvialClones_facet_plot",
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   y.axes = c("Patient", "ident"), 
                   color = "ident", 
                   facet = "Type")
  )
  
  
  expect_equal(
    alluvialClones(test_obj, 
                   cloneCall = "aa", 
                   y.axes = c("Patient", "ident", "Type"), 
                   exportTable = TRUE),
    getdata("seuratFunctions", "alluvialClones_exportTable")
  )
})
ncborcherding/scRepertoire documentation built on May 13, 2024, 3:02 a.m.