Esempio n. 1
0
Caller::Caller( const double poissonLambda, const int minDepth, const double leftStrandBias, const double rightStrandBias, const double readEndFraction, const int qCutoff, const char* tumorDirectoryPath, const char* benignDirectoryPath, const char* outputDirectoryPath, const int usePoissonGermline, const int disableLvl5Filter)
{
	this->poissonLambda = poissonLambda;
	this->minDepth = minDepth;
	this->strandBiasLeft = leftStrandBias;
	this->strandBiasRight = rightStrandBias;
	this->minQScore = qCutoff;
	this->readEndFraction = readEndFraction;
	this->usePoissonGermline = usePoissonGermline;
	this->disableLvl5Filter = disableLvl5Filter;

	( this->tumorDirectoryPath).assign( tumorDirectoryPath);
	( this->benignDirectoryPath).assign( benignDirectoryPath);
	( this->outputDirectoryPath).assign( outputDirectoryPath);

	Common::getFilesInDir( this->tumorDirectoryPath, tumorPaths);
	std::sort( tumorPaths.begin(), tumorPaths.end());

	Common::getFilesInDir( this->benignDirectoryPath, benignPaths);
	std::sort( benignPaths.begin(), benignPaths.end());

	for( int i = 0; i < tumorPaths.size(); i++)
	{
		std::string nextTumorSamplePath = this->tumorDirectoryPath + "/" + tumorPaths[i];
		std::string nextBenignSamplePath = this->benignDirectoryPath + "/" + benignPaths[i];

		loadEntries( nextTumorSamplePath);
		loadEntries( nextBenignSamplePath);
	}
}
Esempio n. 2
0
void MainWindow::on_actionAdd_New_Entry_triggered()
{
    NewEntryChooser entryChooser(this, xdbf);
    entryChooser.exec();

    loadEntries();
}
Esempio n. 3
0
void MainWindow::on_actionOpen_triggered()
{
    QString file_name = QFileDialog::getOpenFileName(this, tr("Open File"), desktop_location, "*.gpd");

    if(file_name == NULL)
        return;

    if(xdbf != NULL)
    {
        xdbf->close();
        xdbf = NULL;
    }

    QByteArray ba = file_name.toAscii();
    name = ba.data();

    try
    {
        xdbf = new XDBF(name);
        loadEntries();
    }
    catch (...)
    {
        QMessageBox::critical(this, "Error", "An unknown error occured while opening the GPD!");
        return;
    }

    ui->actionAdd_New_Entry->setEnabled(true);
    ui->actionExtract_All->setEnabled(true);
    ui->actionClean_GPD->setEnabled(true);
    ui->actionAddress_Converter->setEnabled(true);
    ui->actionClose->setEnabled(true);

    return;
}
Esempio n. 4
0
Caller::Caller( const double poissonLambda, const int minDepth, const double leftStrandBias, const double rightStrandBias, const double readEndFraction, const int qCutoff, const char* tumorDirectoryPath, const char* outputDirectoryPath, const int usePoissonGermline, const int disableLvl5Filter)
{
	this->poissonLambda = poissonLambda;
	this->minDepth = minDepth;
	this->strandBiasLeft = leftStrandBias;
	this->strandBiasRight = rightStrandBias;
	this->minQScore = qCutoff;
	this->readEndFraction = readEndFraction;
	this->usePoissonGermline = usePoissonGermline;
	this->disableLvl5Filter = disableLvl5Filter;

	( this->tumorDirectoryPath).assign( tumorDirectoryPath);
	( this->outputDirectoryPath).assign( outputDirectoryPath);

	// Setup output files
	( this->outputPaths).push_back( this->outputDirectoryPath + "/calls_level1.sinvict");
	( this->outputPaths).push_back( this->outputDirectoryPath + "/calls_level2.sinvict");
	( this->outputPaths).push_back( this->outputDirectoryPath + "/calls_level3.sinvict");
	( this->outputPaths).push_back( this->outputDirectoryPath + "/calls_level4.sinvict");
	( this->outputPaths).push_back( this->outputDirectoryPath + "/calls_level5.sinvict");
	( this->outputPaths).push_back( this->outputDirectoryPath + "/calls_level6.sinvict");

	Common::getFilesInDir( this->tumorDirectoryPath, tumorPaths);
	std::sort( tumorPaths.begin(), tumorPaths.end());

	for( int i = 0; i < tumorPaths.size(); i++)
	{
		std::string nextTumorSamplePath = this->tumorDirectoryPath + "/" + tumorPaths[i];

		loadEntries( nextTumorSamplePath);
	}

	calculateStatistics();
}
    Private()
    {
        KConfigGroup grp(KGlobal::config(), "RecentFiles");
        maxItems = grp.readEntry("maxRecentFileItems", 100);

        loadEntries(grp);
    }
