Пример #1
0
 def __init__(self, mode="PF2", parent=None):
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     super(PartitionEditor, self).__init__(parent)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     self.resize(400, 600)
     self.setWindowFlags(self.windowFlags() | Qt.WindowMinMaxButtonsHint)
     self.setupUi(self)
     self.header = ["Name", "", "Start", "", "Stop"]
     self.pushButton_2.clicked.connect(self.addRow)
     self.pushButton.clicked.connect(self.deleteRow)
     self.pushButton_recog.clicked.connect(self.recogFromText)
     self.pushButton_codon.clicked.connect(self.ToCodonMode)
     self.pushButton_nocodon.clicked.connect(self.CancelCodonMode)
     self.data_type = "NUC"
     self.mode = mode
     ## brief demo
     country = self.factory.path_settings.value("country", "UK")
     url = "http://phylosuite.jushengwu.com/dongzhang0725.github.io/documentation/#5-10-2-Brief-tutorial-for-partition-editor" if \
         country == "China" else "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-10-2-Brief-tutorial-for-partition-editor"
     self.label_4.clicked.connect(
         lambda: QDesktopServices.openUrl(QUrl(url)))
Пример #2
0
 def __init__(self, **kwargs):
     self.factory = Factory()
     self.dict_args = kwargs
     self.outpath = self.dict_args["exportPath"]
     self.dict_species = {}
     self.dict_statistics = dict(prefix='taxon')
     self.partition_style = '***partitionfinder style***\n'
     self.partition_codon = "\n***codon style***\n"
     self.bayes_style = '\n***bayes style***\n'
     self.bayes_codon = "\n***bayes codon style***\n"
     self.iqtree_style = '\n***IQ-TREE style***\n#nexus\nbegin sets;\n'
     self.iqtree_codon = "\n***IQ-TREE codon style***\n#nexus\nbegin sets;\n"
     self.parent = self.dict_args["parent"]
     self.partition_name = ''
     self.partition_codname = ""
     self.gene_index = []
     self.dist_warning_message = OrderedDict()
     self.error_message = ""
     self.parsefmt = Parsefmt(self.error_message)
     self.dict_genes_alignments = OrderedDict()
     self.unaligned = False
     self.unaligns = []
     self.exportName = self.dict_args["export_name"]
     self.interrupt = False
     self.list_empty_files = []
     for num, eachFile in enumerate(self.dict_args["files"]):
         if self.interrupt:
             break
         geneName = os.path.splitext(os.path.basename(eachFile))[0]
         dict_taxon = self.parsefmt.readfile(eachFile)
         set_length = set([len(dict_taxon[i]) for i in dict_taxon])
         if set_length == {0}:
             self.list_empty_files.append(os.path.basename(eachFile))
             continue
         self.error_message += self.parsefmt.error_message
         if self.factory.is_aligned(dict_taxon):
             self.dict_genes_alignments[geneName] = dict_taxon
         else:
             self.unaligned = True
             self.unaligns.append(geneName)
     if self.list_empty_files:
         if len(self.list_empty_files) == 1:
             text = "The empty file \"%s\" will be ignored" % self.list_empty_files[
                 0]
         else:
             file_names = "\", \"".join(
                 self.list_empty_files[:-1]
             ) + "\" and \"%s\"" % self.list_empty_files[-1]
             text = "The empty files \"%s will be ignored" % file_names
         QMetaObject.invokeMethod(self.parent, "popupEmptyFileWarning",
                                  Qt.BlockingQueuedConnection,
                                  Q_ARG(str, text))
     if self.unaligned:
         self.dict_args["unaligned_signal"].emit(self.unaligns)
     if self.dict_genes_alignments:
         self.supplement()
         self.concatenate()
         self.ok = True
     else:
         self.ok = False
Пример #3
0
def main():
    args = parse_args()
    set_global_seeds(666)
    config = get_config(args.config)
    device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
    runner = PytorchInference(device)

    test_loader = make_data(**config['data_params'], mode='test')
    weights_paths = collect_weight_paths(args.path, args.fold)

    os.makedirs(args.output, exist_ok=True)
    predictions = defaultdict(lambda: {'mask': 0, 'empty': 0})
    for i, weights_path in enumerate(weights_paths):
        torch.cuda.empty_cache()
        print(f'weights: {weights_path}')
        config['train_params']['weights'] = weights_path
        factory = Factory(config['train_params'])
        model = factory.make_model(device)
        for result in tqdm(iterable=runner.predict(model, test_loader),
                           total=len(test_loader) *
                           config['data_params']['batch_size']):
            ensemble_mask = (predictions[result['image_id']]['mask'] * i +
                             result['mask']) / (i + 1)
            ensemble_empty = (predictions[result['image_id']]['empty'] * i +
                              result['empty']) / (i + 1)
            predictions[result['image_id']]['mask'] = ensemble_mask
            predictions[result['image_id']]['empty'] = ensemble_empty
    mmcv.dump(dict(predictions), osp.join(args.output,
                                          f'fold_{args.fold}.pkl'))
Пример #4
0
 def __init__(self, exportPath=None, parent=None):
     super(Lg_addFiles, self).__init__(parent)
     self.factory = Factory()
     self.parent = parent
     self.thisPath = self.factory.thisPath
     self.exportPath = exportPath
     # 保存设置
     self.addFiles_settings = QSettings(
         self.thisPath +
         '/settings/addFiles_settings.ini',
         QSettings.IniFormat)
     self.closeGUI_signal.connect(self.close)
     self.progressDiologSig.connect(self.runProgressDialog)
     # self.close() 不能在信号槽里面
     self.fastaDownloadFinishedSig.connect(self.parent.setTreeViewFocus)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss', encoding="utf-8", errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     self.setupUi(self)
     self.guiRestore()
     self.exception_signal.connect(self.popupException)
     self.interrupt = False
     self.label_3.clicked.connect(lambda : QDesktopServices.openUrl(QUrl(
         "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#4-3-1-1-Brief-example")))
