r paste("Experiment:", params$experiment)

#library(ggplot2)
#library(knitr)
#library(DT)
#library(XML)

xmlinfo=XML::xmlToList(XML::xmlParse(paste0(params$bcl.dir, 'RunParameters.xml')))
chemistry=xmlinfo$Chemistry
#MiniSeq High / MiniSeq Rapid High / NextSeq Mid / NextSeq High
instrument=xmlinfo$ComputerName
FlowCellInfo=xmlinfo$FlowCellRfidTag
ReagentKitInfo=xmlinfo$ReagentKitRfidTag

IndexSet=as.character(params$dlong$Plate_ID)
IndexSet[IndexSet %in% c('Plate1', 'Plate2', 'Plate3', 'Plate4')]='Winter'
IndexSet[IndexSet %in% c('Plate5', 'Plate6', 'Plate7', 'Plate8')]='Spring'
IndexSet[IndexSet %in% c('Plate9', 'Plate10', 'Plate11', 'Plate12') ]='Summer'
IndexSet[IndexSet %in% c('Plate13', 'Plate14', 'Plate15', 'Plate16')]='Fall'


IndexSetW=as.character(params$dwide$Plate_ID)
IndexSetW[IndexSetW %in% c('Plate1', 'Plate2', 'Plate3', 'Plate4')]='Winter'
IndexSetW[IndexSetW %in% c('Plate5', 'Plate6', 'Plate7', 'Plate8')]='Spring'
IndexSetW[IndexSetW %in% c('Plate9', 'Plate10', 'Plate11', 'Plate12') ]='Summer'
IndexSetW[IndexSetW %in% c('Plate13', 'Plate14', 'Plate15', 'Plate16')]='Fall'

# library(ggpubr)

r paste("BCL Directory:", xmlinfo$RunID)

r paste("Instrument:", instrument, xmlinfo$InstrumentID)

r paste("Chemistry:", chemistry)

r paste("Start Time:", xmlinfo$RunStartTimeStamp)


Sequencer metrics

params$seq.metrics %>%
knitr::kable()

FlowCell Info

data.frame(FlowCellInfo) %>%
knitr::kable()

ReagentKit Info

data.frame(ReagentKitInfo) %>%
knitr::kable()

Alignment summary

params$amp.match.summary %>% 
knitr::kable()

Results Summary

results.summary=data.frame(
    'TotalSamplesPocessed'=sum(params$samples_to_report),                         
    'Inconclusives'=sum(params$dwide$result[params$samples_to_report]=='Inconclusive'),
    'NoVirusDetected'=sum(params$dwide$result[params$samples_to_report]=='Negative'),
    'VirusDetected'=sum(params$dwide$result[params$samples_to_report]=='Positive'))
results.summary %>% 
    knitr::kable()

Plate Maps {.tabset .tabset-fade}

Plate maps (384)

psplit=split(params$dlong, IndexSet)
lapply(psplit[c('Winter','Spring', 'Summer','Fall')], function(x) {
           x%>%
#params$dlong %>%  
ggplot2::ggplot(ggplot2::aes(x=Col, y=Row, fill=log10(Count))) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(amplicon~Plate_384+Plate_ID) +
  ggplot2::scale_fill_viridis_c(option = 'plasma')+ggplot2::ggtitle(params$experiment)
    })

Tube locations (384)

psplit=split(params$dwide, IndexSetW)
lapply(psplit[c('Winter','Spring', 'Summer','Fall')], function(x) {
           x%>%
#params$dwide %>% 
ggplot2::ggplot(ggplot2::aes(x=Col, y=Row, fill=matrix_tube_present)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
    })

Swabseq Calls (384)

psplit=split(params$dwide, IndexSetW)
lapply(psplit[c('Winter','Spring', 'Summer','Fall')], function(x) {
           x%>%
#params$dwide %>% 
ggplot2::ggplot(ggplot2::aes(x=Col, y=Row, fill=result)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
    })

S2 and S2 spike QC (384)

psplit=split(params$dwide,IndexSetW)
lapply(psplit[c('Winter','Spring', 'Summer','Fall')], function(x) {
           x%>%
#params$dwide %>% 
ggplot2::ggplot(ggplot2::aes(x=Col, y=Row, fill=Stotal>cfg$coreVars$Stotal)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment) })

RPP30 QC (384)

psplit=split(params$dwide, IndexSetW)
lapply(psplit[c('Winter','Spring', 'Summer','Fall')], function(x) {
           x%>%
#params$dwide %>% 
ggplot2::ggplot(ggplot2::aes(x=Col, y=Row, fill=RPP30_Detected)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
  })

Plate maps (96)

psplit=split(params$dlong, params$dlong$Plate_384)
lapply(psplit, function(x) {
           x%>%
  ggplot2::ggplot(ggplot2::aes(x=Col96, y=Row96, fill=log10(Count))) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(amplicon~Plate_384+Plate_ID+quadrant_96) +
  ggplot2::scale_fill_viridis_c(option = 'plasma')+ggplot2::ggtitle(params$experiment)
})

Tube locations (96)

psplit=split(params$dwide, params$dwide$Plate_384)
lapply(psplit, function(x) {
           x%>%
ggplot2::ggplot(ggplot2::aes(x=Col96, y=Row96, fill=matrix_tube_present)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID+quadrant_96) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
})

S2 and S2 spike QC (96)

psplit=split(params$dwide, params$dwide$Plate_384)
lapply(psplit, function(x) {
           x%>%
ggplot2::ggplot(ggplot2::aes(x=Col96, y=Row96, fill=Stotal>500)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID+quadrant_96) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
})

RPP30 QC (96)

psplit=split(params$dwide, params$dwide$Plate_384)
lapply(psplit, function(x) {
           x%>%
ggplot2::ggplot(ggplot2::aes(x=Col96, y=Row96, fill=RPP30_Detected)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID+quadrant_96) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
})

Swabseq Calls (96)

psplit=split(params$dwide, params$dwide$Plate_384)
lapply(psplit, function(x) {
           x%>%
ggplot2::ggplot(ggplot2::aes(x=Col96, y=Row96, fill=result)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID+quadrant_96) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
})

Leave Out Tubes QC (96)

psplit=split(params$dwide, params$dwide$Plate_384)
lapply(psplit, function(x) {
           x%>%
ggplot2::ggplot(ggplot2::aes(x=Col96, y=Row96, fill=id_tubes)) + 
  ggplot2::geom_raster() +
  ggplot2::coord_equal() +
  ggplot2::facet_grid(~Plate_384+Plate_ID+quadrant_96) +
  #scale_fill_viridis_c(option = 'plasma')+
  ggplot2::ggtitle(params$experiment)
})

Results

dsummary.reduced= params$dwide%>% 
    dplyr::filter(params$samples_with_ids) %>%  
    dplyr::select(Barcode,id_tubes, Plate_96_BC,Pos96, quadrant_96, Plate_384,S2,S2_spike, RPP30,result)

dsummary.reduced %>% 
    tibble::add_column(S2_ratio= round((dsummary.reduced$S2+1)/(dsummary.reduced$S2_spike+1),digits=3),
               .before='result') %>%
    DT::datatable(options=list(pageLength=25,order=list(list(11,'desc'))))%>% 
    DT::formatStyle('id_tubes', target='row', backgroundColor=DT::styleEqual(c(TRUE), c("lightblue"))) %>%
    DT::formatStyle('result', target='row', backgroundColor=DT::styleEqual(c("Positive"), c("pink")))


joshsbloom/swabseqr documentation built on Feb. 11, 2022, 5:14 p.m.