## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE
)

## ----'install', eval = FALSE--------------------------------------------------
#  if (!requireNamespace("BiocManager", quietly = TRUE)) {
#      install.packages("BiocManager")
#  }
#  
#  BiocManager::install("scifer")

## ----setup--------------------------------------------------------------------
library(ggplot2)
library(scifer)

## ----check_fcs, message=FALSE-------------------------------------------------
fcs_data <- fcs_processing(
  folder_path = system.file("/extdata/fcs_index_sorting",package = "scifer"),
  compensation = FALSE, plate_wells = 96,
  probe1 = "FSC.A", probe2 = "SSC.A",
  posvalue_probe1 = 600, posvalue_probe2 = 400)

fcs_plot(fcs_data)

## ----channels-----------------------------------------------------------------
colnames(fcs_data)

## ----check_fcs_noprobe, message=FALSE, warning=FALSE--------------------------
fcs_data <- fcs_processing(
  folder_path = system.file("/extdata/fcs_index_sorting",package = "scifer"),
  compensation = FALSE, plate_wells = 96,
  probe1 = "FSC.A", probe2 = "SSC.A",
  posvalue_probe1 = 0, posvalue_probe2 = 0)

fcs_plot(fcs_data)

## ----check_fcs_probe, message=FALSE, warning=FALSE----------------------------
fcs_data <- fcs_processing(
  folder_path = system.file("/extdata/fcs_index_sorting",package = "scifer"),
  compensation = FALSE, plate_wells = 96,
  probe1 = "Pre.F", probe2 = "Post.F",
  posvalue_probe1 = 600, posvalue_probe2 = 400)

fcs_plot(fcs_data)

## ----check_fcs_probe_compensated, message=FALSE, warning=FALSE----------------
fcs_data <- fcs_processing(
  folder_path = system.file("/extdata/fcs_index_sorting",package = "scifer"),
  compensation = TRUE, plate_wells = 96,
  probe1 = "Pre.F", probe2 = "Post.F",
  posvalue_probe1 = 600, posvalue_probe2 = 400)

fcs_plot(fcs_data)

## ----specificity, message=FALSE, warning=FALSE--------------------------------
unique(fcs_data$specificity)

## ----bcr_sequence, warning=FALSE----------------------------------------------
## Read abif using sangerseqR package
abi_seq <- sangerseqR::read.abif(
  system.file("/extdata/sorted_sangerseq/E18_C1/A1_3_IgG_Inner.ab1", 
              package="scifer"))
## Summarise using summarise_abi_file()
summarised <- summarise_abi_file(abi_seq)
head(summarised[["summary"]])
head(summarised[["quality_score"]])

## ----bcr_sequences, warning=FALSE---------------------------------------------

sf <- summarise_quality(
  folder_sequences=system.file("extdata/sorted_sangerseq", package="scifer"),
  secondary.peak.ratio=0.33, trim.cutoff=0.01, processor = 1)

## ----bcr_seq_columns, warning=FALSE-------------------------------------------
## Print names of all the variables 
colnames(sf[["summaries"]])

## ----bcr_seq_table, warning=FALSE---------------------------------------------
## Print table
head(sf[["summaries"]][4:10])

## ----eval=FALSE---------------------------------------------------------------
#  quality_report(
#    folder_sequences = system.file("extdata/sorted_sangerseq", package="scifer"),
#    outputfile = "QC_report.html", output_dir = "~/full/path/to/your/location",
#    folder_path_fcs = system.file("extdata/fcs_index_sorting",
#                                  package = "scifer"),
#    probe1 = "Pre.F", probe2 = "Post.F",
#    posvalue_probe1 = 600, posvalue_probe2 = 400)

## ----session_info-------------------------------------------------------------
sessionInfo()

