lot of things :)
[iramuteq] / PrintRScript.py
index 6c102a0..636fe9e 100644 (file)
@@ -33,7 +33,7 @@ class PrintRScript :
 
     def sources(self, lsources) :
         for source in lsources :
 
     def sources(self, lsources) :
         for source in lsources :
-            self.add('source("%s")' % source)
+            self.add('source("%s", encoding = \'utf8\')' % source)
 
     def packages(self, lpks) :
         for pk in lpks :
 
     def packages(self, lpks) :
         for pk in lpks :
@@ -1117,3 +1117,17 @@ class WordCloudRScript(PrintRScript) :
         """ % (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()
         """ % (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=600, width=600)
+        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()
+