Example #1
0
int main(int argc, char *argv[]) 
{
	char *readBuffer = NULL;
	const char * filename = "../data/Ecoli_raw.fasta";
	unsigned int readCount = 0;
	
	readCount = processReads(filename, 17, &readBuffer);
	
	printf("readCount = %d\n",readCount);
	printf("%s",readBuffer[0]);
}
Example #2
0
processMultireads::processMultireads(QWidget *parent) :
    QWidget(parent),
    progressView(new analysisProgressView(this)),
    multireadsView(new processMultireadsView(this))
{
    // set a window title
    setWindowTitle(tr("Rcount-multireads"));

    // initialize all the other widgets
    // get and set the minimal sizes
    int minWidth = multireadsView->sizeHint().width();
    int minHeight = multireadsView->sizeHint().height()+progressView->sizeHint().height()*1.5;
    this->setMinimumHeight(minHeight);
    this->setMinimumWidth(minWidth);

    // layout
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(multireadsView);
    layout->addWidget(progressView);
    setLayout(layout);

    // hide the progressView
    //! progressView->hide();

    // connections
    connect(&processor, SIGNAL(processStatus(QString)), progressView, SLOT(updateStatus(QString)));
    connect(&processor, SIGNAL(processProgress(int)), progressView, SLOT(updateProgress(int)));
    connect(&processor, SIGNAL(errorMessage(QString)), progressView, SLOT(updateStatus(QString)));
    //! connect(&processor, SIGNAL(idleAgain()), this, SLOT(hideProgress()));
    connect(&processor, SIGNAL(workFinished(QString)), multireadsView, SLOT(removeFromQueue(QString)));
    connect(progressView, SIGNAL(analysisCanceled()), &processor, SLOT(cancelProcessing()));
    connect(multireadsView, SIGNAL(closeAll()), &processor, SLOT(cancelProcessing()));
    connect(multireadsView, SIGNAL(closeAll()), this, SLOT(close()));
    connect(multireadsView, SIGNAL(processReads(QString)), this, SLOT(runProcessor(QString)));

}
Example #3
0
    int run(const Properties& options, const Arguments& arguments) {
        int r = 0;

        if ((r = checkOptions(options, arguments)) != 0) {
            return r;
        }

        // parameters
        LOG4CXX_INFO(logger, "Parameters:");
        LOG4CXX_INFO(logger, boost::format("PE Mode: %d") % options.get< int >("pe-mode", 0));
        if (options.find("min-length") != options.not_found()) {
            LOG4CXX_INFO(logger, boost::format("Min length: %d") % options.get< int >("min-length"));
        }
        if (options.find("hard-clip") != options.not_found()) {
            LOG4CXX_INFO(logger, boost::format("hard clip: %d") % options.get< int >("hard-clip"));
        }
        if (options.find("quality-trim") != options.not_found()) {
            LOG4CXX_INFO(logger, boost::format("Quality Trim: %d") % options.get< int >("quality-trim"));
        }
        if (options.find("quality-filter") != options.not_found()) {
            LOG4CXX_INFO(logger, boost::format("Quality Filter: %d") % options.get< int >("quality-filter"));
        }

        // input
        std::vector< std::string > filelist;
        std::copy(arguments.begin(), arguments.end(), std::back_inserter(filelist));
        LOG4CXX_INFO(logger, boost::format("input: %s") % boost::algorithm::join(filelist, ":"));

        // output
        std::ostream* out = &std::cout;
        if (options.find("out") != options.not_found()) {
            std::string file = options.get< std::string >("out");
            out = new std::ofstream(file.c_str());
            LOG4CXX_INFO(logger, boost::format("output: %s") % file);
        }

        // process
        if (*out) {
            Statistics stats;
            if ((r = processReads(options, filelist, *out, stats)) == 0) {
                // report statistics
                LOG4CXX_INFO(logger, "Preprocess stats:");
                LOG4CXX_INFO(logger, boost::format("Reads parsed:\t%d") % stats.numReadsRead);
                if (stats.numReadsRead > 0) {
                    LOG4CXX_INFO(logger, boost::format("Reads kept:\t%d(%f)") % stats.numReadsKept % ((double)stats.numReadsKept / stats.numReadsRead));
                    LOG4CXX_INFO(logger, boost::format("Reads failed primer screen:\t%d(%e)") % stats.numReadsPrimer % ((double)stats.numReadsPrimer / stats.numReadsRead));
                }
                LOG4CXX_INFO(logger, boost::format("Bases parsed:\t%d") % stats.numBasesRead);
                if (stats.numBasesRead) {
                    LOG4CXX_INFO(logger, boost::format("Bases kept:\t%d(%f)") % stats.numBasesKept % ((double)stats.numBasesKept / stats.numBasesRead));
                }
                LOG4CXX_INFO(logger, boost::format("Number of incorrectly paired reads that were discarded: %d") % stats.numInvalidPE);
            }
        } else {
            LOG4CXX_ERROR(logger, "Failed to open output stream");
        }

        if (out != &std::cout) {
            SAFE_DELETE(out);
        }

        return r;
    }