Skip to content

Commit

Permalink
Merge branch 'master' of github.com:uzh/ezRun
Browse files Browse the repository at this point in the history
  • Loading branch information
Daymé González Rodríguez committed Oct 23, 2020
2 parents b7435af + 159895d commit 6ac8f91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions R/ngsio.r
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ loadCountDataset <- function(input, param){
dataFeatureLevel <- unique(input$getColumn("featureLevel"))
stopifnot(length(dataFeatureLevel) == 1)

x1 <- read_tsv(files[1], guess_max=1e6)
x1 <- read_tsv(files[1], guess_max=1e6, col_types = cols())
## col type messages are suppressed by col_types = cols()
## Alternatively: The message is triggered by readr:::show_cols_spec.
##To suppress the message, put this at the top of your script: options(readr.num_columns = 0)

if (ezIsSpecified(param$expressionName)){
columnName <- param$expressionName
Expand All @@ -33,7 +36,7 @@ loadCountDataset <- function(input, param){

x <- mapply(function(x, y){
message("loading file: ", x)
tempTibble <- read_tsv(x, progress=FALSE, guess_max=1e6)
tempTibble <- read_tsv(x, progress=FALSE, guess_max=1e6, col_types = cols())
tempTibble %>%
dplyr::select(identifier, columnName) %>%
dplyr::rename("id":= 1, !! y := columnName)
Expand Down
8 changes: 4 additions & 4 deletions inst/templates/CountQC.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if(!is.null(rowData(rawData)$gene_name)){
write_xlsx(counts, path=countFile)
# normalized signal
signalFile <- paste0(ezValidFilename(param$name), "-normalized-signal.xlsx")
write_xlsx(combined, file=signalFile, head="Feature ID", digits=4)
write_xlsx(combined, path=signalFile)
selectSignals = grepl("Signal", colnames(combined))
combined$"Mean signal" = rowMeans(combined[, selectSignals], na.rm=TRUE)
Expand All @@ -177,7 +177,7 @@ combined = combined[order(combined$"Maximum signal", decreasing = TRUE), ,
useInInteractiveTable = c("seqid", "gene_name", "Maximum signal",
"Mean signal", "description", "featWidth", "gc")
useInInteractiveTable = intersect(useInInteractiveTable, colnames(combined))
tableLink = sub(".txt", "-viewHighExpressionGenes.html", signalFile)
tableLink = sub(".xlsx", "-viewHighExpressionGenes.html", signalFile)
## select top genes
combinedTopGenes = combined[which(rownames(combined) %in% topGenes),]
## restrict number of table rows if necessary
Expand All @@ -190,7 +190,7 @@ ezInteractiveTable(interactiveTable, tableLink=tableLink, digits=3,
title=paste("Showing the top", nRows,
"genes with the highest expression"))
rpkmFile <- paste0(ezValidFilename(param$name), "-rpkm.txt")
rpkmFile <- paste0(ezValidFilename(param$name), "-rpkm.xlsx")
rpkm <- as_tibble(getRpkm(rawData), rownames="Feature ID")
if(!is.null(rowData(rawData)$gene_name)){
rpkm <- left_join(rpkm,
Expand All @@ -213,7 +213,7 @@ write_xlsx(tpm, path=tpmFile)
```

```{r add data files link, echo=FALSE, results='asis', message=FALSE}
for(each in dataFiles){
for(each in c(countFile, signalFile, rpkmFile, tpmFile, tableLink)){
cat("\n")
cat(paste0("[", each, "](", each, ")"))
cat("\n")
Expand Down

0 comments on commit 6ac8f91

Please sign in to comment.