Пример #5
0
 def __init__(self,
              workPath=None,
              focusSig=None,
              autoFiles=None,
              parent=None):
     super(ConvertFMT, self).__init__(parent)
     self.parent = parent
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig
     self.autoFiles = autoFiles
     self.setupUi(self)
     # 保存设置
     self.convertFmt_settings = QSettings(
         self.thisPath + '/settings/convertFmt_settings.ini',
         QSettings.IniFormat)
     # File only, no fallback to registry or or.
     self.convertFmt_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.exception_signal.connect(self.popupException)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.comboBox_4.installEventFilter(self)
     self.comboBox_4.lineEdit().autoDetectSig.connect(
         self.popupAutoDec)  #自动识别可用的输入
     self.unalignedSig.connect(self.popupUnaligns)
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     self.label_2.clicked.connect(lambda: QDesktopServices.openUrl(
         QUrl(
             "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-8-1-Brief-example"
         )))
     ##自动弹出识别文件窗口
     self.auto_popSig.connect(self.popupAutoDecSub)
Пример #6
0
 def __init__(self,
              autoInputs=None,
              workPath=None,
              focusSig=None,
              RscriptPath=None,
              parent=None):
     super(DrawRSCUfig, self).__init__(parent)
     self.parent = parent
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig
     self.autoInputs = autoInputs
     self.RscriptPath = RscriptPath
     self.setupUi(self)
     # 保存设置
     self.DrawRSCUfig_settings = QSettings(
         self.thisPath + '/settings/DrawRSCUfig_settings.ini',
         QSettings.IniFormat)
     # File only, no fallback to registry or or.
     self.DrawRSCUfig_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.exception_signal.connect(self.popupException)
     self.warning_signal.connect(self.popupWarning)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.listWidget_3.installEventFilter(self)
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     country = self.factory.path_settings.value("country", "UK")
     url = "http://phylosuite.jushengwu.com/dongzhang0725.github.io/documentation/#5-14-3-1-Brief-example" if \
         country == "China" else "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-14-3-1-Brief-example"
     self.label_2.clicked.connect(
         lambda: QDesktopServices.openUrl(QUrl(url)))
Пример #7
0
def main():
    args = parse_args()
    set_global_seeds(666)
    config = get_config(args.config)
    pprint(config)
    config['train_params'][
        'name'] = f'{config["train_params"]["name"]}/fold{args.fold}'
    factory = Factory(config['train_params'])
    data_factory = DataFactory(config['data_params'], fold=args.fold)
    device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
    callbacks = create_callbacks(config['train_params']['name'],
                                 config['dumps'])
    trainer = Runner(stages=config['stages'],
                     factory=factory,
                     callbacks=callbacks,
                     device=device)
    trainer.fit(data_factory)
Пример #8
0
 def __init__(self, unRecognisetRNA=None, gbContent=None, predict_signal=None, parent=None):
     super(Lg_ReANNT, self).__init__(parent)
     # self.thisPath = os.path.dirname(os.path.realpath(__file__))
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.setupUi(self)
     self.textBrowser.setText(unRecognisetRNA)
     self.gbContent = gbContent
     self.predict_signal = predict_signal
     self.totaltRNA = unRecognisetRNA.count(">")
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss', encoding="utf-8", errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 信号和槽
     self.progressSig.connect(self.normProgress)
     self.close_sig.connect(self.closeWindow)
     self.exception_signal.connect(self.popupException)
Пример #9
0
 def __init__(self, nmlgb):
     self.dict_args = nmlgb.dict_args
     super(GbEditor, self).__init__(self.dict_args["parent"])
     # self.thisPath = os.path.dirname(os.path.realpath(__file__))
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     # 保存设置
     self.gbEditor_settings = QSettings(self.thisPath +
                                        '/settings/gbEditor_settings.ini',
                                        QSettings.IniFormat,
                                        parent=self)
     # File only, no fallback to registry or or.
     self.gbEditor_settings.setFallbacksEnabled(False)
     self.settings_ini = QSettings(
         self.thisPath + '/settings/setting_settings.ini',
         QSettings.IniFormat)
     self.settings_ini.setFallbacksEnabled(False)
     self.setupUi(self)
     self.allcontent = nmlgb.allContent
     self.errors = nmlgb.errors
     self.warings = nmlgb.warnings
     self.unRecognisetRNA = nmlgb.unRecognisetRNA
     self.dict_replace = nmlgb.dict_replace
     self.workPath = self.dict_args["outpath"]
     self.showOn()
     # 信号和槽
     self.progressSig.connect(self.normProgress)
     self.findSig.connect(self.popupFindOver)
     self.predict_signal.connect(self.reANNT_validate)
     self.exception_signal.connect(
         lambda x: self.factory.popupException(self, x))
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     self.installEventFilter(self)
     self.guiRestore()
     self.checkBox.toggled.connect(self.askRemoveMisc)
     self.removeMISC = False
Пример #10
0
 def __init__(self, parent=None):
     super(Launcher, self).__init__(parent)
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     # self.thisPath = os.path.dirname(os.path.realpath(__file__))
     self.launcher_settings = QSettings(
         self.thisPath + '/settings/launcher_settings.ini',
         QSettings.IniFormat)
     # File only, no fallback to registry or or.
     self.launcher_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     self.setupUi(self)
     self.guiRestore()
     if platform.system().lower() == "darwin":
         cursor = self.textEdit.textCursor()
         self.textEdit.selectAll()
         self.textEdit.setFontPointSize(12)
         self.textEdit.setTextCursor(cursor)
Пример #11
0
 def __init__(self, workPath=None, parent=None):
     super(DisplaySettings, self).__init__(parent)
     # self.thisPath = os.path.dirname(os.path.realpath(__file__))
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.parent = parent
     self.workPath = workPath
     self.setupUi(self)
     # 设置比例
     self.splitter.setStretchFactor(1, 7)
     # 保存主界面设置
     self.data_settings = QSettings(
         self.factory.workPlaceSettingPath + os.sep + 'data_settings.ini',
         QSettings.IniFormat)
     # File only, no fallback to registry or or.
     self.data_settings.setFallbacksEnabled(False)
     # 保存设置
     self.display_settings = QSettings(
         self.thisPath + '/settings/display_settings.ini',
         QSettings.IniFormat)
     # File only, no fallback to registry or or.
     self.display_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.listWidget.installEventFilter(self)
     ## brief demo
     country = self.factory.path_settings.value("country", "UK")
     url = "http://phylosuite.jushengwu.com/dongzhang0725.github.io/documentation/#4-4-2-Information-display-and-modification" if \
         country == "China" else "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#4-4-2-Information-display-and-modification"
     self.label_6.clicked.connect(
         lambda: QDesktopServices.openUrl(QUrl(url)))