Esempio n. 6
0
void Serializer::saveOrLoadEntries(Entry *entry) {
	debug(DBG_SER, "Serializer::saveOrLoadEntries() _mode=%d", _mode);
	_bytesCount = 0;
	switch (_mode) {
	case SM_SAVE:
		saveEntries(entry);
		break;
	case SM_LOAD:
		loadEntries(entry);
		break;	
	}
	debug(DBG_SER, "Serializer::saveOrLoadEntries() _bytesCount=%d", _bytesCount);
}
activityLogger::activityLogger(QWidget *parent) : QMainWindow(parent), ui(new Ui::activityLogger){
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(onUpdate()));
    timer->start(10);
    this->setWindowIcon(QIcon(":/icon/icon.ico"));
    ui->setupUi(this);
    pause_offset=0;
    epoch=-1;
    loadActivities();
    loadEntries();
    foreach(QListWidgetItem item,activities){
        ui->activityList->addItem(new QListWidgetItem(item.text()));
    }
Esempio n. 8
0
FAT16Analyzer::FAT16Analyzer(char *fname)
{
	this->fs = fopen(fname, "rb+");

	if (fs == NULL)
	{
		printf("Erro ao abrir o arquivo com o sistema de arquivo.\n\n");
		exit(1);
	}

	fat1 = NULL;
	fat2 = NULL;

	loadEntries();
}
Esempio n. 9
0
void MainWindow::on_actionNew_triggered()
{
    bool a = false;
    NewGpdDialog dialog(this, &xdbf, &a);
    dialog.exec();

    if (!a)
        return;

    loadEntries();
    ui->actionAdd_New_Entry->setEnabled(true);
    ui->actionExtract_All->setEnabled(true);
    ui->actionClean_GPD->setEnabled(true);
    ui->actionAddress_Converter->setEnabled(true);
    ui->actionClose->setEnabled(true);
}
Esempio n. 10
0
MainWindow::MainWindow(QWidget *parent, string filePath) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    desktop_location = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
    ObjectRole = Qt::UserRole;

    ui->setupUi(this);

    friendlyNames[0] = "Achievement";
    friendlyNames[1] = "Image";
    friendlyNames[2] = "Setting";
    friendlyNames[3] = "Title";
    friendlyNames[4] = "String";
    friendlyNames[5] = "Avatar Award";

    QStringList columnHeaders;
    columnHeaders.push_back("ID");
    columnHeaders.push_back("Size");
    columnHeaders.push_back("Offset");
    columnHeaders.push_back("Type");

    ui->tableWidget->setColumnCount(columnHeaders.length());
    ui->tableWidget->setHorizontalHeaderLabels(columnHeaders);

    xdbf = NULL;

    ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showRemoveContextMenu(QPoint)));

    if (filePath != "")
    {
        try
        {
            xdbf = new XDBF(filePath);
            loadEntries();
            ui->actionAdd_New_Entry->setEnabled(true);
            ui->actionExtract_All->setEnabled(true);
            ui->actionClean_GPD->setEnabled(true);
            ui->actionAddress_Converter->setEnabled(true);
            ui->actionClose->setEnabled(true);
        }
        catch (...)
        {
            QMessageBox::critical(this, "Error", "An unknown error occured while opening the GPD!");
            return;
        }
    }
}
Esempio n. 11
0
XdbfDialog::XdbfDialog(QStatusBar *statusBar, GpdBase *gpd, bool *modified, QWidget *parent) :
    QDialog(parent), ui(new Ui::XdbfDialog), gpd(gpd), modified(modified), statusBar(statusBar)
{
    ui->setupUi(this);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    ui->treeWidget->header()->resizeSection(0, 260);

    loadEntries();

    // display the gpd name
    for (DWORD i = 0; i < gpd->strings.size(); i++)
        if (gpd->strings.at(i).entry.id == TitleInformation)
        {
            if (gpd->strings.at(i).ws != L"")
                setWindowTitle("Xdbf Viewer - " + QString::fromStdWString(gpd->strings.at(i).ws));
            break;
        }

    ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
}
Esempio n. 12
0
void XdbfDialog::showContextMenu(QPoint p)
{
    if (ui->treeWidget->selectedItems().count() < 1)
        return;

    QPoint globalPos = ui->treeWidget->mapToGlobal(p);
    QMenu contextMenu;

    contextMenu.addAction(QPixmap(":/Images/extract.png"), "Extract Selected");
    if (ui->treeWidget->selectedItems().count() == 1)
        contextMenu.addAction(QPixmap(":/Images/replace.png"), "Replace Entry");
    contextMenu.addSeparator();
    contextMenu.addAction(QPixmap(":/Images/convert.png"), "Address Converter");
    contextMenu.addSeparator();
    contextMenu.addAction(QPixmap(":/Images/clean.png"), "Clean");

    QAction *selectedItem = contextMenu.exec(globalPos);

    if (selectedItem == NULL)
        return;
    else if (selectedItem->text() == "Extract Selected")
    {
        QList<QTreeWidgetItem*> items = ui->treeWidget->selectedItems();

        // get the out path
        QString path;
        if (items.count() > 1)
            path = QFileDialog::getExistingDirectory(this, "Extract Directory", QtHelpers::DesktopLocation()) + "/";
        else
            path = QFileDialog::getSaveFileName(this, "Choose a place to extract the entry", QtHelpers::DesktopLocation() + "/" + ui->treeWidget->currentItem()->text(0));

        if (path == "" || path == "\\")
            return;

        try
        {
            for (int i = 0; i < items.count(); i++)
            {
                int index = -1;
                for (int x = 0; x < ui->treeWidget->topLevelItemCount(); x++)
                    if (ui->treeWidget->topLevelItem(x) == items.at(i))
                    {
                        index = x;
                        break;
                    }

                Entry e = indexToEntry(index);
                XdbfEntry xentry;

                // get the xdbf entry
                if (e.type == Achievement)
                    xentry = gpd->xdbf->achievements.entries.at(e.index);
                else if (e.type == Image)
                    xentry = gpd->xdbf->images.at(e.index);
                else if (e.type == Setting)
                    xentry = gpd->xdbf->settings.entries.at(e.index);
                else if (e.type == Title)
                    xentry = gpd->xdbf->titlesPlayed.entries.at(e.index);
                else if (e.type == String)
                    xentry = gpd->xdbf->strings.at(e.index);
                else if (e.type == AvatarAward)
                    xentry = gpd->xdbf->avatarAwards.entries.at(e.index);

                // extract the entry into memory
                BYTE *entryBuff = new BYTE[xentry.length];
                gpd->xdbf->ExtractEntry(xentry, entryBuff);

                QString outPath = path;
                if (items.count() > 1)
                    outPath += items.at(i)->text(0);

                // Write the data to a file
                FileIO io(outPath.toStdString(), true);
                io.Write(entryBuff, xentry.length);
                io.Close();

                // free the temporary memory
                delete[] entryBuff;
            }

            statusBar->showMessage("Selected entries extracted successfully", 3000);
        }
        catch (string error)
        {
            QMessageBox::critical(this, "Error", "An error occurred while extracting.\n\n" + QString::fromStdString(error));
        }
    }
    else if (selectedItem->text() == "Replace Entry")
    {
        QString entryPath = QFileDialog::getOpenFileName(this, "Open the entry to replace the current with", QtHelpers::DesktopLocation() + "/" + ui->treeWidget->currentItem()->text(0));

        if (entryPath == "")
            return;

        try
        {
            Entry e = indexToEntry(ui->treeWidget->currentIndex().row());
            XdbfEntry xentry;

            // get the xdbf entry
            if (e.type == Achievement)
                xentry = gpd->xdbf->achievements.entries.at(e.index);
            else if (e.type == Image)
                xentry = gpd->xdbf->images.at(e.index);
            else if (e.type == Setting)
                xentry = gpd->xdbf->settings.entries.at(e.index);
            else if (e.type == Title)
                xentry = gpd->xdbf->titlesPlayed.entries.at(e.index);
            else if (e.type == String)
                xentry = gpd->xdbf->strings.at(e.index);
            else if (e.type == AvatarAward)
                xentry = gpd->xdbf->avatarAwards.entries.at(e.index);

            // open the file and get the length
            FileIO io(entryPath.toStdString());
            io.SetPosition(0, ios_base::end);
            DWORD fileLen = io.GetPosition();

            // allocate enough memory for the buffer
            BYTE *entryBuff = new BYTE[fileLen];

            // read in the file
            io.SetPosition(0);
            io.ReadBytes(entryBuff, fileLen);

            xentry.length = fileLen;
            gpd->xdbf->ReWriteEntry(xentry, entryBuff);

            // cleanup
            delete[] entryBuff;
            io.Close();
            if (modified != NULL)
                *modified = true;

            // get the xdbf entry again so we can update the UI
            if (e.type == Achievement)
                xentry = gpd->xdbf->achievements.entries.at(e.index);
            else if (e.type == Image)
                xentry = gpd->xdbf->images.at(e.index);
            else if (e.type == Setting)
                xentry = gpd->xdbf->settings.entries.at(e.index);
            else if (e.type == Title)
                xentry = gpd->xdbf->titlesPlayed.entries.at(e.index);
            else if (e.type == String)
                xentry = gpd->xdbf->strings.at(e.index);
            else if (e.type == AvatarAward)
                xentry = gpd->xdbf->avatarAwards.entries.at(e.index);

            // update the entry in the UI
            QTreeWidgetItem *item = ui->treeWidget->selectedItems().at(0);
            item->setText(1, "0x" + QString::number(gpd->xdbf->GetRealAddress(xentry.addressSpecifier), 16).toUpper());
            item->setText(2, "0x" + QString::number(xentry.length, 16).toUpper());

            statusBar->showMessage("Entry replaced successfully", 3000);
        }
        catch (string error)
        {
            QMessageBox::critical(this, "Error", "An error occurred while replacing.\n\n" + QString::fromStdString(error));
        }
    }
    else if (selectedItem->text() == "Address Converter")
    {
        AddressConverterDialog dialog(gpd->xdbf, this);
        dialog.exec();
    }
    else if (selectedItem->text() == "Clean")
    {
        int btn = QMessageBox::question(this, "Continue?", "Cleaning the Gpd will remove all of the unused memory that is in the file. This could potentially reduce the size of the Gpd.\n\nDo you want to continue?", QMessageBox::Yes, QMessageBox::No);

        if (btn != QMessageBox::Yes)
          return;

        // clean the Gpd
        try
        {
            gpd->xdbf->Clean();
        }
        catch (std::string error)
        {
            QMessageBox::critical(this, "Clean Error", "An error occured while cleaning the Gpd.\n\n" + QString::fromStdString(error));
            return;
        }

        // reload the listing
        ui->treeWidget->clear();
        loadEntries();

        if (modified != NULL)
            *modified = true;

        statusBar->showMessage("Cleaned Gpd successfully", 3000);
    }
}
Esempio n. 13
0
 Wad::Wad(const Path& path) :
 m_file(Disk::openFile(path)) {
     if (m_file == NULL)
         throw AssetException("Cannot open wad file " + path.asString());
     loadEntries();
 }