dm <-readMM(dm.path)
cn <- read.table(cn.path, sep='\t', quote='"')
colnames(dm) <- cn[,1]
- sel.col <- read.csv2(selected.col, header = FALSE)
- sel.col <- sel.col[,1] + 1
+ if (file.exists(selected.col)) {
+ sel.col <- read.csv2(selected.col, header = FALSE)
+ sel.col <- sel.col[,1] + 1
+ } else {
+ sel.col <- 1:ncol(dm)
+ }
if (!word) {
dm <- dm[, sel.col]
} else {
txt += """
dm <-read.csv2(dm.path)
dm <- as.matrix(dm)
- sel.col <- read.csv2(selected.col, header = FALSE)
- sel.col <- sel.col[,1] + 1
+ if (file.exists(selected.col)) {
+ sel.col <- read.csv2(selected.col, header = FALSE)
+ sel.col <- sel.col[,1] + 1
+ } else {
+ sel.col <- 1:ncol(dm)
+ }
if (!word) {
dm <- dm[, sel.col]
} else {
graphnb +=1
self.filename = ffr(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png'))
if self.parametres['type_graph'] == 2 : type = 'rgl'
+ if self.parametres['type_graph'] == 3 :
+ graphnb = 1
+ type = 'rglweb'
+ dirout = os.path.dirname(self.pathout['mat01'])
+ while os.path.exists(os.path.join(dirout,'webrgl_'+str(graphnb))):
+ graphnb +=1
+ self.filename = ffr(os.path.join(dirout,'webrgl_'+str(graphnb)))
+ os.mkdir(self.filename)
if self.parametres['arbremax'] :
arbremax = 'TRUE'
"""
else :
txt+="""
- label.cex <- NULL
+ label.cex <- cex
"""
if self.parametres.get('sfromchi', False) :
txt += """
vertex.size <- NULL
"""
else :
- if self.parametres['type'] == 'clustersimitxt' :
+ print self.parametres
+ if (self.parametres['type'] == 'clustersimitxt' and self.parametres.get('tmpchi', False)) or (self.parametres['type'] == 'simimatrix' and 'tmpchi' in self.parametres):
txt += """
lchi <- read.table("%s")
lchi <- lchi[,1]
else :
txt += """
if (is.null(vcexminmax[1])) {
- label.cex <- NULL
+ label.cex <- cex
} else {
label.cex <- graph.simi$label.cex
}
"""
- if self.parametres['type'] == 'clustersimitxt' and self.parametres.get('sfromchi', False) :
+ if (self.parametres['type'] == 'clustersimitxt' or self.parametres['type'] == 'simimatrix') and self.parametres.get('sfromchi', False):
txt += """
vertex.size <- norm.vec(lchi, minmaxeff[1], minmaxeff[2])
if (!length(vertex.size)) vertex.size <- 0
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)
+ 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 = """
+ """
+
def quest_simi(self, evt) :
tableau = self.Source.tableau
+ if self.tmpchi is None :
+ self.tmpchi = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
+ with open(self.tmpchi, 'w') as f:
+ f.write('\n'.join([str(val) for val in self.lchi]))
tab = tableau.make_table_from_classe(self.cl, self.la)
pathout = ConstructPathOut(self.Source.pathout.dirout, 'simi_classe_%i' %self.cl)
self.filename = os.path.join(pathout,'mat01.csv')
'film': False,
'com' : 0,
'communities' : 0,
- 'halo' : 0
+ 'halo' : 0,
+ 'tmpchi': self.tmpchi
}
act = {}
tableau.chi = {}