Skip to content
Snippets Groups Projects
Unverified Commit dc558d51 authored by Todor Kondic's avatar Todor Kondic
Browse files

Fixes tag lossage in mzML table

parent 1dc1e2b5
No related branches found
No related tags found
No related merge requests found
......@@ -887,10 +887,8 @@ plot_id_msn <- function(ni,
## } else NULL
message("PH L ",i)
res<- if (!is.null(plMS1)) cowplot::plot_grid(plMS1,plStruc,plMS2,plEmpty,plSpecMS2,align = "hv",axis='l',ncol = 2,nrow=3,rel_widths=c(3,1)) else NULL
message("PH M ",i)
res
}
......@@ -909,35 +907,6 @@ adornmzMLTab<-function(df,projDir=getwd()) {
df
}
## genSuprFileTblOld <- function(fileTbl,compTab) {
## genOneFileTbl <- function(id,fileTbl) {
## n <- nrow(fileTbl)
## K <- length(id)
## longid <- rep(id,n)
## cols <- lapply(names(fileTbl),function(cn) rep("",n*K))
## names(cols) <- names(fileTbl)
## bdf <- as.data.frame(cols,stringsAsFactors = F)
## rows <- lapply(1:n*K,function(x) NA)
## for (j in 1:n) {
## for (i in 1:K)
## rows[[(j-1)*K+i]] <- fileTbl[j,]
## }
## bdf <- as.data.frame(do.call(rbind,rows),stringsAsFactors = F)
## bdf <- cbind(bdf,data.frame(ID=longid))
## bdf
## }
## sets <- levels(factor(compTab$set))
## setTbl <- lapply(sets,function (s) {
## sl1<-compTab$set %in% s
## sl2<-fileTbl$set==s
## if (!any(sl2)) stop("Set",s,"does not select anything in the currently processed files.")
## genOneFileTbl(compTab[sl1,]$ID,fileTbl[sl2,])
## })
## allTbl <- do.call(rbind,setTbl)
## allTbl
## }
genSuprFileTab <- function(fileTab,compTab) {
genOne<-function(ids,fn) {
......
......@@ -526,8 +526,10 @@ shinyScreenApp <- function(projDir=getwd()) {
if (is.null(df)) df<-mk_mzML_work()
if (length(tags)>0 && !is.na(tags)) {
oldlvl<-levels(df$tag)
exttag<-unique(c(unlist(tags),oldlvl))
x<-as.character(df$tag)
df$tag<-factor(x,levels=unlist(tags))
df$tag<-factor(x,levels=exttag)
ina<-which(is.na(df$tag))
df$tag[ina]<-TAG_DEF
}
......@@ -757,6 +759,8 @@ shinyScreenApp <- function(projDir=getwd()) {
chset<-as.character(mzml$set)
shiny::validate(need(chset,"Sets not properly specified for the mzML files."))
mzml$set<-factor(chset)
tag<-as.character(mzml$tag)
mzml$tag<-factor(tag)
mzml
})
......@@ -890,11 +894,8 @@ shinyScreenApp <- function(projDir=getwd()) {
tgt<-getTgt()
message("Begin generation of comp table.")
availSets<-get_sets()
message("comp tab 1")
idTgt<-tgt$ID
message("comp tab 2")
idUnk<-unk$ID
message("comp tab 3")
if (is.null(availSets)) stop("Sets have not been (properly) set on the mzML files. Please check.")
if (length(intersect(idTgt,idUnk))>0) stop("There must not be unknowns and targets with the same IDs.")
......@@ -906,8 +907,6 @@ shinyScreenApp <- function(projDir=getwd()) {
setId[iTgt,"orig"]<-"known"
setId[iUnk,"orig"]<-"unknown"
rvTab$setId<-setId ## !!!
message("comp tab 4")
## knowns
setIdTgt<-setId[setId$orig=="known",]
......@@ -917,7 +916,6 @@ shinyScreenApp <- function(projDir=getwd()) {
#on the data files.
nRow<-0
message("comp tab 5")
for (s in sets) {
sMode<-getSetMode(s,mzML)
n<-length(sMode)
......@@ -936,8 +934,6 @@ shinyScreenApp <- function(projDir=getwd()) {
SMILES=rep("",nRow),
stringsAsFactors=F)
message("comp tab 6")
i<-1
for (s in sets) {
sMode<-getSetMode(s,mzML)
......@@ -959,7 +955,6 @@ shinyScreenApp <- function(projDir=getwd()) {
}
}
message("comp tab 7")
message("Generation of comp table: knowns done.")
## unknows
setIdUnk<-setId[setId$orig=="unknown",]
......@@ -967,7 +962,6 @@ shinyScreenApp <- function(projDir=getwd()) {
sets<-intersect(availSets,sets)
nRow<-0
message("comp tab 8")
for (s in sets) {
sMode<-getSetMode(s,mzML)
n<-length(sMode)
......@@ -977,7 +971,6 @@ shinyScreenApp <- function(projDir=getwd()) {
}
message("comp tab 9")
compUnk<-data.frame(
ID=rep(0,nRow),
mz=rep(0.0,nRow),
......@@ -990,7 +983,6 @@ shinyScreenApp <- function(projDir=getwd()) {
stringsAsFactors=F)
message("comp tab 10")
i<-1
for (s in sets) {
m<-getSetMode(s,mzML)
......@@ -1007,7 +999,6 @@ shinyScreenApp <- function(projDir=getwd()) {
}
}
message("comp tab 11")
message("Generation of comp table: unknowns done.")
df<-rbind(compTgt,compUnk,stringsAsFactors=F)
tab2file(df,rvConf$fnComp)
......@@ -1293,17 +1284,15 @@ shinyScreenApp <- function(projDir=getwd()) {
for (t in sdf$tag) {
sprop <- rvConf$spectProps[[t]]
sdfSel<-sdf[sdf$tag %in% t,QANAMES]
sel <- as.logical(sdfSel)
sel <- as.logical(sdfSel)
choices <- QANAMES[sel]
names(choices) <- QANAMES[sel]
shiny::updateCheckboxGroupInput(session = session,inputId = sprop,selected=choices)
}
}
}
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment