Skip to content

Commit

Permalink
- added source code of version 1.14 (latest) , available in the sourc…
Browse files Browse the repository at this point in the history
…e folder

- can be used to create your own docker image of CRISPRAnalyzeR
  • Loading branch information
Jan Winter committed Mar 29, 2017
1 parent fea8e30 commit 533ee4d
Show file tree
Hide file tree
Showing 103 changed files with 4,574 additions and 1,829,017 deletions.
9 changes: 5 additions & 4 deletions source/app/analysisSettings_server.r
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ libContent <- eventReactive(status$libFile,{
if( status$libFile == TRUE ){
shinyjs::enable("geneID_pos")
shinyjs::enable("geneID_neg")
con <- file(libFile()$path)
top <- readLines(con)
close(con)
top <- as.character(top)
#con <- file(libFile()$path)
#top <- readLines(con)
#close(con)
#top <- as.character(top)
top <- libfile_gene
#tolower(top)
} else {
shinyjs::disable("geneID_pos")
Expand Down
73 changes: 51 additions & 22 deletions source/app/analysis_server.r
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,28 @@ observeEvent(input$startAnalysis, {
write(signature, file.path(userDir, "analysis.sign"))

log <- c(paste(userID, ": status of seqFiles, libFile, extract, groups, anno, compare, analysis, extractedFiles: good"),
paste(userID, ": Proxy Information", config$car.proxy.url, config$car.proxy.port),
paste(userID, ": starting analysis.r at", Sys.time()),
paste(userID, ": signature is", signature),
paste(userID, ": executing:", "Rscript", scriptpath, infoFiles$analysis))
write(log, logFile, append = TRUE)


# set proxy
if(is.null(config$car.proxy.url))
{
proxurl <- "NULL"
} else {
proxurl <- config$car.proxy.url
}

if(is.null(config$car.proxy.port))
{
proxport <- "NULL"
} else {
proxport <- config$car.proxy.port
}

group <- c()
for( i in 1: length(groups()) ){
group[i] <- paste(names(groups()[i]), paste(groups()[[i]], collapse = ";"), sep = ";")
Expand All @@ -90,10 +107,10 @@ observeEvent(input$startAnalysis, {
paste("bmDatabase", config$car.bm.database, sep = ";"),
paste("ecrisp", config$ecrisp, sep = ";"),
paste("databasepath", config$databasepath, sep = ";"),
paste("bt2Threads", paste(config$car.bt2.threads, collapse = ";"), sep = ";"),


paste("proxyurl", config$car.proxy.url, sep = ";"),
paste("proxyport", config$car.proxy.port, sep = ";"),
paste("proxyurl", proxurl, sep = ";"),
paste("proxyport", proxport, sep = ";"),

paste("libName", extractedFiles()$libName, sep = ";"),
paste("libPath", extractedFiles()$libPath, sep = ";"),
Expand Down Expand Up @@ -152,7 +169,8 @@ observeEvent(input$startAnalysis, {

system2("Rscript", args = c(scriptpath, infoFiles$analysis), wait = FALSE, stdout = NULL, stderr = NULL)


#show progress bar
shinyjs::show(id="analysis-progress")



Expand Down Expand Up @@ -221,7 +239,8 @@ results <- eventReactive(progress_analysis(),{
}
# open modal to show error
shinyBS::toggleModal(session, "analysis_error", toggle = "open")
return()
shinyjs::hide(id="analysis-progress")
return(NA)
} else {
write(paste(userID, ": results tested: good"), logFile, append = TRUE)
}
Expand All @@ -238,13 +257,16 @@ results <- eventReactive(progress_analysis(),{
# Load COSMIC ONLY ONCE

# check first if COSMIC DB is accessible
write(paste(userID, ": Access COSMIC Database at ", file.path(config$COSMIC_database)), logFile, append = TRUE)
cosmicreadable <- file.access(names = file.path(config$COSMIC_database), mode = 4)
write(paste(userID, ": Access COSMIC Database at ", file.path(config$database_path, config$COSMIC_database)), logFile, append = TRUE)
cosmicreadable <- file.access(names = file.path(config$database_path, config$COSMIC_database), mode = 4)

if(cosmicreadable == 0)
{
write(paste(userID, ": Loading COSMIC Database at ", file.path(config$database_path, config$COSMIC_database)), logFile, append = TRUE)

withProgress(value=0.3, message="Loading COSMIC Database, please be patient.", {
COSMICDB <- try(readr::read_tsv(file = file.path(config$COSMIC_database), col_names = TRUE))

COSMICDB <- try(readr::read_tsv(file = file.path(config$database_path, config$COSMIC_database), col_names = TRUE))
if(class(COSMICDB) == "try-error")
{
write(paste(userID, ": COSMIC Database could not be loaded"), logFile, append = TRUE)
Expand All @@ -254,7 +276,7 @@ results <- eventReactive(progress_analysis(),{
})
} else
{
write(paste(userID, ": COSMIC Database could not be loaded at ", file.path(config$COSMIC_database)), logFile, append = TRUE)
write(paste(userID, ": COSMIC Database could not be loaded at ", file.path(config$database_path,config$COSMIC_database)), logFile, append = TRUE)

COSMICDB <- NULL
}
Expand All @@ -271,8 +293,9 @@ results <- eventReactive(progress_analysis(),{
"statsGeneral" = readRDS(file.path(userDir, "statsGeneral.rds")),
"unmappedGenes" = readRDS(file.path(userDir, "unmappedGenes.rds")),
"readDistribution" = readRDS(file.path(userDir, "readDistribution.rds")),
"readDistributionBox" = readRDS(file.path(userDir, "readDistributionBox.rds")),
#"readDistributionBox" = readRDS(file.path(userDir, "readDistributionBox.rds")),
"readDistributionBoxNorm" = readRDS(file.path(userDir, "readDistributionBoxNorm.rds")),
"CDF_list" = readRDS(file.path(userDir, "CDF_list.rds")),
"readDepth" = readRDS(file.path(userDir, "readDepth.rds")),
"geneDesigns" = readRDS(file.path(userDir, "geneDesigns.rds")),
"readCountVS" = readRDS(file.path(userDir, "readCountVS.rds")),
Expand Down Expand Up @@ -305,21 +328,18 @@ results <- eventReactive(progress_analysis(),{
"sampleList" = readRDS(file.path(userDir, "sampleList.rds")),
"error" = test$error
)


# extracted seqfiles
#command <- "rm"
#arguments <- file.path(userDir, "*seqFile")
#system2(command, arguments)

### Open MODAL when Analysis Extraction is done
if( test$error != TRUE )
{
shinyBS::toggleModal(session, "reannotation_started", toggle = "open")
shinyBS::toggleModal(session, "analysis_finished", toggle = "open")
shinyjs::show("downloadanalysisdata")
}


status$results <- TRUE
shinyjs::show(id="reevaluation-progress")
out
}
})
Expand Down Expand Up @@ -372,9 +392,12 @@ output$analysis_progressBar <- renderUI({
} else if(progress_analysis()$progress >= 0.8 && progress_analysis()$progress <= 0.94)
{
title = "Finish Analysis"
} else if(progress_analysis()$progress ==1)
{
title = "Analysis finished"
} else {title=""}

HTML(paste0("<div style='width:70%'><br/>
HTML(paste0("<div id = 'analysis-progress' style='width:70%'><br/>
<div id='analysis_r_progress_title' class='text-center'><h4 class='text-center'>",title,"<h4></div>
<div id='analysis_r_progress' class='progress progress-striped shiny-file-input-progress' style='visibility: visible;'>
<div class='progress-bar' style='width:", perc, "%;'>Progress ", perc, "%</div></div></div>"
Expand All @@ -394,10 +417,11 @@ output$results_errormodal <- renderUI(

## reset sets final back
observeEvent(input$resetAnalysis, {

shinyjs::hide(id="reevaluation-progress")
shinyjs::hide(id="analysis-progress")
# close modals so we can open them later on
if(results()$error == FALSE){
shinyBS::toggleModal(session, "analysis_finished", toggle = "close")
if(!is.na(results)){
shinyBS::toggleModal(session, "analysis_reset", toggle = "open")
} else {
shinyBS::toggleModal(session, "analysis_error", toggle = "close")
}
Expand Down Expand Up @@ -428,6 +452,8 @@ observeEvent(input$resetAnalysis, {
shinyjs::enable("screenbeam_burnin")
shinyjs::enable("screenbeam_run")
shinyjs::enable("screenbeam_pval")


write(paste(userID, ": clicked on resetAnalysis at", Sys.time()), logFile, append = TRUE)
})

Expand All @@ -440,10 +466,10 @@ output$analysisduration <- renderUI({


# we guess extraction of 300 MB zipped is minimum 1 minute
timeduration <- round(extractedFiles()$toplength / 6000, digits=0)+1
timeduration <- round(extractedFiles()$toplength / 3000, digits=0)+1
if(input$screenbeam_run)
{ # Add ScreenBEAM information
timeduration <- timeduration * 3
timeduration <- timeduration * 5
}

text <- paste("The <strong>minimum expected time</strong> to check and analyse your data <strong>is", timeduration, "minutes</strong>.</br>
Expand All @@ -453,3 +479,6 @@ output$analysisduration <- renderUI({

})




66 changes: 47 additions & 19 deletions source/app/data_review_help.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ column(width=12,
shiny::tags$p(class="text-justify","CRISPRAnalyzeR gives you the opportunity to download the read count files for your samples."),
shiny::tags$p(class="text-justify","In case you uploaded FASTQ.gz data, the read count files have been generated by mapping your sequencing data against your sgRNA library.",
"If you come back to CRISPRAnalyzeR, you can then just upload the read count files together with your sgRNA library file, which is much faster."),
shiny::tags$p(class="text-justify","The read count files are tab-separated text files and come within a gzip archive.")
shiny::tags$p(class="text-justify","The read count files are tab-separated text files and come within a gzip archive."),

shiny::tags$img(class="img-responsive", src="images/CA_download_readcount.png")

),
column(width=6,
Expand All @@ -33,11 +35,10 @@ column(width=12,
shiny::HTML("<blockquote class='text-left'>
Welliton Souza and Benilton Carvalho (2016).</br>
Rqc: Quality Control Tool for High-Throughput Sequencing Data.</br>
R package version 1.6.2. https://github.com/labbcb/Rqc </blockquote>")
R package version 1.6.2. https://github.com/labbcb/Rqc </blockquote>"),

shiny::tags$img(class="img-responsive", src="images/CA_download_FASTQreport.png")

),
column(width=12,
shiny::tags$img(src="images/CRISPRAnalyzeR_data-review_1.png", class="img-responsive")
),
column(width=12,
shiny::tags$hr() ),
Expand All @@ -46,20 +47,47 @@ R package version 1.6.2. https://github.com/labbcb/Rqc </blockquote>")
column(width=12,
shiny::tags$h3("What information is provided in the overview table?", class="text-success"),
shiny::tags$img(src = "images/CRISPRAnalyzeR_data-review_2.png", class="img-responsive"),
shiny::tags$dl(class="dl-horizontal",
shiny::tags$dt("Original Filename"),
shiny::tags$dd("The name of the uploaded file", class="text-left"),
shiny::tags$dt("Provided Name"),
shiny::tags$dd("The name you provided after uploading the files", class="text-left"),
shiny::tags$dt("Type"),
shiny::tags$dd("Either Fastq for sequencing files or Readcount for read count data", class="text-left"),
shiny::tags$dt("Size"),
shiny::tags$dd("The filesize", class="text-left"),
shiny::tags$dt("Extraction Ratio"),
shiny::tags$dd("The ratio gives an estimate of how many sequencing reads were extracted according to the selected regular expression. In general this should be higher than 80%.", class="text-left"),
shiny::tags$dt("Mapping to Reference"),
shiny::tags$dd("CRISPRAnalyzeR maps your raw data sequencing files to your sgRNA library file and tells you, how many reads were mapped to your sgRNA library.
Each sequencing read can be mapped only once (Aligned once), multiple times or it might be that a read cannot be mapped to your library at all.", class="text-left")
shiny::tags$table(class="table table-striped",

shiny::tags$thead(
shiny::tags$th("Feature"),
shiny::tags$th("Description")
),
shiny::tags$tbody(
shiny::tags$tr(
shiny::tags$td("Original Filename"),
shiny::tags$td("The name of the uploaded file")
),
shiny::tags$tr(
shiny::tags$td("Provided Nameame"),
shiny::tags$td("The name you provided after uploading the files")
),
shiny::tags$tr(
shiny::tags$td("Type"),
shiny::tags$td("Either Fastq for sequencing files or Readcount for read count data")
),
shiny::tags$tr(
shiny::tags$td("Size"),
shiny::tags$td("The filesize")
),
shiny::tags$tr(
shiny::tags$td("sgRNA Extraction Ratio"),
shiny::tags$td("The ratio gives an estimate of how many sequencing reads were extracted according to the selected regular expression. In general this should be higher than 80%.")
),
shiny::tags$tr(
shiny::tags$td("Reads Mapped To Reference"),
shiny::tags$td("CRISPRAnalyzeR maps your raw data sequencing files to your sgRNA library file and tells you, how many reads were mapped to your sgRNA library.
Each sequencing read can be mapped only once (Aligned once), multiple times or it might be that a read cannot be mapped to your library at all.")
),
shiny::tags$tr(
shiny::tags$td("Reads passed Quality Threshold"),
shiny::tags$td("You select a quality threshold for the mapping of sequencing reads to the sgRNA library. This is the percentage of reads which have passed the selected quality criteria.")
),
shiny::tags$tr(
shiny::tags$td("Reads Used in Total"),
shiny::tags$td("This is the percentage of reads that is finally used for the data analysis after the sequencing data handling, which includes the extraction of sgRNA sequences, the mapping to the sgRNA library and the applied mapping quality threshold.")
)
)
)

)
Expand Down

0 comments on commit 533ee4d

Please sign in to comment.