Пример #12
0
    def __init__(self, workPath=None, parent=None):
        super(SerhNCBI, self).__init__(parent)
        # self.thisPath = os.path.dirname(os.path.realpath(__file__))
        self.parent = parent
        self.factory = Factory()
        self.thisPath = self.factory.thisPath
        self.workPath = workPath
        self.setupUi(self)
        # 保存设置
        self.serhNCBI_settings = QSettings(
            self.thisPath + '/settings/serhNCBI_settings.ini',
            QSettings.IniFormat)
        # File only, no fallback to registry or or.
        self.serhNCBI_settings.setFallbacksEnabled(False)
        # 开始装载样式表
        with open(self.thisPath + os.sep + 'style.qss',
                  encoding="utf-8",
                  errors='ignore') as f:
            self.qss_file = f.read()
        self.setStyleSheet(self.qss_file)
        # 恢复用户的设置
        self.guiRestore()
        self.exception_signal.connect(self.popupException)
        # self.progressSig.connect(self.runProgress)
        # self.logGuiSig.connect(self.addText2Log)
        self.lineEdit.buttonSearch.clicked.connect(lambda: [
            self.startSearch(),
            self.sync_completer_texts(self.lineEdit.text())
        ])
        self.lineEdit.buttonStop.clicked.connect(self.stopSearch)
        # self.lineEdit.completer().popup().show()
        # self.lineEdit.clicked.connect(lambda : self.lineEdit.completer().popup())
        self.dict_ncbi_headers = {
            "GBSeq_accession-version": "ID",
            "GBSeq_definition": "Description",
            "GBSeq_organism": "Organism",
            "GBSeq_length": "Length",
            "GBSeq_update-date": "Update date",
            "GBSeq_taxonomy": "Taxonomy",
            "GBSeq_create-date": "Create date",
            "GBSeq_moltype": "Molecular type",
            "GBSeq_topology": "Topology",
            "GBSeq_references": "References",
            "GBSeq_source": "Source",
            "GBSeq_keywords": "Keywords",
            "GBSeq_project": "Project",
            "GBSeq_other-seqids": "Other IDs",
            "GBSeq_strandedness": "Strandedness",
            "GBSeq_comment": "Comments"
        }
        self.init_list()
        self.updateSig.connect(self.updateTable)
        self.searchSig.connect(self.ctrlSearchState)
        self.progressBarSig.connect(self.searchProgress)
        self.progressDiologSig.connect(self.runProgressDialog)
        self.spinBox.valueChanged.connect(self.sync_display_items)
        self.ctrlItemsSig.connect(self.ctrlItems)
        # self.downloadFinished.connect(self.downloadDone)
        self.fastaDownloadFinishedSig.connect(self.parent.setTreeViewFocus)
        self.NCBI_model = MyNCBITableModel([self.list_table_header],
                                           parent=self)
        self.tableView.setModel(self.NCBI_model)
        header = CheckBoxHeader(parent=self.tableView)
        header.clicked.connect(self.check_displayed)
        self.tableView.setHorizontalHeader(header)
        self.NCBI_model.checkedChanged.connect(self.ctrl_text)
        self.interrupt = False
        ##下载的状态
        widget = QWidget(self)
        horizBox = QHBoxLayout(widget)
        horizBox.setContentsMargins(0, 0, 0, 0)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.disp_check_label = QLabel(
            "<span style='font-weight:600; color:red;'>Searching...</span>",
            self)
        self.disp_check_gifLabel = QLabel(self)
        movie = QMovie(":/picture/resourses/Spinner-1s-34px.gif")
        self.disp_check_gifLabel.setMovie(movie)
        self.disp_check_progress = QProgressBar(self)
        self.disp_check_progress.setFixedWidth(100)
        movie.start()
        horizBox.addItem(spacerItem)
        horizBox.addWidget(self.disp_check_gifLabel)
        horizBox.addWidget(self.disp_check_label)
        horizBox.addWidget(self.disp_check_progress)
        self.statusbar.addPermanentWidget(widget)
        self.disp_check_label.setVisible(False)
        self.disp_check_gifLabel.setVisible(False)
        self.disp_check_progress.setVisible(False)
        self.lineEdit.installEventFilter(self)
        self.spinBox.installEventFilter(self)
        table_popMenu = QMenu(self)
        table_popMenu.setToolTipsVisible(True)
        OpenID = QAction(QIcon(":/seq_Viewer/resourses/field-Display.png"),
                         "Open in NCBI webpage",
                         self,
                         triggered=self.openID)
        OpenID.setToolTip("Open sequence in NCBI webpage")
        table_popMenu.addAction(OpenID)

        def table_popmenu(qpoint):
            if self.tableView.indexAt(qpoint).isValid():
                table_popMenu.exec_(QCursor.pos())

        self.tableView.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tableView.customContextMenuRequested.connect(table_popmenu)
        # self.tableView.horizontalHeader().resizeSection(1, 300)
        # self.tableView.horizontalHeader().resizeSection(2, 80)
        # ##增加check按钮
        # self.check_all = QCheckBox("Check/Uncheck", self)
        # self.check_all.toggled.connect(self.check_displayed)
        # self.statusbar.addWidget(self.check_all)
        ## brief demo
        self.label_6.clicked.connect(lambda: QDesktopServices.openUrl(
            QUrl(
                "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#4-3-3-1-Brief-example"
            )))
Пример #13
0
 def __init__(self,
              files=None,
              workPath=None,
              focusSig=None,
              workflow=False,
              parent=None):
     super(Matrix, self).__init__(parent)
     self.parent = parent
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     # 保存设置
     if not workflow:
         self.concatenate_settings = QSettings(
             self.thisPath + '/settings/concatenate_settings.ini',
             QSettings.IniFormat)
     else:
         self.concatenate_settings = QSettings(
             self.thisPath + '/settings/workflow_settings.ini',
             QSettings.IniFormat)
         self.concatenate_settings.beginGroup("Workflow")
         self.concatenate_settings.beginGroup("temporary")
         self.concatenate_settings.beginGroup('Concatenate Sequence')
     # File only, no fallback to registry or or.
     self.concatenate_settings.setFallbacksEnabled(False)
     self.setupUi(self)
     self.files = files
     self.workPath = workPath
     self.focusSig = focusSig if focusSig else pyqtSignal(
         str)  # 为了方便workflow
     self.workflow = workflow
     # 恢复用户的设置
     self.guiRestore()
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     self.groupBox_top_line.setStyleSheet('''QGroupBox{
     border-bottom:none;
     border-right:none;
     border-left:none;
     }
     QGroupBox::title{
     subcontrol-origin: margin;
     subcontrol-position: top left;
     }''')
     self.unalignedSig.connect(self.unaligned)
     self.exception_signal.connect(self.popupException)
     # self.warning_signal.connect(self.popupWarning)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.comboBox_4.installEventFilter(self)
     self.comboBox_4.lineEdit().autoDetectSig.connect(
         self.popupAutoDec)  #自动识别可用的输入
     ##设置拖拽排序
     self.comboBox_4.view().setDragEnabled(True)
     self.comboBox_4.view().setDragDropMode(QAbstractItemView.InternalMove)
     self.comboBox_4.view().setDefaultDropAction(Qt.MoveAction)
     # self.comboBox_4.view().setSelectionMode(QAbstractItemView.MultiSelection)
     self.comboBox_4.view().installEventFilter(self)
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     self.label_2.clicked.connect(lambda: QDesktopServices.openUrl(
         QUrl(
             "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-7-1-Brief-example"
         )))
Пример #14
0
    def __init__(
            self,
            gb_files=None,
            list_names=None,
            workPath=None,
            totleID=None,
            clearFolderSig=None,
            focusSig=None,
            parent=None):
        super(ExtractGB, self).__init__(parent)
        self.parent = parent
        self.setupUi(self)
        self.factory = Factory()
        self.thisPath = self.factory.thisPath
        self.gb_files = gb_files
        self.workPath = workPath
        self.totleID = totleID
        self.clearFolderSig = clearFolderSig
        self.list_names = list_names
        self.focusSig = focusSig
        self.installEventFilter(self)
        self.dict_icon = {
            "rectangle": ":/itol_domain/resourses/itol/re.png",
            "horizontal hexagon": ":/itol_domain/resourses/itol/hh.png",
            "vertical hexagon": ":/itol_domain/resourses/itol/hv.png",
            "ellipse": ":/itol_domain/resourses/itol/el.png",
            "rhombus (diamond)": ":/itol_domain/resourses/itol/di.png",
            "right pointing triangle": ":/itol_domain/resourses/itol/tr.png",
            "left pointing triangle": ":/itol_domain/resourses/itol/tl.png",
            "left pointing pentagram": ":/itol_domain/resourses/itol/pl.png",
            "right pointing pentagram": ":/itol_domain/resourses/itol/pr.png",
            "up pointing pentagram": ":/itol_domain/resourses/itol/pu.png",
            "down pointing pentagram": ":/itol_domain/resourses/itol/pd.png",
            "octagon": ":/itol_domain/resourses/itol/oc.png",
            "rectangle (gap)": ":/itol_domain/resourses/itol/gp.png"}

        self.dict_shape = {
            "rectangle": "RE",
            "horizontal hexagon": "HH",
            "vertical hexagon": "HV",
            "ellipse": "EL",
            "rhombus (diamond)": "DI",
            "right pointing triangle": "TR",
            "left pointing triangle": "TL",
            "left pointing pentagram": "PL",
            "right pointing pentagram": "PR",
            "up pointing pentagram": "PU",
            "down pointing pentagram": "PD",
            "octagon": "OC",
            "rectangle (gap)": "GP"}

        self.showOn()
        self.extractGB_settings = QSettings(
            self.thisPath + '/settings/extractGB_settings.ini', QSettings.IniFormat)
        # File only, no fallback to registry or or.
        self.extractGB_settings.setFallbacksEnabled(False)
        self.settings_ini = QSettings(self.thisPath + '/settings/setting_settings.ini', QSettings.IniFormat)
        self.settings_ini.setFallbacksEnabled(False)
        # 保存主界面设置
        self.mainwindow_settings = QSettings(
            self.thisPath + '/settings/mainwindow_settings.ini', QSettings.IniFormat)
        # File only, no fallback to registry or or.
        self.mainwindow_settings.setFallbacksEnabled(False)
        # 恢复用户的设置
        self.guiRestore()
        # 开始装载样式表
        with open(self.thisPath + os.sep + 'style.qss', encoding="utf-8", errors='ignore') as f:
            self.qss_file = f.read()
        self.setStyleSheet(self.qss_file)

        self.progressSig.connect(self.runProgress)
        self.exception_signal.connect(self.popupException)
        self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
        self.tableWidget_2.installEventFilter(self)
        self.table_popMenu = QMenu(self)
        self.Copy = QAction("Copy", self,
                              statusTip="Copy color(s)",
                              shortcut="Ctrl+C",
                              triggered=self.copyColor)
        self.Cut = QAction("Cut", self,
                              statusTip="Cut color(s)",
                              shortcut="Ctrl+X",
                              triggered=self.cutColor)
        self.Paste = QAction("Paste", self,
                              statusTip="Paste color(s)",
                              shortcut="Ctrl+V",
                              triggered=self.pasteColor)
        self.remove = QAction("Delete", self,
                                  shortcut=QKeySequence.Delete,
                                  statusTip="Remove color(s)",
                                  triggered=self.on_pushButton_9_clicked)
        self.table_popMenu.addAction(self.Copy)
        self.table_popMenu.addAction(self.Cut)
        self.table_popMenu.addAction(self.Paste)
        self.table_popMenu.addAction(self.remove)
        self.tableWidget_2.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tableWidget_2.customContextMenuRequested.connect(lambda x: self.table_popMenu.exec_(QCursor.pos()))
        self.comboBox_6.activated[str].connect(self.switchSeqType)
        # self.checkBox.toggled.connect(self.judgeCodonW)
        self.switchSeqType(self.comboBox_6.currentText())
        # 给开始按钮添加菜单
        menu = QMenu(self)
        menu.setToolTipsVisible(True)
        self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "", menu)
        self.work_action.triggered.connect(lambda: self.factory.swithWorkPath(self.work_action, parent=self))
        self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"), "Output Dir: ", menu)
        self.dir_action.triggered.connect(lambda: self.factory.set_direct_dir(self.dir_action, self))
        menu.addAction(self.work_action)
        menu.addAction(self.dir_action)
        self.pushButton_2.toolButton.setMenu(menu)
        self.pushButton_2.toolButton.menu().installEventFilter(self)
        self.factory.swithWorkPath(self.work_action, init=True, parent=self)  # 初始化一下
        ## brief demo
        self.label_3.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(
            "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-1-1-Brief-example")))
