+class WordCloudRScript(PrintRScript) :
+ def make_script(self) :
+ self.sources([self.analyse.parent.RscriptsPath['Rgraph']])
+ self.packages(['wordcloud'])
+ bg_col = Rcolor(self.parametres['col_bg'])
+ txt_col = Rcolor(self.parametres['col_text'])
+ if self.parametres['svg'] :
+ svg = 'TRUE'
+ else :
+ svg = 'FALSE'
+ txt = """
+ svg <- %s
+ """ % svg
+ txt += """
+ act <- read.csv2("%s", header = FALSE, row.names=1, sep='\t')
+ selected.col <- read.table("%s")
+ toprint <- as.matrix(act[selected.col[,1] + 1,])
+ rownames(toprint) <- rownames(act)[selected.col[,1] + 1]
+ maxword <- %i
+ if (nrow(toprint) > maxword) {
+ toprint <- as.matrix(toprint[order(toprint[,1], decreasing=TRUE),])
+ toprint <- as.matrix(toprint[1:maxword,])
+ }
+ open_file_graph("%s", width = %i, height = %i , svg = svg)
+ par(bg=rgb%s)
+ wordcloud(row.names(toprint), toprint[,1], scale=c(%f,%f), random.order=FALSE, colors=rgb%s)
+ dev.off()
+ """ % (ffr(self.analyse.pathout['actives_eff.csv']), ffr(self.analyse.pathout['selected.csv']), self.parametres['maxword'], ffr(self.parametres['graphout']), self.parametres['width'], self.parametres['height'], bg_col, self.parametres['maxcex'], self.parametres['mincex'], txt_col)
+ self.add(txt)
+ self.write()
+
+class ProtoScript(PrintRScript) :
+ def make_script(self) :
+ self.sources([self.analyse.parent.RscriptsPath['Rgraph'], self.analyse.parent.RscriptsPath['prototypical.R']])
+ self.packages(['wordcloud'])
+ txt = """
+ mat <- read.csv2("%s", header = FALSE, row.names=1, sep='\t', quote='"', dec='.')
+ open_file_graph("%s",height=800, width=1000)
+ prototypical(mat, mfreq = %s, mrank = %s, cloud = FALSE, cexrange=c(1,2.4), cexalpha= c(0.4, 1))
+ dev.off()
+ """ % (self.analyse.pathout['table.csv'], self.analyse.pathout['proto.png'], self.parametres['limfreq'], self.parametres['limrang'])
+ self.add(txt)
+ self.write()
+
+
+class ExportAfc(PrintRScript) :
+ def make_script(self) :
+ self.source([self.analyse.parent.RscriptsPath['Rgraph']])
+ self.packages(['rgexf'])
+ txt = """
+ """
+