Skip to content

Commit

Permalink
issue #49 : fixed handling of datasets with missing error; corrected …
Browse files Browse the repository at this point in the history
…terminology in tooltip; distinguish between se and sd
  • Loading branch information
jweile committed Jul 18, 2019
1 parent 73c6572 commit 9ba54bb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions R/mavevis.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,14 @@ dashboard <- function(ssid,uniprotId=NULL,pdbs=NULL,mainChains=NULL,
errColIdx <- which(colnames(data) %in% c("se","SE","stderr","sem","SEM","sd","SD","stdev","std","STD"))
if (length(errColIdx) == 0) {
errCol <- NULL
errName <- NULL
} else {
errCol <- as.numeric(data[,errColIdx[[1]]])
errName <- colnames(data)[errColIdx]
}



cat("Filtering for single mutant variants...\n")
#Reduce to single mutants
#TODO: Add option to average over multi-mutants
Expand Down Expand Up @@ -337,6 +341,7 @@ dashboard <- function(ssid,uniprotId=NULL,pdbs=NULL,mainChains=NULL,
score=sm.data$score,error=sm.errCol,syn.med=syn.med,stop.med=stop.med,
grayBack=TRUE,img.width=img.width,tracks=td,pixelMap=pixelMap)
if (pixelMap && !is.null(pxMap)) {
pxMap$errName <- errName
mapFile <- getCacheFile(paste0("result_",outID,"_pxmap_",outFormat,".Rdata"))
save(pxMap,file=mapFile)
}
Expand Down
20 changes: 14 additions & 6 deletions docker/cgi/getMap.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,31 @@ if (!file.exists(mapfile)) {
#load the pxMap object from the data file
tryCatch({
load(mapfile)
mainMap <- na.omit(pxMap$main)
summaryMap <- na.omit(pxMap$summary)
mainMap <- pxMap$main
summaryMap <- pxMap$summary

errName <- "uncertainty"
if ("errName" %in% names(pxMap)) {
errName <- pxMap$errName
}

#translate main map into HTML areas
mainAreas <- paste(do.call(c,lapply(1:nrow(mainMap),function(i) with(mainMap[i,],{
paste0("<area shape=\"rect\" coords=\"",
paste(x0,y1,x1,y0,sep=","),"\" ",
"title=\"",sprintf("%s%d%s fitness=%.2f error=%.2f",wt,pos,aa,score,error),"\"",
"/>"
paste(x0,y1,x1,y0,sep=","),
"\" ","title=\"",
sprintf(
"Variant: %s%d%s; score = %.2f; %s = %.2f",
wt,pos,aa,score,errName,error
),"\"/>"
)
}))),collapse="\n")

#translate summary map into HTML areas
summaryAreas <- paste(do.call(c,lapply(1:nrow(summaryMap),function(i) with(summaryMap[i,],{
paste0("<area shape=\"rect\" coords=\"",
paste(x0,y1,x1,y0,sep=","),"\" ",
"title=\"",sprintf("%s%d median=%.2f",wt,pos,Median),"\"",
"title=\"",sprintf("Residue: %s%d; median=%.2f",wt,pos,Median),"\"",
"/>"
)
}))),collapse="\n")
Expand Down

0 comments on commit 9ba54bb

Please sign in to comment.