diff lib.r @ 31:eb15a3841da4 draft

"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 42a0bcde81726702194f1b4ecd741d0545648d40"
author workflow4metabolomics
date Tue, 28 Apr 2020 09:35:10 -0400
parents 14b1c52fae62
children b02d1992a43a
line wrap: on
line diff
--- a/lib.r	Wed Feb 12 08:30:58 2020 -0500
+++ b/lib.r	Tue Apr 28 09:35:10 2020 -0400
@@ -151,12 +151,14 @@
 
     group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")
     names(group_colors) <- unique(xdata$sample_group)
+    col_per_samp <- as.character(xdata$sample_group)
+    for(i in 1:length(group_colors)){col_per_samp[col_per_samp==(names(group_colors)[i])]<-group_colors[i]}
 
     xlim <- c(min(featureDefinitions(xdata)$rtmin), max(featureDefinitions(xdata)$rtmax))
     for (i in 1:nrow(featureDefinitions(xdata))) {
         mzmin = featureDefinitions(xdata)[i,]$mzmin
         mzmax = featureDefinitions(xdata)[i,]$mzmax
-        plotChromPeakDensity(xdata, param = param, mz=c(mzmin,mzmax), col=group_colors, pch=16, xlim=xlim, main=paste(round(mzmin,mzdigit),round(mzmax,mzdigit)))
+        plotChromPeakDensity(xdata, param = param, mz=c(mzmin,mzmax), col=col_per_samp, pch=16, xlim=xlim, main=paste(round(mzmin,mzdigit),round(mzmax,mzdigit)))
         legend("topright", legend=names(group_colors), col=group_colors, cex=0.8, lty=1)
     }