Пример #15
0
 def __init__(self,
              autoInputs=None,
              workPath=None,
              focusSig=None,
              gb_exe=None,
              workflow=False,
              parent=None):
     super(Gblocks, self).__init__(parent)
     self.parent = parent
     self.function_name = "Gblocks"
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig if focusSig else pyqtSignal(
         str)  # 为了方便workflow
     self.workflow = workflow
     self.gb_exe = '"' + gb_exe + '"'
     self.autoInputs = autoInputs
     self.interrupt = False
     self.setupUi(self)
     # 保存设置
     if not workflow:
         self.gblocks_settings = QSettings(
             self.thisPath + '/settings/gblocks_settings.ini',
             QSettings.IniFormat)
     else:
         self.gblocks_settings = QSettings(
             self.thisPath + '/settings/workflow_settings.ini',
             QSettings.IniFormat)
         self.gblocks_settings.beginGroup("Workflow")
         self.gblocks_settings.beginGroup("temporary")
         self.gblocks_settings.beginGroup('Gblocks')
     # File only, no fallback to registry or or.
     self.gblocks_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.log_gui = self.gui4Log()
     self.exception_signal.connect(self.popupException)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.gblocks_exception.connect(self.popup_Gblocks_exception)
     self.progressSig.connect(self.runProgress)
     self.logGuiSig.connect(self.addText2Log)
     self.comboBox_4.installEventFilter(self)
     self.comboBox_4.lineEdit().autoDetectSig.connect(
         self.popupAutoDec)  # 自动识别可用的输入
     # self.comboBox_4.itemRemovedSig.connect(self.auto_parFromfile)
     self.comboBox_2.currentIndexChanged[str].connect(self.comboLink)
     reg_ex = QRegExp(".{,5}")
     validator = QRegExpValidator(reg_ex, self.lineEdit_3)
     self.lineEdit_3.setValidator(validator)
     self.auto_parSig.connect(self.auto_parFromfile)
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     self.label_7.clicked.connect(lambda: QDesktopServices.openUrl(
         QUrl(
             "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-6-1-Brief-example"
         )))
     ##自动弹出识别文件窗口
     self.auto_popSig.connect(self.popupAutoDecSub)
Пример #16
0
def mining():
    factory = Factory(image_shape=(224, 224))
    factory.mining('training')
    factory.mining('validation')
Пример #17
0
 def __init__(self,
              workPath=None,
              TApath=None,
              autoInputs=None,
              focusSig=None,
              workflow=None,
              parent=None):
     super(TrimAl, self).__init__(parent)
     self.parent = parent
     self.function_name = "trimAl"
     self.workflow = workflow
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig
     self.TApath = TApath
     self.autoInputs = autoInputs
     self.setupUi(self)
     # 保存设置
     if not workflow:
         self.trimAl_settings = QSettings(
             self.thisPath + '/settings/trimAl_settings.ini',
             QSettings.IniFormat)
     else:
         self.trimAl_settings = QSettings(
             self.thisPath + '/settings/workflow_settings.ini',
             QSettings.IniFormat)
         self.trimAl_settings.beginGroup("Workflow")
         self.trimAl_settings.beginGroup("temporary")
         self.trimAl_settings.beginGroup('trimAl')
     # File only, no fallback to registry or or.
     self.trimAl_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.exception_signal.connect(self.popupException)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.logGuiSig.connect(self.addText2Log)
     self.trimAl_exception.connect(self.popup_trimAl_exception)
     self.comboBox_4.lineEdit().autoDetectSig.connect(
         self.popupAutoDec)  # 自动识别可用的输入
     self.comboBox_4.installEventFilter(self)
     self.lineEdit_2.installEventFilter(self)
     self.lineEdit_3.installEventFilter(self)
     self.log_gui = self.gui4Log()
     # stat output file name
     self.lineEdit_2.setLineEditNoChange(True)
     self.lineEdit_3.setLineEditNoChange(True)
     self.lineEdit_2.deleteFile.clicked.connect(
         self.clear_lineEdit)  # 删除了内容,也要把tooltip删掉
     self.lineEdit_3.deleteFile.clicked.connect(
         self.clear_lineEdit)  # 删除了内容,也要把tooltip删掉
     # 选框联动
     self.checkBox_2.toggled.connect(self.switchCheckBox1)
     self.checkBox_5.toggled.connect(self.switchCheckBox1)
     # self.groupBox_5.toggled.connect(lambda bool_: self.groupBox_6.setChecked(not bool_))
     # self.groupBox_6.toggled.connect(lambda bool_: self.groupBox_5.setChecked(not bool_))
     self.checkBox_3.toggled.connect(self.switchCheckBox2)
     self.checkBox_6.toggled.connect(self.switchCheckBox2)
     self.checkBox_7.toggled.connect(self.switchCheckBox2)
     self.checkBox_8.toggled.connect(self.switchCheckBox2)
     self.checkBox_9.toggled.connect(self.judgeInput)
     self.radioButton.toggled.connect(self.Un_checkBox_9)
     self.comboBox_2.currentTextChanged.connect(self.judgeComboBox_2)
     self.comboBox.currentTextChanged.connect(self.judgeFormats)
     self.radioButton.toggled.connect(self.controlRefineText)
     self.interrupt = False
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     action = QAction(QIcon(":/picture/resourses/terminal-512.png"),
                      "View | Edit command",
                      menu,
                      triggered=self.showCMD)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(action)
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     self.label_7.clicked.connect(lambda: QDesktopServices.openUrl(
         QUrl(
             "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-4-1-Brief-example"
         )))
     ##自动弹出识别文件窗口
     self.auto_popSig.connect(self.popupAutoDecSub)
