{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)
Generating a quick report for loxcodeR analysis
library(loxcoder) library(shiny) library(DT)
saveRDS(NN156_small, file="Loxcode_experiments/NN156_small.rds") saveRDS(NN156, file="Loxcode_experiments/NN156.rds") saveRDS(NN167, file="Loxcode_experiments/NN167.rds") saveRDS(NN167_small, file="Loxcode_experiments/NN167_small.rds")
NN156_small <- readRDS(file="Loxcode_experiments/NN156_small.rds") NN156 <- readRDS(file="Loxcode_experiments/NN156.rds") NN167 <- readRDS(file="Loxcode_experiments/NN167.rds")
# # load distance maps loxcoder::load_origin_distmaps('/wehisan/general/user_managed/grpu_naik.s_2/TW/maps/origin/') loxcoder::load_pair_distmaps('/wehisan/general/user_managed/grpu_naik.s_2/TW/maps/origin/') #load sample sheet and fastq directory samplesheet = "/wehisan/general/user_managed/grpu_naik.s_2/2019_Sequencing_Runs/NN156/191007_M04529_0207_000000000-CNWC9/fastq/nn156_samples_small.xlsx" # Samplenames fastq_dir = "/wehisan/general/user_managed/grpu_naik.s_2/2019_Sequencing_Runs/NN156/191007_M04529_0207_000000000-CNWC9/fastq/" NN156_small <- loxcoder::load_from_xlsx(name = 'NN156_small', s=samplesheet,dir=fastq_dir, load = TRUE, full = FALSE)
# # load distance maps loxcoder::load_origin_distmaps('/wehisan/general/user_managed/grpu_naik.s_2/TW/maps/origin/') loxcoder::load_pair_distmaps('/wehisan/general/user_managed/grpu_naik.s_2/TW/maps/origin/') #load sample sheet and fastq directory samplesheet = "/stornext/Home/data/allstaff/n/ng.j/jngwehi/NN167_samples_small.xlsx" # Samplenames fastq_dir = "/wehisan/general/user_managed/grpu_naik.s_2/2019_Sequencing_Runs/NN167/saraT_221119/191119_M04529_0218_000000000-CTC4W/Data/Intensities/BaseCalls/" NN167_small <- loxcoder::load_from_xlsx(name = 'NN167_small', s=samplesheet,dir=fastq_dir, load = TRUE, full = FALSE)
# # load distance maps loxcoder::load_origin_distmaps('/wehisan/general/user_managed/grpu_naik.s_2/TW/maps/origin/') loxcoder::load_pair_distmaps('/wehisan/general/user_managed/grpu_naik.s_2/TW/maps/origin/') #load sample sheet and fastq directory samplesheet = "/Volumes/Naik_NGS/2019_Sequencing_Runs/NN156/191007_M04529_0207_000000000-CNWC9/fastq/nn156_samples_small.xlsx" # Samplenames fastq_dir = "/Volumes/Naik_NGS/2019_Sequencing_Runs/NN156/191007_M04529_0207_000000000-CNWC9/fastq/" Small <- loxcoder::load_from_xlsx(name = 'NN156', s=samplesheet,dir=fastq_dir,suffix_R1='_R1_001.fastq', suffix_R2='_R2_001.fastq', load = TRUE, full = FALSE)
DT::datatable(loxcoder::summary_table(Small, "all_samples"))
DT::datatable(loxcoder::sample_table(M, "test_matrix"))
loxcoder::heatmap_plot(N,code_set="test_codeset")
loxcoder::heatmap_plot(D,code_set="all_codes")
loxcoder::readstats_plot(D, plot="size",fill=FALSE)
loxcoder::readstats_plot(D, plot="complexity")
#loxcoder::readstats_plot(D, plot="both")
#loxcoder::readstats_plot(D, plot="ratio")
p <- loxcoder::saturation_plot(Small,code_set="all_codes") ggplotly(p)
p <- loxcoder::pair_comparison_plot(Small@samples$M2_P5_A_1, Small@samples$M3_P5_A_2, c(254,254), plot="size") ggplotly(p)
sample1 = D@samples$M2_P5_A_1 sample2 = D@samples$M3_P5_A_2 dist_range = c(254,254) loxcoder::get_comparison_table(sample1, sample2, dist_range)
s = c(3, 6) c = c(1, 254) n = "test_codeset" M = loxcoder::make_codeset(D, n, s, c)
d = "test" M = loxcoder::delete_codeset(N, d)
n = "test2" I = c(76,2,3,4,5,12,999) c = "all_codes" M = loxcoder::make_codeset_index(D,c,I,n)
n = "test_matrix" I = c("M2_P5_A_1") c = "all_samples" M = loxcoder::make_count_matrix(D, c, I, n) M@count_matrixes[["test_matrix"]]
loxcoder::sample_comparison_pie(D)
lox = Small lox = rename_sample(lox, "all_samples", "test", "M2_P5_A_1") print(lox)
validateFastq <- function(samplesheet, files) { files = sort(files[grepl(".fastq$", files)]) R1 = sort(files[grepl("R1_001.", files)]) R2 = sort(files[grepl("R2_001.", files)]) if ("sample" %in% names(samplesheet)){ sample_names = sort(samplesheet$sample) } else { showNotification("Sample sheet is invalid. Missing `sample` column.") return(FALSE) } # find the fastq files for each sample for (i in sample_names) { if (sum(grepl(i,R1))!=1 || sum(grepl(i,R2))!=1) { showNotification("Could not find sample", i, "in fastq directory.") return(FALSE) } } # checks if there are two runs each in fastq directory if (length(R1) != length(R2)) { for (s in R1){ if ((gsub("_R1_001", "_R2_001", s) %in% R2) == FALSE) { showNotification(paste(s, "is missing `R2_001` run in fastq directory.")) } } for (s in R2){ if ((gsub("_R2_001", "_R1_001", s) %in% R1) == FALSE) { showNotification(paste(s, "is missing `R1_001` run in fastq directory.")) } } } return (TRUE) } samplesheet = read_excel("/wehisan/general/user_managed/grpu_naik.s_2/2019_Sequencing_Runs/NN156/191007_M04529_0207_000000000-CNWC9/fastq/nn156_samples_small.xlsx") files = list.files(fastq_dir) validateFastq(samplesheet, files)
test = merge_experiments(Small, Full, name="test", type="union")
shiny::shinyApp( ui = shiny::fluidPage( shiny::selectInput("matrix", "Sample:", choices = names(D@count_matrixes)), shiny::selectInput("codeset", "Codes:", choices = names(D@code_sets)), shiny::plotOutput("Plot") ), server = function(input, output) { output$Plot = renderPlot({ loxcoder::heatmap_plot(D,code_set=input$codeset) }) }, options = list(height = 600) )
sample_table(Small, "all_samples")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.