void doJob(const std::string& inputMaf, const std::string& outDir, std::vector<ParamPair> simplParams, std::vector<int> minBlockSizes) { const int MIN_ALIGNMENT = 1; const int MAX_ALIGNMENT_GAP = 0; const auto EMPTY_GROUP = BlockGroups(); BlockGroups blockGroups = EMPTY_GROUP; PermVec currentBlocks; //sort blocks in reverse order (will use it as stack) std::sort(minBlockSizes.begin(), minBlockSizes.end(), std::greater<int>()); makeDirectory(outDir); //read maf alignment and join adjacent columns std::cerr << "\tParsing MAF file\n"; PermVec mafBlocks = mafToPermutations(inputMaf, MIN_ALIGNMENT); compressPaths(mafBlocks, MAX_ALIGNMENT_GAP, currentBlocks, blockGroups); //iterative simplification for (const ParamPair& ppair : simplParams) { if (minBlockSizes.empty()) break; //output blocks of certain size while (!minBlockSizes.empty() && minBlockSizes.back() < ppair.minBlock) { std::string blockDir = outDir + "/" + std::to_string(minBlockSizes.back()); outputBlocks(blockDir, currentBlocks, blockGroups, minBlockSizes.back()); minBlockSizes.pop_back(); } std::cerr << "\tSimplification with " << ppair.minBlock << " " << ppair.maxGap << std::endl; PermVec inputBlocks = filterBySize(currentBlocks, EMPTY_GROUP, ppair.minBlock, true); PermVec outBlocks; blockGroups.clear(); processGraph(inputBlocks, ppair.maxGap, outBlocks, blockGroups); currentBlocks = outBlocks; } //if any left for (int minBlock : minBlockSizes) { std::string blockDir = outDir + "/" + std::to_string(minBlock); outputBlocks(blockDir, currentBlocks, blockGroups, minBlock); } }
void outputBlocks(const std::string& outDir, PermVec& blocks, BlockGroups& groups, int blockSize) { makeDirectory(outDir); std::string permsFile = outDir + "/genomes_permutations.txt"; std::string coordsFile = outDir + "/blocks_coords.txt"; std::string statsFile = outDir + "/coverage_report.txt"; PermVec outPerms = filterBySize(blocks, groups, blockSize, true); renumerate(outPerms); outputPermutation(outPerms, permsFile); outputCoords(outPerms, coordsFile); outputStatistics(outPerms, statsFile); }
bool FilterDialog::validateInputs() { if(!validateSizeInputs()) return false; if(!validateRegexInput()) return false; if(!validatePathInput()) return false; if(sizeRangeGroupBox->isChecked()) emit filterBySize( minFileSizeLineEdit->value(), maxFileSizeLineEdit->value() ); if(typesGroupBox->isChecked()) /* fire */ signalTypesSelection(); if(pathGroupBox->isChecked()) emit filterByPath(folderPathLineEdit->text()); if(regexGroupBox->isChecked()) emit filterByRegex( QRegExp(regexLineEdit->text()) ); return true; }
ActionsButtonPanel::ActionsButtonPanel(QWidget *parent) : QWidget(parent) { //createDefaultExtensions(); QVBoxLayout *mainLayout = new QVBoxLayout(this); filter_pushButton = new QPushButton("&Filter", this); sort_pushButton = new QPushButton("&Sort", this); reset_pushButton = new QPushButton("&Reset", this); markings_pushButton = new QPushButton("Markings", this); autoSelection_pushButton = new QPushButton("&Auto Selection", this); commit_pushButton = new QPushButton("&Commit", this); auto_pushButton = new QPushButton("A&uto", this); filterDialog = new FilterDialog(this); sort_pushButton->setCheckable(true); markings_pushButton->setCheckable(true); autoSelection_pushButton->setCheckable(true); QFrame* line = new QFrame(this); line->setFrameShape(QFrame::HLine); QFrame* line2 = new QFrame(this); line2->setFrameShape(QFrame::HLine); QFrame* line3 = new QFrame(this); line3->setFrameShape(QFrame::HLine); mainLayout->addWidget(commit_pushButton); mainLayout->addWidget(line); mainLayout->addWidget(filter_pushButton); mainLayout->addWidget(sort_pushButton); mainLayout->addWidget(reset_pushButton); mainLayout->addWidget(line2); mainLayout->addWidget(autoSelection_pushButton); mainLayout->addWidget(markings_pushButton); mainLayout->addWidget(line3); mainLayout->addWidget(auto_pushButton); mainLayout->addStretch(); auto_pushButton->setEnabled(false); sortContextMenu.addAction("&Descending Order of File size", this, SLOT(sortByDescendingFileSize())); sortContextMenu.addAction("&Ascending Order of File size", this, SLOT(sortByAscendingFileSize())); autoSelectionContextMenu.addAction("Select Group Keeps", this, SIGNAL(selectGroupKeeps())); autoSelectionContextMenu.addAction("Select Group Deletes", this, SIGNAL(selectGroupDeletes())); autoSelectionContextMenu.addAction("Select Next Group Keeps", this, SIGNAL(selectNextGroupKeeps())); autoSelectionContextMenu.addAction("Select Next Group Deletes", this, SIGNAL(selectNextGroupDeletes())); autoSelectionContextMenu.addAction("Auto Select Next &Possibilities", this, SIGNAL(autoSelectDeletePossibilities())) ;// ->setEnabled(false); autoSelectionContextMenu.addAction("Auto Select Highest &Keeps", this, SIGNAL(autoSelectNextKeeps())); autoSelectionContextMenu.addAction("Auto Select Highest &Deletes", this, SIGNAL(autoSelectNextDeletes())); markingsContextMenu.addAction("Unmark &All", this, SIGNAL(unmarkAll())); markingsContextMenu.addAction("Unmark All &Keeps", this, SIGNAL(unmarkAllKeeps())); markingsContextMenu.addAction("Unmark all &Deletes", this, SIGNAL(unmarkAllDeletes())); connect(reset_pushButton, SIGNAL(clicked()), this, SIGNAL(resetRequested())); connect(commit_pushButton, SIGNAL(clicked()), this, SIGNAL(commitRequested())); connect(filter_pushButton, SIGNAL(clicked()), this, SLOT(filterContextMenuClicked())); connect(sort_pushButton, SIGNAL(clicked()), this, SLOT(processSortRequest())); connect(autoSelection_pushButton, SIGNAL(clicked()), this, SLOT(processAutoSelectionClicked())); connect(markings_pushButton, SIGNAL(clicked()), this, SLOT(processMarkingsClicked())); connect(auto_pushButton, SIGNAL(clicked()), this, SIGNAL(autoCleanDeletes())); connect(&sortContextMenu, SIGNAL(aboutToHide()), this, SLOT(sortContextMenuAboutToHide())); connect(&autoSelectionContextMenu, SIGNAL(aboutToHide()), this, SLOT(autoSelectionContextMenuAboutToHide())); connect(&markingsContextMenu, SIGNAL(aboutToHide()), this, SLOT(markingsContextMenuAboutToHide())); connect(&filterContextMenu, SIGNAL(aboutToHide()), this, SLOT(filterContextMenuAboutToHide())); connect(filterDialog, SIGNAL(aboutToHide()), this, SLOT(filterContextMenuAboutToHide())); connect(filterDialog, SIGNAL(filterByExtension(QStringList)), this, SIGNAL(filterByExtension(QStringList))); connect(filterDialog, SIGNAL(filterByPath(QString)), this, SIGNAL(filterByPath(QString))); connect(filterDialog, SIGNAL(filterByRegex(QRegExp)), this, SIGNAL(filterByRegex(QRegExp))); connect(filterDialog, SIGNAL(filterBySize(ulong,ulong)), this, SIGNAL(filterBySize(ulong,ulong))); }