Пример #18
0
 def __init__(self,
              workPath=None,
              HmmCleanerPath=None,
              autoInputs=None,
              perl=None,
              focusSig=None,
              workflow=None,
              parent=None):
     super(HmmCleaner, self).__init__(parent)
     self.parent = parent
     self.workflow = workflow
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig
     self.autoInputs = autoInputs
     self.HmmCleanerPath = HmmCleanerPath
     self.perl = perl
     self.setupUi(self)
     # 保存设置
     if not workflow:
         self.HmmCleaner_settings = QSettings(
             self.thisPath + '/settings/HmmCleaner_settings.ini',
             QSettings.IniFormat)
     else:
         self.HmmCleaner_settings = QSettings(
             self.thisPath + '/settings/workflow_settings.ini',
             QSettings.IniFormat)
         self.HmmCleaner_settings.beginGroup("Workflow")
         self.HmmCleaner_settings.beginGroup("temporary")
         self.HmmCleaner_settings.beginGroup('HmmCleaner')
     # File only, no fallback to registry or or.
     self.HmmCleaner_settings.setFallbacksEnabled(False)
     # print(self.HmmCleaner_settings.childGroups())
     # self.factory.settingsGroup2Group(self.HmmCleaner_settings, "PCGs", "temporary")
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.interrupt = False
     self.exception_signal.connect(self.popupException)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.logGuiSig.connect(self.addText2Log)
     self.comboBox_4.installEventFilter(self)
     self.comboBox_4.lineEdit().autoDetectSig.connect(
         self.popupAutoDec)  # 自动识别可用的输入
     self.log_gui = self.gui4Log()
     self.HmmCleaner_exception.connect(self.popup_HmmCleaner_exception)
     self.checkBox_4.toggled.connect(self.popupAliWarning)
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     action = QAction(QIcon(":/picture/resourses/terminal-512.png"),
                      "View | Edit command",
                      menu,
                      triggered=self.showCMD)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(action)
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     self.label_7.clicked.connect(lambda: QDesktopServices.openUrl(
         QUrl(
             "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-5-1-Brief-example"
         )))
Пример #19
0
 def __init__(
         self,
         parent=None):
     super(ExtractSettings, self).__init__(parent)
     # self.thisPath = os.path.dirname(os.path.realpath(__file__))
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.setupUi(self)
     # # 设置比例
     # self.splitter.setStretchFactor(1, 7)
     # 保存主界面设置
     self.GenBankExtract_settings = QSettings(
         self.thisPath + '/settings/GenBankExtract_settings.ini', QSettings.IniFormat)
     # File only, no fallback to registry or or.
     self.GenBankExtract_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss', encoding="utf-8", errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     self.tableView.installEventFilter(self)
     self.tableView.horizontalHeader().setStretchLastSection(True)
     self.listWidget.installEventFilter(self)
     self.listWidget_2.installEventFilter(self)
     tableView_popMenu = QMenu(self)
     edit = QAction("Edit", self,
                         statusTip="Edit select item",
                         triggered=lambda: self.tableView.edit(self.tableView.currentIndex()))
     delete = QAction("Delete", self,
                    shortcut=QKeySequence.Delete,
                    statusTip="Remove select rows",
                    triggered=self.on_toolButton_4_clicked)
     add = QAction("Add row", self,
                    statusTip="Add row",
                    triggered=self.on_toolButton_3_clicked)
     export = QAction("Export", self,
                   statusTip="Export table",
                   triggered=self.on_toolButton_5_clicked)
     import_ = QAction("Import", self,
                   statusTip="Import table",
                   triggered=self.on_toolButton_6_clicked)
     tableView_popMenu.addAction(edit)
     tableView_popMenu.addAction(delete)
     tableView_popMenu.addAction(add)
     tableView_popMenu.addAction(export)
     tableView_popMenu.addAction(import_)
     self.tableView.setContextMenuPolicy(Qt.CustomContextMenu)
     self.tableView.customContextMenuRequested.connect(lambda : tableView_popMenu.exec_(QCursor.pos()))
     self.listWidget.itemRemoveSig.connect(self.depositeData)
     self.listWidget.itemChanged.connect(self.keepMitoFeature)
     self.listWidget.itemSelectionChanged.connect(self.keepMitoFeature)
     self.listWidget_2.itemRemoveSig.connect(self.depositeData)
     self.listWidget_2.model().layoutChanged.connect(self.depositeData)
     self.listWidget_2.model().layoutChanged.connect(self.listWidget_2.refreshBackColors)   ##拖拽以后刷新颜色
     # 恢复用户的设置
     self.checkBox_2.stateChanged.connect(self.change_label3)
     self.checkBox_2.toggled.connect(lambda bool_: self.changeCheckboxSettings("extract all features", bool_))
     self.checkBox.toggled.connect(lambda bool_: self.changeCheckboxSettings("extract listed gene", bool_))
     self.checkBox_3.toggled.connect(lambda bool_: self.changeCheckboxSettings("extract intergenic regions", bool_))
     self.checkBox_4.toggled.connect(lambda bool_: self.changeCheckboxSettings("extract overlapping regions", bool_))
     self.spinBox.valueChanged[int].connect(lambda value: self.changeCheckboxSettings("intergenic regions threshold", value))
     self.spinBox_2.valueChanged[int].connect(
         lambda value: self.changeCheckboxSettings("overlapping regions threshold", value))
     self.guiRestore()
     ## brief demo
     country = self.factory.path_settings.value("country", "UK")
     url = "http://phylosuite.jushengwu.com/dongzhang0725.github.io/PhyloSuite-demo/customize_extraction/" if \
         country == "China" else "https://dongzhang0725.github.io/dongzhang0725.github.io/PhyloSuite-demo/customize_extraction/"
     self.label_6.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(url)))
