def __init__(self, file, ui=None, expTime = 601, checkTime = 1, ): self.fsCoding = getFsEncoding(logLevel=False) self.expTime = expTime self.checkTime = checkTime self.file = file self.ui = ui QThread.__init__(self)
def __init__(self, name, dir=None, parent=None): super(ProjectMsatSeq, self).__init__(name, dir, parent) self.fsCoding = getFsEncoding(logLevel=False) self.gen_data_win = SetGeneticDataMsatSeq(self) self.gen_data_win.ui.okButton.setText("VALIDATE AND SAVE") self.gen_data_win.hide() self.verifyRefTableValid()
def __init__(self,sc_info_list=None,parent=None): super(DrawScenario,self).__init__(parent) self.parent=parent self.fsCoding = getFsEncoding(logLevel=False) self.createWidgets() self.sc_info_list = sc_info_list self.pixList = [] self.svgList = []
def treatment(csock,qued): #filename = sys.argv[2] filename = str(datetime.now()) filename = filename.replace(' ','_').replace(":",".") filename+=".tar" f=open( filename.encode(getFsEncoding(logLevel=False)), 'wb') md5=csock.recv(33) md5 = str(md5).strip() print "md5 : '%s'"%md5 size=csock.recv(20) print "size : '%s'"%size received = 0 #data = csock.recv(int(size)) #f.write(data) # 2. receive data while received < int(size): print "reception" data = csock.recv(8192) received = received + len(data) if (not data): print "je break, plus de data" break f.write(data) print "sortie de boucle de reception" #3.close file f.close() print filename.encode(getFsEncoding(logLevel=False)), "Received\n" f=open(filename.encode(getFsEncoding(logLevel=False)),'r') fdata = f.read() f.close() print str(hashlib.md5(fdata).hexdigest()) checkfile = (md5 == str(hashlib.md5(fdata).hexdigest())) print "'%s' == '%s'"%(md5,hashlib.md5(fdata).hexdigest()) if checkfile: dirname = filename.replace('.tar','') os.mkdir((u"%s/%s"%(os.getcwd()).encode(getFsEncoding(logLevel=False)),dirname.encode(getFsEncoding(logLevel=False)))) #os.chdir("%s/%s"%(os.getcwd(),dirname)) a = os.popen("tar xvf %s -C ""%s"""%(filename.encode(getFsEncoding(logLevel=False)),dirname.encode(getFsEncoding(logLevel=False)))) a.close() print "archive extracted" #os.chdir("./SBCN_jm/") f=open((u"%s/SBCN_jm/command_output"%dirname).encode(getFsEncoding(logLevel=False)),"w") subprocess.Popen([u"sh".encode(getFsEncoding(logLevel=False)),u"./launch.sh".encode(getFsEncoding(logLevel=False))],stdout=f,cwd=(u"%s/SBCN_jm/"%dirname).encode(getFsEncoding(logLevel=False))) while True: time.sleep(2) a=os.popen((u"tail -n 1 %s/SBCN_jm/command_output"%dirname).encode(getFsEncoding(logLevel=False))) line = a.read() print "[",dirname,"] ",line,"--------" csock.send(line) a.close() if len(line.split("%%"))>1 and "100 %%" in line: break f.close() csock.close()
def __init__(self,parent=None): super(ShowLogFile,self).__init__(parent) self.parent = parent self.fsCoding = getFsEncoding(logLevel=False) #dd = datetime.now() #self.logfile = os.path.expanduser("~/.diyabc/logs/%02d_%02d_%s-%s.log"%(dd.day,dd.month,dd.year,os.getpid())) #self.logfile = self.parent.logfile self.createWidgets() self.updateLogFile()
def __init__(self,analysis,directory,parent=None): super(DrawComparisonAnalysisResult,self).__init__(parent) self.parent=parent self.directory=directory self.analysis = analysis self.fsCoding = getFsEncoding(logLevel=False) self.createWidgets() self.dicoPlot = {} self.tab_colors = ["#0000FF","#00FF00","#FF0000","#00FFFF","#FF00FF","#FFFF00","#000000","#808080","#008080","#800080","#808000","#000080","#008000","#800000","#A4A0A0","#A0A4A0","#A0A0A4","#A00000","#00A000","#00A0A0"] self.drawAll()
def __init__(self,analysis,directory,parent=None): super(DrawPCAAnalysisResult,self).__init__(parent) self.parent=parent self.directory=directory self.fsCoding = getFsEncoding(logLevel=False) self.dico_points = {} self.analysis = analysis if self.directory.split('_')[-1] == "modelChecking": self.acpFile = "%s/analysis/%s/mcACP.txt"%(self.parent.dir,self.directory) else: self.acpFile = "%s/analysis/%s/ACP.txt"%(self.parent.dir,self.directory) self.createWidgets() self.dicoPlot = {} self.tab_colors = ["#0000FF","#00FF00","#FF0000","#00FFFF","#FF00FF","#FFFF00","#000000","#808080","#008080","#800080","#808000","#000080","#008000","#800000","#A4A0A0","#A0A4A0","#A0A0A4","#A00000","#00A000","#00A0A0"]
def __init__(self,parent=None,confFilePath=None,title="Settings"): super(AutoPreferences,self).__init__(parent) self.parent = parent self.title = title # dico indexé par le nom de la catégorie qui contient la liste des propriétés self.dicoCategory = {} # liste pour retenir l'ordre des catégories self.categoryList = [] self.configFile = confFilePath.encode(getFsEncoding(logLevel=False)) self.config = ConfigObj(self.configFile) self.createWidgets()
def __init__(self,analysis,directory,parent=None): super(DrawEstimationAnalysisResult,self).__init__(parent) self.parent=parent self.directory=directory self.analysis = analysis self.fsCoding = getFsEncoding(logLevel=False) self.tab_colors = ["#0000FF","#00FF00","#FF0000","#00FFFF","#FF00FF","#FFFF00","#000000","#808080","#008080","#800080","#808000","#000080","#008000","#800000","#A4A0A0","#A0A4A0","#A0A0A4","#A00000","#00A000","#00A0A0"] self.paramChoice = "o" self.file_subname = "_original" self.createWidgets() self.dicoPlot = {} self.dicoFrame = {} self.svgList = [] self.drawAll()
def __init__(self,name,dir=None,parent=None): super(ProjectSnp,self).__init__(name,dir,parent) self.fsCoding = getFsEncoding(logLevel=False) self.ui.nbMicrosatLabel.hide() self.setGenValid(False) self.ui.genDataLabel.setText("Summary statistics") self.typesOrdered = ["A","H","X","Y","M"] self.checkSNPbin = None #self.ui.frame_11.show() #self.ui.frame_12.show() # until now set ascert bias functionality is not activated. (but waiting for further developpment) # so self.ascert_state_valid is set to True self.ascert_frame = ControlAscertBias(self) self.ascert_frame.hide() self.ascert_state_valid = True self.setAscertValid(True) QObject.connect(self.ui.ascertButton,SIGNAL("clicked()"),self.setAscertBias)
def __init__(self,name,dir=None,parent=None): self.parent=parent self.name=name self.dir=dir if self.dir != None : self.dir = str(self.dir) self.fsCoding = getFsEncoding(logLevel=False) # objet data de cbgpUtils self.data = None self.hist_state_valid = False self.gen_state_valid = False self.MIN_NUM_DATA_SETS_BY_SCENARIO_FOR_ANALYSIS = 100000 # utile seulement si on derive de QTabWidget super(Project,self).__init__(parent) # on peut aussi instancier un tabwidget #self.tab = QTabWidget() self.createWidgets() self.verifyRefTableValid()
def __init__(self,parent=None): super(SetGeneticDataSimulation,self).__init__(parent) self.fsCoding = getFsEncoding(logLevel=False) self.ui.tableWidget.setColumnWidth(0,90) self.ui.tableWidget.setColumnWidth(1,40) self.ui.tableWidget.setColumnWidth(2,45) self.ui.tableWidget.setColumnWidth(3,45) self.ui.tableWidget.insertColumn(self.ui.tableWidget.columnCount()) self.ui.tableWidget.setColumnWidth(4,50) self.ui.tableWidget.setHorizontalHeaderItem (4, QTableWidgetItem("length")) self.ui.tableWidget.insertColumn(self.ui.tableWidget.columnCount()) self.ui.tableWidget.setColumnWidth(5,35) self.ui.tableWidget.setHorizontalHeaderItem (5, QTableWidgetItem("%A")) self.ui.tableWidget.insertColumn(self.ui.tableWidget.columnCount()) self.ui.tableWidget.setColumnWidth(6,35) self.ui.tableWidget.setHorizontalHeaderItem (6, QTableWidgetItem("%C")) self.ui.tableWidget.insertColumn(self.ui.tableWidget.columnCount()) self.ui.tableWidget.setColumnWidth(7,35) self.ui.tableWidget.setHorizontalHeaderItem (7, QTableWidgetItem("%G")) self.ui.tableWidget.insertColumn(self.ui.tableWidget.columnCount()) self.ui.tableWidget.setColumnWidth(8,35) self.ui.tableWidget.setHorizontalHeaderItem (8, QTableWidgetItem("%T"))
# -*- coding: utf-8 -*- import sys, codecs, traceback from PyQt4 import QtCore, QtGui from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic from utils.visualizescenario import * from utils.data import * from utils.cbgpUtils import log,getFsEncoding import output import variables from variables import UIPATH formControl,baseControl = uic.loadUiType((u"%s/controlAscertBias.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class ControlAscertBias(formControl,baseControl): def __init__(self,parent=None): super(ControlAscertBias,self).__init__(parent) self.parent=parent self.fsCoding = getFsEncoding(logLevel=False) self.createWidgets() def createWidgets(self): #self.ui = Ui_Frame() self.ui = self self.ui.setupUi(self) self.ui.verticalLayout_3.setAlignment(QtCore.Qt.AlignCenter)
# -*- coding: utf-8 -*- import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic from historicalModel.setHistDrawnAnalysis import HistDrawn from historicalModel.setHistFixedAnalysis import HistFixed from setupEstimationBias import SetupEstimationBias import variables from variables import UIPATH from utils.cbgpUtils import getFsEncoding, Parents formBiasScenarioSelection,baseBiasScenarioSelection = uic.loadUiType((u"%s/biasScenarioSelection.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class BiasNConfidenceScenarioSelection(formBiasScenarioSelection,baseBiasScenarioSelection): """ Selection du scenario dans la cadre d'une analyse de type bias ou confidence """ def __init__(self,nb_sc,analysis,parent=None): super(BiasNConfidenceScenarioSelection,self).__init__(parent) self.parent=parent self.parents = Parents(self.parent) self.analysis = analysis self.nb_sc = nb_sc self.checklist = [] self.radiolist = [] self.createWidgets() self.putChoices()
# -*- coding: utf-8 -*- import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic from biasScenarioSelection import BiasNConfidenceScenarioSelection from historicalModel.setHistDrawnAnalysis import HistDrawn from historicalModel.setHistFixedAnalysis import HistFixed from setupComparisonConfidence import SetupComparisonConfidence import variables from variables import UIPATH from utils.cbgpUtils import getFsEncoding, Parents formConfidenceTypeSelection,baseConfidenceTypeSelection = uic.loadUiType((u"%s/confidenceTypeSelection.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class ConfidenceTypeSelection(formConfidenceTypeSelection,baseConfidenceTypeSelection): """ Selection du scenario dans la cadre d'une analyse de type bias ou confidence """ def __init__(self,nb_sc,analysis,parent=None): super(ConfidenceTypeSelection,self).__init__(parent) self.parent=parent self.parents = Parents(self.parent) self.analysis = analysis self.nb_sc = nb_sc self.createWidgets() self.restoreAnalysisValues() def createWidgets(self):
# -*- coding: utf-8 -*- import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.setupComparisonConfidence_ui import Ui_Frame from genericScenarioSelection import GenericScenarioSelection import output import variables from variables import UIPATH from utils.cbgpUtils import getFsEncoding, Parents formSetupComparisonConfidence,baseSetupComparisonConfidence = uic.loadUiType((u"%s/setupComparisonConfidence.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class SetupComparisonConfidence(formSetupComparisonConfidence,baseSetupComparisonConfidence): """ dernière étape de définition d'une analyse de type comparison ou confidence """ def __init__(self,analysis,parent=None): super(SetupComparisonConfidence,self).__init__(parent) self.parent=parent self.parents = Parents(self.parent) self.analysis = analysis self.scNumList = [] self.dico_values = {} self.createWidgets() self.ui.verticalLayout_2.setAlignment(Qt.AlignHCenter) self.ui.verticalLayout_2.setAlignment(Qt.AlignTop) self.restoreAnalysisValues()
# -*- coding: utf-8 -*- import sys, codecs from PyQt4 import QtCore, QtGui from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.setMutationModelSequences_ui import Ui_Frame import variables from variables import UIPATH from utils.cbgpUtils import getFsEncoding formSetMutationModelSequences,baseSetMutationModelSequences = uic.loadUiType((u"%s/setMutationModelSequences.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class SetMutationModelSequences(formSetMutationModelSequences,baseSetMutationModelSequences): """ définition du modèle mutationnel pour les séquences """ def __init__(self,parent=None,box_group=None): super(SetMutationModelSequences,self).__init__(parent) self.parent=parent self.box_group = box_group self.createWidgets() if self.ui.jukesRadio.isChecked(): self.showJukes() elif self.ui.haseRadio.isChecked() or self.ui.kimuraRadio.isChecked(): self.showKimuraHase() elif self.ui.tamuraRadio.isChecked(): self.showTamura() self.ui.verticalLayout_27.setAlignment(Qt.AlignTop)
from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.setHistFrame_ui import Ui_Frame from utils.visualizescenario import * from utils.history import * from setCondition import SetCondition from geneticData.setGenDataAnalysis import SetGeneticDataAnalysis from analysis.setupEstimationBias import SetupEstimationBias from analysis.setupComparisonConfidence import SetupComparisonConfidence from utils.cbgpUtils import log, getFsEncoding, Parents import variables from variables import UIPATH import output formHistModelDrawn,baseHistModelDrawn = uic.loadUiType((u"%s/setHistFrame.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class HistDrawn(formHistModelDrawn,baseHistModelDrawn): """ définition du modèle historique dans le cadre d'une analyse les valeurs ne sont pas fixées """ def __init__(self,analysis,parent=None): super(HistDrawn,self).__init__(parent) self.parent=parent self.parents = Parents(parent) self.analysis = analysis self.sc_to_show = self.analysis.chosenSc self.list_selected_evaluate_sc = self.analysis.candidateScList self.paramList = [] self.condList = []
def __init__(self,parent=None): super(ControlAscertBias,self).__init__(parent) self.parent=parent self.fsCoding = getFsEncoding(logLevel=False) self.createWidgets()
# -*- coding: utf-8 -*- import sys, codecs import os.path import os sys.path.append((u"/".join(os.getcwd().split('/')[:-1])).encode(getFsEncoding(logLevel=False))) from project import * #import time import unittest import shutil from diyabc import Diyabc from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtTest import QTest from datetime import datetime from utils.cbgpUtils import log,TeeLogger,getFsEncoding import output # pour eviter les popups de notification output.debug = True class testDiyabc(unittest.TestCase): """ A test class for DIYABC interface """ def setUp(self): """ set up data used in the tests. setUp is called before each test function execution. """
# -*- coding: utf-8 -*- import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic from utils.cbgpUtils import log,getFsEncoding,Parents import variables from variables import UIPATH formGenericScenarioSelection,baseGenericScenarioSelection = uic.loadUiType((u"%s/genericScenarioSelection.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class GenericScenarioSelection(formGenericScenarioSelection,baseGenericScenarioSelection): """ Sélection du scenario dans la cadre d'une analyse de type comparison ou estimate """ def __init__(self,nb_sc,label,next_widget,next_title,nb_min_sel,analysis,parent): super(GenericScenarioSelection,self).__init__(parent) self.parent=parent self.parents = Parents(self.parent) self.analysis = analysis self.nb_sc = nb_sc self.nb_min_sel = nb_min_sel self.next_widget = next_widget self.next_title = next_title self.checklist = [] self.createWidgets() self.ui.selectionLabel.setText(label) self.ui.analysisTypeLabel.setText(self.next_title) self.ui.projectDirEdit.setText(self.parents.dir)
import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic from setupComparisonConfidence import SetupComparisonConfidence from setupEstimationBias import SetupEstimationBias from genericScenarioSelection import GenericScenarioSelection from biasScenarioSelection import BiasNConfidenceScenarioSelection from confidenceTypeSelection import ConfidenceTypeSelection from analysis import Analysis import output import variables from variables import UIPATH from utils.cbgpUtils import getFsEncoding, Parents formDefineNewAnalysis,baseDefineNewAnalysis = uic.loadUiType((u"%s/defineAnalysis.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class DefineNewAnalysis(formDefineNewAnalysis,baseDefineNewAnalysis): """ écran de définition d'une nouvelle analyse. demande le type d'analyse souhaitée Si une analyse est fournie au constructeur, il passe directement à l'étape suivante : edition d'analyse """ def __init__(self,parent=None,nbScenario=0,analysis_to_edit=None): super(DefineNewAnalysis,self).__init__(parent) self.parent=parent self.nbScenario = nbScenario self.nb_sc = nbScenario self.analysis_to_edit = analysis_to_edit self.parents = Parents(self.parent) self.createWidgets() self.ui.verticalLayout_2.setAlignment(Qt.AlignHCenter)
## @package python_interface.project # @author Julien Veyssier # # @brief Classe mère abstraite de tous les projets import subprocess,shutil import os, time, sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic from historicalModel.setHistoricalModel import SetHistoricalModel from utils.cbgpUtils import log,addLine,getFsEncoding import variables from variables import UIPATH formProject,baseProject = uic.loadUiType((u"%s/Project.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) ## @class Project # @brief Classe mère abstraite de tous les projets class Project(baseProject,formProject): """ classe qui représente un projet par defaut, un projet est considéré comme nouveau, cad que l'affichage est celui d'un projet vierge pour un projet chargé, on modifie l'affichage en conséquence dans loadFromDir """ def __init__(self,name,dir=None,parent=None): self.parent=parent self.name=name self.dir=dir if self.dir != None :
# -*- coding: utf-8 -*- import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.set_condition_ui import Ui_MainWindow import output,os,shutil,tarfile,sys import variables from variables import VERSION,VERSION_DATE,UIPATH import urllib, urllib2 from utils.cbgpUtils import getLastRevisionDate,getFsEncoding formBugReport,baseBugReport= uic.loadUiType((u"%s/bugReport.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class BugReport(formBugReport,baseBugReport): """ Fenetre de definition d'un rapport de bug """ def __init__(self,parent=None): super(BugReport,self).__init__(parent) self.parent=parent self.createWidgets() def createWidgets(self): self.ui=self self.ui.setupUi(self) QObject.connect(self.ui.cancelButton,SIGNAL("clicked()"),self.close) QObject.connect(self.ui.validateButton,SIGNAL("clicked()"),self.valid) self.ui.infoLabel.setText(str(self.ui.infoLabel.text()).replace("CONF","%s"%self.parent.configFile)) self.ui.cancelButton.setShortcut(QKeySequence(Qt.Key_Escape))
from PyQt4 import QtCore, QtGui from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.setGenData_ui import Ui_Frame #from mutationModel.setMutationModelMsatRefTable import SetMutationModelMsatRefTable #from mutationModel.setMutationModelSequences import SetMutationModelSequences from summaryStatistics.setSummaryStatisticsMsat import SetSummaryStatisticsMsat from summaryStatistics.setSummaryStatisticsSeq import SetSummaryStatisticsSeq from utils.visualizescenario import * from utils.data import * from utils.cbgpUtils import log,getFsEncoding,Parents import variables from variables import UIPATH formGenData,baseGenData = uic.loadUiType((u"%s/setGenData.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class SetGeneticData(formGenData,baseGenData): """ Frame qui est créée pour faire des groupes de locus, déterminer leur modèle mutationnel et leur summary statistics """ def __init__(self,parent=None): super(SetGeneticData,self).__init__(parent) self.parent=parent self.parents=Parents(self.parent) # liste des box self.groupList = [] # dicos de frames indexé par les box self.setMutation_dico = {} self.setMutationSeq_dico = {} self.setSum_dico = {}
def generateBugReport(self): current_project = str(self.parent.ui.tabWidget.currentWidget()) fsCoding = getFsEncoding(logLevel=False) fileDial = QFileDialog(self,"Select location of the bug report","%s"%os.path.dirname(str(current_project.dir))) fileDial.setAcceptMode(QFileDialog.AcceptSave) fileDial.setLabelText(QFileDialog.Accept,"Save bug report") fileDial.setLabelText(QFileDialog.FileName,"Bug report name") ok = (fileDial.exec_() == 1) if not ok: return result = fileDial.selectedFiles() if len(result) > 0: path = result[0] tarname = u"%s"%path if not tarname.endswith(u".tar.gz"): tarname += u".tar.gz" repIntoTar = tarname.split("/")[-1].replace(u".tar.gz","") # creation du tar dest = u"%s/bug_report_tmp/"%current_project.dir if os.path.exists(dest.encode(fsCoding)): try : shutil.rmtree(dest.encode(fsCoding)) except : QMessageBox.information(self,'Fatal Error', "Unable to remove previous bug report temporary directory: \n\n %s\n\n Please go to this folder, delete it and try again to create a bug report." % dest) os.mkdir(dest.encode(fsCoding)) tar = tarfile.open(tarname.encode(fsCoding),"w:gz") # copie du header if self.ui.headerYesRadio.isChecked(): if os.path.exists((os.path.expanduser(u"%s/header.txt"%current_project.dir)).encode(fsCoding)): tar.add(os.path.expanduser((u"%s/header.txt"%current_project.dir).encode(fsCoding)),u'%s/header.txt'%repIntoTar) # copie du datafile if self.ui.dataYesRadio.isChecked(): if os.path.exists(str(current_project.dataFileSource).encode(fsCoding)): dataFileName = os.path.basename(current_project.dataFileSource) tar.add(current_project.dataFileSource.encode(fsCoding),u'%s/%s'%(repIntoTar,dataFileName)) # copie du diyabcproject file if os.path.exists((u"%s/%s.diyabcproject"%(current_project.dir,current_project.name)).encode(fsCoding)): dataFileName = os.path.basename(u"%s/%s.diyabcproject"%(current_project.dir,current_project.name)) tar.add(current_project.dataFileSource.encode(fsCoding),u'%s/%s'%(repIntoTar,dataFileName)) # copie des logfiles if os.path.exists(os.path.expanduser((u"%s"%self.parent.logfile)).encode(fsCoding)): tar.add(os.path.expanduser((u"%s"%self.parent.logfile).encode(fsCoding)),u'%s/logfile.txt'%repIntoTar) if os.path.exists((u"%s/command.txt"%(current_project.dir)).encode(fsCoding)): tar.add(os.path.expanduser((u"%s/command.txt"%(current_project.dir)).encode(fsCoding)),u'%s/command.txt'%(repIntoTar)) # config file if os.path.exists(os.path.expanduser((u"~/.diyabc/config.cfg")).encode(fsCoding)): tar.add(os.path.expanduser((u"~/.diyabc/config.cfg").encode(fsCoding)),u'%s/config.cfg'%repIntoTar) # creation de la desc cause = "" if self.ui.originInterfRadio.isChecked(): cause = "interface" else: cause = "computations" osname = sys.platform version_info = VERSION + " " + VERSION_DATE name = "%s"%self.ui.nameLabel.text() email = "%s"%self.ui.emailLabel.text() desc = "%s"%self.ui.descEdit.toPlainText() descf = open("%sdescription.txt"%dest,'w') infos= "Name : %s\nEmail : %s\nVersion : %s\nOS : %s\nCause : %s\n\n"%(name,email,version_info,osname,cause) descf.write(infos.encode('utf-8')) descf.write(desc.encode('utf-8')) descf.close() tar.add(os.path.expanduser((u"%sdescription.txt"%dest).encode(fsCoding)),u'%s/description.txt'%repIntoTar) # les .out listf = os.listdir((u"%s"%current_project.dir).encode(fsCoding)) for fname in listf: if fname.startswith("conf."): tar.add(os.path.expanduser((u"%s/%s"%(current_project.dir,fname)).encode(fsCoding)),u'%s/%s'%(repIntoTar,fname)) if fname.endswith(u".out"): tar.add(os.path.expanduser((u"%s/%s"%(current_project.dir,fname)).encode(fsCoding)),u'%s/%s'%(repIntoTar,fname)) tar.close() shutil.rmtree(dest.encode(fsCoding)) output.notify(self,"Thank you","Thank you for creating a bug report : %s, please send it to the development team : [email protected]"%tarname) ## envoi par http : #ft = open(tarname,'r') #ftc = ft.read() #ft.close() #url = 'http://privas.dyndns.info/~julien/ff/write.php' #values = {"file":ftc} #data = urllib.urlencode(values) #req = urllib2.Request(url, data) #try: # response = urllib2.urlopen(req) #except Exception as e: # output.notify(self,"Thank you","Thank you for creating a bug report, please send it to the development team because the sending process went wrong\n\n%s"%str(e).decode("utf-8")) # self.close() # return #the_page = response.read() #if the_page.strip() == "OK": # output.notify(self,"Thank you","Thank you for creating a bug report, it was successfully sent to our development team !") self.close()
# -*- coding: utf-8 -*- import sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.set_condition_ui import Ui_MainWindow import variables from variables import UIPATH from utils.cbgpUtils import getLastRevisionDate,getFsEncoding formSetCondition,baseSetCondition= uic.loadUiType((u"%s/setCondition.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class SetCondition(formSetCondition,baseSetCondition): """ Fenetre de definition d'une condition """ def __init__(self,param,target_list,parent=None): super(SetCondition,self).__init__(parent) self.parent=parent self.param = param self.target_list = target_list self.createWidgets() def createWidgets(self): self.ui=self self.ui.setupUi(self) self.ui.paramLabel.setText(self.param) for t in self.target_list: self.ui.targetComboBox.addItem(t) QObject.connect(self.ui.cancelButton,SIGNAL("clicked()"),self.close) QObject.connect(self.ui.validateButton,SIGNAL("clicked()"),self.valid)
# -*- coding: utf-8 -*- import sys, codecs from PyQt4 import QtCore, QtGui from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.setMutationModelMsat_ui import Ui_Frame import variables from variables import UIPATH from utils.cbgpUtils import getFsEncoding formSetMutationModelMsat,baseSetMutationModelMsat = uic.loadUiType((u"%s/setMutationModelMsat.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class SetMutationModelMsat(formSetMutationModelMsat,baseSetMutationModelMsat): """ définition du modèle mutationnel pour les microsats """ def __init__(self,parent=None,box_group=None): super(SetMutationModelMsat,self).__init__(parent) self.parent=parent self.box_group = box_group self.createWidgets() def createWidgets(self): self.ui=self self.ui.setupUi(self) QObject.connect(self.ui.exitButton,SIGNAL("clicked()"),self.exit) QObject.connect(self.ui.clearButton,SIGNAL("clicked()"),self.clear) QObject.connect(self.ui.okButton,SIGNAL("clicked()"),self.validate)
import re, sys, codecs from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic #from uis.setupEstimationBias_ui import Ui_Frame from genericScenarioSelection import GenericScenarioSelection from summaryStatistics.setSummaryStatisticsMsatAnalysis import SetSummaryStatisticsMsatAnalysis from summaryStatistics.setSummaryStatisticsSeqAnalysis import SetSummaryStatisticsSeqAnalysis from summaryStatistics.setSummaryStatisticsSnpAnalysis import SetSummaryStatisticsSnpAnalysis import output from utils.cbgpUtils import log,getFsEncoding import variables from variables import UIPATH formSetupEstimationBias,baseSetupEstimationBias = uic.loadUiType((u"%s/setupEstimationBias.ui"%UIPATH).encode(getFsEncoding(logLevel=False))) class SetupEstimationBias(formSetupEstimationBias,baseSetupEstimationBias): """ dernière étape de définition d'une analyse de type estimation ou bias precision ou model checking """ def __init__(self,analysis,parent=None): super(SetupEstimationBias,self).__init__(parent) self.parent=parent self.analysis = analysis self.scNumList = [] self.dico_values = {} self.createWidgets() self.ui.verticalLayout_3.setAlignment(Qt.AlignHCenter) self.ui.verticalLayout_3.setAlignment(Qt.AlignTop) self.restoreAnalysisValues()
def __init__(self, parent=None, configfile=None): super(Preferences, self).__init__(parent, configfile) self.fsCoding = getFsEncoding(logLevel=False) f = open((DATAPATH + u"/txt/launch_header_cluster.sh").encode(self.fsCoding), "r") self.DEFAULT_FIRST_PART_SCRIPT_CLUSTER = f.read() f.close() f = open((DATAPATH + u"/txt/launch_body_cluster.sh").encode(self.fsCoding), "r") self.DEFAULT_SECOND_PART_SCRIPT_CLUSTER = f.read() f.close() self.tabColor = { "green": "#c3ffa6", "blue": "#7373ff", "red": "#ffb2a6", "yellow": "#ffffb2", "pink": "#ffbff2", } # initialisation du combo pour le nombre max de thread try: nb_core = multiprocessing.cpu_count() except Exception as e: nb_core = 1 log(3, "Impossible to count core number on this computer") dicoValTxtMaxThread = {} for i in range(1, nb_core + 1): dicoValTxtMaxThread[str(i)] = str(i) dicoValTxtLogLvl = { "1": "1 : Human actions", "2": "2 : High level actions (file read, checks)", "3": "3 : Small actions", "4": "4 : Details", } formats = ["pdf", "svg", "jpg", "png"] dicoValTxtFormat = {} for i in formats: dicoValTxtFormat[i] = i self.styles = [] for i in QStyleFactory.keys(): self.styles.append(str(i)) default_style = None if "Cleanlooks" in self.styles: default_style = "Cleanlooks" dicoValTxtStyle = {} for i in self.styles: dicoValTxtStyle[i] = i colors = ["default", "white"] colors.extend(self.tabColor.keys()) dicoValTxtColor = {} for i in colors: dicoValTxtColor[i] = i default_font_family = str(self.parent.app.font().family()) if "linux" in sys.platform: default_Psize = "10" default_font_family = "DejaVu Sans" elif "win" in sys.platform and "darwin" not in sys.platform: default_Psize = "8" elif "darwin" in sys.platform: default_Psize = "12" BETWEEN_BRACKETS = re.compile("{.*}") # hashtable contenant les informations des champs dico_fields = OrderedDict( [ ( "various", [ { "proptype": "check", "propname": "useDefaultExecutable", "labelText": "Use default executable", "defaultState": True, }, { "proptype": "pathEdit", "propname": "execPath", "labelText": "Path to the executable file", "default_value": "", "default_explore_path": "~/", }, { "proptype": "combo", "propname": "maxThread", "labelText": "Maximum thread number", "dicoValTxt": dicoValTxtMaxThread, "l_ordered_val": [str(i) for i in range(1, nb_core + 1)], "default_value": str(nb_core), }, { "proptype": "lineEdit", "propname": "particleLoopSize", "labelText": "Particle loop size", "default_value": "100", }, { "proptype": "combo", "propname": "maxLogLvl", "labelText": "Maximum log level", "dicoValTxt": dicoValTxtLogLvl, "l_ordered_val": ["1", "2", "3", "4"], "default_value": "3", }, { "proptype": "check", "propname": "activateWhatsThis", "labelText": "Activate " "what's this" " help functionnality", "defaultState": True, "visible": False, }, { "proptype": "check", "propname": "debugWhatsThis", "labelText": "Show object name in what's this\\n(needs restart)", "defaultState": True, "visible": False, }, { "proptype": "lineEdit", "propname": "nbMaxRecent", "labelText": "Maximum number of memorized recent projects", "default_value": "20", }, { "proptype": "combo", "propname": "picturesFormat", "labelText": "Graphics and pictures save format \\n(scenario trees, PCA graphics)", "dicoValTxt": dicoValTxtFormat, "l_ordered_val": formats, "default_value": "pdf", }, { "proptype": "lineEdit", "propname": "lastOpenFolder", "labelText": "", "default_value": "~/", "visibility": invisible, }, ], ), ( "appearance", [ { "proptype": "check", "propname": "showTrayIcon", "labelText": "Show tray icon", "defaultState": False, }, { "proptype": "combo", "propname": "style", "labelText": "Style", "dicoValTxt": dicoValTxtStyle, "l_ordered_val": self.styles, "default_value": default_style, }, { "proptype": "lineEdit", "propname": "fontFamily", "labelText": "Application font family\\n(needs restart)", "default_value": default_font_family, "visibility": invisible, }, { "proptype": "lineEdit", "propname": "fontSize", "labelText": "Application point font size\\n(needs restart)", "default_value": default_Psize, "visibility": invisible, }, { "proptype": "lineEdit", "propname": "fontStrikeOut", "labelText": "rien", "default_value": "False", "visibility": invisible, }, { "proptype": "lineEdit", "propname": "fontUnderline", "labelText": "rien", "default_value": "False", "visibility": invisible, }, { "proptype": "lineEdit", "propname": "fontBold", "labelText": "rien", "default_value": "False", "visibility": invisible, }, { "proptype": "lineEdit", "propname": "fontItalic", "labelText": "rien", "default_value": "False", "visibility": invisible, }, { "proptype": "combo", "propname": "backgroundColor", "labelText": "Window background color", "dicoValTxt": dicoValTxtColor, "l_ordered_val": colors, "default_value": "default", }, ], ), ( "cluster", [ { "proptype": "check", "propname": "useCluster", "labelText": "Use a cluster (don't check if you don't know what it is)", "defaultState": False, }, { "proptype": "lineEdit", "propname": "numSimulatedDataSetByJob", "labelText": "Number of simulations per job (granularity)", "default_value": "50000", }, { "proptype": "lineEdit", "propname": "coresPerJob", "labelText": "Number of CPU cores per job", "default_value": "1", }, { "proptype": "lineEdit", "propname": "maxConcurrentJobs", "labelText": "Maximum number of jobs running a the same time in the cluster (number of RNG's to generate)", "default_value": "200", }, { "proptype": "lineEdit", "propname": "seed", "labelText": "First seed of the random number generators (if set to negative then a random seed will be used)", "default_value": "-1", }, { "proptype": "combo", "propname": "clusterBinLocation", "labelText": "The diyabc binary is on :", "dicoValTxt": {"cluster": "cluster", "local": "local"}, "l_ordered_val": ["cluster", "local"], "default_value": "cluster", }, { "proptype": "lineEdit", "propname": "diyabcPathCluster", "labelText": "Absolute path to the diyabc binary on the cluster", "default_value": "", }, { "proptype": "pathEdit", "propname": "diyabcPathLocal", "labelText": "Path to the diyabc binary on your computer (local)", "default_value": "", }, { "proptype": "textEdit", "propname": "scriptMasterFirst", "labelText": "NOT EDITABLE !\\nFirst part of the script\\n to run on your cluster master node\\n\\n(this first part will be merged\\nwith the second part in order\\nto obtain the launch.sh script)", "default_value": """\\n""".join( BETWEEN_BRACKETS.sub("", self.DEFAULT_FIRST_PART_SCRIPT_CLUSTER).splitlines() ), "visibility": False, "readOnly": True, "toBeSaved": False, }, { "proptype": "textEdit", "propname": "scriptMasterLast", "labelText": "Second part of the script\\nto run on master node\\n\\nModify it in order to fit\\n your cluster scheduler\\n(ask your cluster administrator)", "default_value": """\\n""".join(self.DEFAULT_SECOND_PART_SCRIPT_CLUSTER.splitlines()), "visibility": True, }, ], ), ] ) self.digest(dico_fields) QObject.connect(self.ui.styleCombo, SIGNAL("currentIndexChanged(QString)"), self.changeStyle) self.changeStyle(self.ui.styleCombo.currentText()) QObject.connect(self.ui.maxLogLvlCombo, SIGNAL("currentIndexChanged(int)"), self.changeLogLevel) QObject.connect( self.ui.backgroundColorCombo, SIGNAL("currentIndexChanged(QString)"), self.changeBackgroundColor ) self.changeLogLevel(self.ui.maxLogLvlCombo.currentIndex()) QObject.connect(self.ui.useClusterCheck, SIGNAL("toggled(bool)"), self.toggleCluster) QObject.connect(self.ui.numSimulatedDataSetByJobEdit, SIGNAL("textChanged(QString)"), self.checkClusterValues) QObject.connect(self.ui.coresPerJobEdit, SIGNAL("textChanged(QString)"), self.checkClusterValues) QObject.connect(self.ui.maxConcurrentJobsEdit, SIGNAL("textChanged(QString)"), self.checkClusterValues) QObject.connect(self.ui.seedEdit, SIGNAL("textChanged(QString)"), self.checkClusterValues) QObject.connect( self.ui.clusterBinLocationCombo, SIGNAL("currentIndexChanged(QString)"), self.toggleBinClusterPath ) QObject.connect(self.ui.diyabcPathLocalPathEdit, SIGNAL("textChanged(QString)"), self.checkClusterValues) QObject.connect(self.ui.useDefaultExecutableCheck, SIGNAL("toggled(bool)"), self.toggleExeSelection) QObject.connect(self.ui.activateWhatsThisCheck, SIGNAL("toggled(bool)"), self.toggleWtSelection) QObject.connect(self.ui.showTrayIconCheck, SIGNAL("toggled(bool)"), self.toggleTrayIconCheck) self.qfd = QFontDialog(self.parent.app.font()) fontButton = QPushButton("Change font options (needs restart)") self.verticalLayoutScroll_appearance.addWidget(fontButton) QObject.connect(fontButton, SIGNAL("clicked()"), self.changeFontOptions) self.updateFont() self.toggleCluster(self.ui.useClusterCheck.isChecked()) self.toggleBinClusterPath(self.ui.clusterBinLocationCombo.currentText()) self.toggleExeSelection(self.ui.useDefaultExecutableCheck.isChecked()) self.toggleWtSelection(self.ui.activateWhatsThisCheck.isChecked()) self.hist_model = uic.loadUi("%s/historical_preferences_frame.ui" % UIPATH) self.hist_model.setObjectName("tab_historical") self.ui.tabWidget.addTab(self.hist_model, "Historical") self.hist_model.verticalLayout.setAlignment(Qt.AlignTop) self.mutmodM = SetMutationModelMsat(self) self.mutmodS = SetMutationModelSequences(self) self.mutmodM.setObjectName("tab_mmm") self.mutmodS.setObjectName("tab_mms") self.ui.tabWidget.addTab(self.mutmodM, "MM Microsats") self.ui.tabWidget.addTab(self.mutmodS, "MM Sequences") self.ui.tabWidget.setMovable(True) self.mutmodM.ui.frame_6.hide() self.mutmodM.ui.setMutMsLabel.setText("Default values for mutation model of Microsatellites") self.mutmodS.ui.frame_6.hide() self.mutmodS.ui.setMutSeqLabel.setText("Default values for mutation model of Sequences") # gestion du bouton "set default values" self.ui.defaultPreferencesButton = QPushButton(self.frame_button) self.ui.defaultPreferencesButton.setText("Reset default values") self.ui.defaultPreferencesButton.setObjectName("defaultPreferencesButton") self.ui.bottomButtonsLayout.insertWidget(1, self.ui.defaultPreferencesButton) QObject.connect(self.ui.defaultPreferencesButton, SIGNAL("clicked()"), self.setDefaultPreferences)