From ff9ca58e22ec9a9e7163ed538453b6c9ea3cb9ce Mon Sep 17 00:00:00 2001 From: Sujai Date: Thu, 6 Feb 2014 13:05:35 +0000 Subject: [PATCH] Update makeblobplot.R Added fix by https://github.com/hobrien to relabel least frequent as "other". (i.e. keep the top 13 most frequent taxa, as there are 13 usable colours in the colour scheme) Maybe that should be the only filtering applied (rather than removing taxa that appear less than a certain proportion... --- makeblobplot.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/makeblobplot.R b/makeblobplot.R index 282dd67..98a8e1e 100755 --- a/makeblobplot.R +++ b/makeblobplot.R @@ -43,6 +43,13 @@ numcols=length(cov_colnames) taxlevel=arg_taxlevel; m<-melt(orig,id.vars=c("seqid","len","gc",taxlevel),measure.vars=cov_colnames, variable.name="read_set", value.name="cov") + +# there aren't many colours available, so to restrict the plot to only 13 colours: +# (thanks to https://github.com/hobrien for the fix) +if (length(levels(m[,taxlevel])) > 14) { + levels(d[,taxlevel])[which(table(d[,taxlevel])<=sort(as.numeric(table(d[,taxlevel])), decreasing=T)[13])]<-"other" +} + mfilt<-clean.blobs(m,arg_ignore_below_prop,taxlevel) taxnames=names(sort(table(mfilt[,taxlevel]),decreasing=TRUE)) taxnames=c("Not annotated", taxnames[taxnames != "Not annotated"])