Пример #20
0
def start():
    app = QSingleApplication(sys.argv)
    splash = QSplashScreen(
        QPixmap(":/picture/resourses/start.jpg"))
    with open(thisPath + os.sep + 'style.qss', encoding="utf-8", errors='ignore') as f:
        qss_file = f.read()
    splash.setWindowFlags(Qt.Window)
    font_size = 13 if platform.system().lower() == "windows" else 15
    splash.setFont(QFont('Arial', font_size))
    splash.setStyleSheet(qss_file)
    icon = QIcon(":/picture/resourses/windowIcon.png")
    splash.setWindowIcon(icon)
    splash.show()
    app.processEvents()
    splash.showMessage("Checking if the program is already running...", Qt.AlignBottom, Qt.black)
    if platform.system().lower() == "windows":
        multiprocessing.freeze_support() # windows必须调用这个,不然会出错
    # 异常调试
    import cgitb
    sys.excepthook = cgitb.Hook(1, None, 5, sys.stderr, 'text')
    ##为了存路径到系统
    QApplication.setApplicationName("PhyloSuite_settings")
    QApplication.setOrganizationName("PhyloSuite")
    QSettings.setDefaultFormat(QSettings.IniFormat)
    path_settings = QSettings()
    path_settings.setValue("thisPath", thisPath)
    os.chdir(thisPath)
    dialog = QDialog()
    dialog.setStyleSheet(qss_file)
    # 异常处理
    def handle_exception(exc_type, exc_value, exc_traceback):
        rgx = re.compile(r'PermissionError.+?[\'\"](.+\.csv)[\'\"]')
        if issubclass(exc_type, KeyboardInterrupt):
            return sys.__excepthook__(exc_type, exc_value, exc_traceback)
        exception = str("".join(traceback.format_exception(
            exc_type, exc_value, exc_traceback)))
        print(exception)
        if rgx.search(exception):
            #忽略csv未关闭的报错
            return
        msg = QMessageBox(dialog)
        msg.setIcon(QMessageBox.Critical)
        msg.setText(
            'The program encountered an unforeseen problem, please report the bug at <a href="https://github.com/dongzhang0725/PhyloSuite/issues">https://github.com/dongzhang0725/PhyloSuite/issues</a> '
            'or send an email with the detailed traceback to [email protected]')
        msg.setWindowTitle("Error")
        msg.setDetailedText(exception)
        msg.setStandardButtons(QMessageBox.Ok)
        msg.exec_()
    sys.excepthook = handle_exception
    # 避免重复运行程序
    if app.isRunning():
        QMessageBox.information(
            dialog,
            "PhyloSuite",
            "<p style='line-height:25px; height:25px'>App is running!</p>")
        sys.exit(0)

    # 界面运行选择
    splash.showMessage("Choosing workplace...", Qt.AlignBottom, Qt.black)
    launcher_settings = QSettings(
        thisPath + '/settings/launcher_settings.ini', QSettings.IniFormat)
    launcher_settings.setFallbacksEnabled(False)
    not_exe_lunch = launcher_settings.value("ifLaunch", "false")
    workPlace = launcher_settings.value(
        "workPlace", [thisPath + os.sep + "myWorkPlace"])
    # 删除无效的路径
    workPlace_copy = deepcopy(workPlace)
    for num,i in enumerate(workPlace_copy):
        if not os.path.exists(i):
            workPlace.remove(i)
        else:
            ##替换带.的路径
            if re.search(r"^\.", i):
                workPlace[num] = os.path.abspath(i)
    # 如果workPlace被删干净了
    if not workPlace:
        workPlace = [thisPath + os.sep + "myWorkPlace"]
    # 重新保存下路径
    if len(workPlace) > 15:
        workPlace = workPlace[:15]  # 只保留15个工作区
    launcher_settings.setValue(
        "workPlace", workPlace)
    if not_exe_lunch == "true":
        splash.showMessage("Starting PhyloSuite...", Qt.AlignBottom, Qt.black)
        myMainWindow = MyMainWindow(workPlace)
        Factory().centerWindow(myMainWindow)
        myMainWindow.show()
        splash.finish(myMainWindow)
        sys.exit(app.exec_())
    else:
        launcher = Launcher()
        if launcher.exec_() == QDialog.Accepted:
            splash.showMessage("Starting PhyloSuite...", Qt.AlignBottom, Qt.black)
            workPlace = launcher.WorkPlace
            myMainWindow = MyMainWindow(workPlace)
            Factory().centerWindow(myMainWindow)
            myMainWindow.show()
            splash.finish(myMainWindow)
            sys.exit(app.exec_())
Пример #21
0
 def __init__(
         self,
         autoMFPath=None,
         partFile=None,
         workPath=None,
         focusSig=None,
         IQ_exe=None,
         workflow=False,
         parent=None):
     super(ModelFinder, self).__init__(parent)
     self.parent = parent
     self.function_name = "ModelFinder"
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig if focusSig else pyqtSignal(
         str)  # 为了方便workflow
     self.workflow = workflow
     self.modelfinder_exe = '"' + IQ_exe + '"'
     self.autoMFPath = autoMFPath[0] if type(autoMFPath) == list else autoMFPath
     self.partFile = partFile
     self.interrupt = False
     self.setupUi(self)
     # 保存设置
     if not workflow:
         self.modelfinder_settings = QSettings(
             self.thisPath + '/settings/modelfinder_settings.ini', QSettings.IniFormat)
     else:
         self.modelfinder_settings = QSettings(
             self.thisPath + '/settings/workflow_settings.ini', QSettings.IniFormat)
         self.modelfinder_settings.beginGroup("Workflow")
         self.modelfinder_settings.beginGroup("temporary")
         self.modelfinder_settings.beginGroup('ModelFinder')
     # File only, no fallback to registry or or.
     self.modelfinder_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss', encoding="utf-8", errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.exception_signal.connect(self.popupException)
     self.iq_tree_exception.connect(self.popup_IQTREE_exception)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.logGuiSig.connect(self.addText2Log)
     self.comboBox_4.installEventFilter(self)
     self.log_gui = self.gui4Log()
     self.lineEdit.installEventFilter(self)
     self.lineEdit.autoDetectSig.connect(self.popupAutoDec)
     self.lineEdit_2.installEventFilter(self)
     self.lineEdit_3.installEventFilter(self)
     self.comboBox_3.activated[str].connect(self.controlCodonTable)
     self.comboBox_5.activated[str].connect(self.ctrl_ratehet)
     self.ctrl_ratehet(self.comboBox_5.currentText())
     self.lineEdit_2.setLineEditNoChange(True)
     self.lineEdit_3.setLineEditNoChange(True)
     self.lineEdit.deleteFile.clicked.connect(
         self.clear_lineEdit)  # 删除了内容,也要把tooltip删掉
     self.lineEdit_2.deleteFile.clicked.connect(
         self.clear_lineEdit)  # 删除了内容,也要把tooltip删掉
     self.lineEdit_3.deleteFile.clicked.connect(
         self.clear_lineEdit)  # 删除了内容,也要把tooltip删掉
     # 初始化codon table的选择
     self.controlCodonTable(self.comboBox_3.currentText())
     self.checkBox.stateChanged.connect(self.switchPart)
     self.switchPart(self.checkBox.isChecked())
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     action = QAction(QIcon(":/picture/resourses/terminal-512.png"), "View | Edit command", menu,
                      triggered=self.showCMD)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "", menu)
     self.work_action.triggered.connect(lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"), "Output Dir: ", menu)
     self.dir_action.triggered.connect(lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(action)
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True, parent=self)  # 初始化一下
     ## brief demo
     self.label_2.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(
         "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-9-1-Brief-example")))
     ##自动弹出识别文件窗口
     self.auto_popSig.connect(self.popupAutoDecSub)
Пример #22
0
 def __init__(self, parent=None):
     super(UpdateAPP, self).__init__(parent)
     self.factory = Factory()
     self.rootPath = self.factory.thisPath
Пример #23
0
 def __init__(self,
              workPath=None,
              focusSig=None,
              workflow=False,
              java=None,
              macseEXE=None,
              autoMFPath=None,
              parent=None):
     super(MACSE, self).__init__(parent)
     self.parent = parent
     self.workflow = workflow
     self.factory = Factory()
     self.thisPath = self.factory.thisPath
     self.workPath = workPath
     self.focusSig = focusSig
     self.java = java
     self.macseEXE = macseEXE
     self.autoMFPath = autoMFPath
     self.setupUi(self)
     # 保存设置
     if not workflow:
         self.MACSE_settings = QSettings(
             self.thisPath + '/settings/MACSE_settings.ini',
             QSettings.IniFormat)
     else:
         self.MACSE_settings = QSettings(
             self.thisPath + '/settings/workflow_settings.ini',
             QSettings.IniFormat)
         self.MACSE_settings.beginGroup("Workflow")
         self.MACSE_settings.beginGroup("temporary")
         self.MACSE_settings.beginGroup('MACSE')
     # File only, no fallback to registry or or.
     self.MACSE_settings.setFallbacksEnabled(False)
     # 开始装载样式表
     with open(self.thisPath + os.sep + 'style.qss',
               encoding="utf-8",
               errors='ignore') as f:
         self.qss_file = f.read()
     self.setStyleSheet(self.qss_file)
     # 恢复用户的设置
     self.guiRestore()
     self.exception_signal.connect(self.popupException)
     self.startButtonStatusSig.connect(self.factory.ctrl_startButton_status)
     self.progressSig.connect(self.runProgress)
     self.logGuiSig.connect(self.addText2Log)
     self.comboBox_4.installEventFilter(self)
     self.comboBox_4.lineEdit().autoDetectSig.connect(
         self.popupAutoDec)  # 自动识别可用的输入
     self.comboBox_5.installEventFilter(self)
     self.comboBox_7.installEventFilter(self)
     self.log_gui = self.gui4Log()
     # self.pushButton_2.clicked.connect(print)
     self.doubleSpinBox_5.valueChanged.connect(self.judgeStopCost)
     self.doubleSpinBox.valueChanged.connect(self.judgeStopCost)
     self.doubleSpinBox_2.valueChanged.connect(self.judgeStoplrCost)
     self.doubleSpinBox_6.valueChanged.connect(self.judgeStoplrCost)
     self.comboBox_5.itemRemovedSig.connect(self.judgeCombobox5)
     self.checkBox_2.toggled.connect(self.controlRefineText)
     self.emptySig.connect(self.popup_MACSE_exception)
     self.interrupt = False
     # 给开始按钮添加菜单
     menu = QMenu(self)
     menu.setToolTipsVisible(True)
     action = QAction(QIcon(":/picture/resourses/terminal-512.png"),
                      "View | Edit command",
                      menu,
                      triggered=self.showCMD)
     self.work_action = QAction(QIcon(":/picture/resourses/work.png"), "",
                                menu)
     self.work_action.triggered.connect(
         lambda: self.factory.swithWorkPath(self.work_action, parent=self))
     self.dir_action = QAction(QIcon(":/picture/resourses/folder.png"),
                               "Output Dir: ", menu)
     self.dir_action.triggered.connect(
         lambda: self.factory.set_direct_dir(self.dir_action, self))
     menu.addAction(action)
     menu.addAction(self.work_action)
     menu.addAction(self.dir_action)
     self.pushButton.toolButton.setMenu(menu)
     self.pushButton.toolButton.menu().installEventFilter(self)
     self.factory.swithWorkPath(self.work_action, init=True,
                                parent=self)  # 初始化一下
     ## brief demo
     self.label_7.clicked.connect(lambda: QDesktopServices.openUrl(
         QUrl(
             "https://dongzhang0725.github.io/dongzhang0725.github.io/documentation/#5-3-1-Brief-example"
         )))