bool LibarchivePlugin::list() { qCDebug(ARK) << "Listing archive contents"; if (!initializeReader()) { return false; } qDebug(ARK) << "Detected compression filter:" << archive_filter_name(m_archiveReader.data(), 0); QString compMethod = convertCompressionName(QString::fromUtf8(archive_filter_name(m_archiveReader.data(), 0))); if (!compMethod.isEmpty()) { emit compressionMethodFound(compMethod); } m_cachedArchiveEntryCount = 0; m_extractedFilesSize = 0; m_numberOfEntries = 0; auto compressedArchiveSize = QFileInfo(filename()).size(); struct archive_entry *aentry; int result = ARCHIVE_RETRY; bool firstEntry = true; while (!QThread::currentThread()->isInterruptionRequested() && (result = archive_read_next_header(m_archiveReader.data(), &aentry)) == ARCHIVE_OK) { if (firstEntry) { qDebug(ARK) << "Detected format for first entry:" << archive_format_name(m_archiveReader.data()); firstEntry = false; } if (!m_emitNoEntries) { emitEntryFromArchiveEntry(aentry); } m_extractedFilesSize += (qlonglong)archive_entry_size(aentry); emit progress(float(archive_filter_bytes(m_archiveReader.data(), -1))/float(compressedArchiveSize)); m_cachedArchiveEntryCount++; archive_read_data_skip(m_archiveReader.data()); } if (result != ARCHIVE_EOF) { qCWarning(ARK) << "Could not read until the end of the archive:" << QLatin1String(archive_error_string(m_archiveReader.data())); return false; } return archive_read_close(m_archiveReader.data()) == ARCHIVE_OK; }
/** * Retrieve data from files, prep data. * * Only called if this is not a slave. */ void Bagging::init(){ bag_param->read_parameters(param_reader->get_engine_specific_params()); initializeReader(); // defined in engine.h this->outstream.open(this->param_reader->get_out_file().c_str() ); if(!this->outstream.is_open()){ cerr << "Unable to open file " << this->param_reader->get_out_file() << endl; exit(1); } reader->process(data->getDataObject(), param_reader); data->getDataObject()->prep_data(param_reader); data->make_categorical(-1,1); data->getDataObject()->remove_haplotype(); }
/** * Performs several functions, not all documented here. * * Main tasks: get engine specific parameters and read and prep data. * * Param checks: * map file present (does not currently exit) * */ void Dandelion::init(){ ld_param->read_parameters(param_reader->get_engine_specific_params()); initializeReader(); // defined in engine.h if(param_reader->get_linkage_map_file().compare("none") == 0){ cerr << "Dandelion requires that you enter a map file. Aborting." << endl; //exit(0); } reader->process(data->getDataObject(), param_reader); numInitSNPs = data->geno_size(); numInitPhen = data->pheno_size(); data->getDataObject()->remove_phenotype(numeric_limits<double>::max()); data->getDataObject()->remove_covariate(numeric_limits<double>::max()); data->getDataObject()->remove_phenotype(0); data->getDataObject()->prep_data(param_reader); try{ data->make_categorical(1,2); }catch(DataException d){ cerr << "Data Exception with message: " << endl << d.message << endl; exit(0); }catch(...){ cerr << "Exception making categorical." << endl; } delete reader; // No longer needed. // This removes any individuals that are missing a value at any of the SNPs. // We don't want to use this if we are windowing. //data->getDataObject()->remove_indiv_with_snp_value(0); if(data->pheno_size() == 0){ cerr << "Error: there are no individuals. Program halting." << endl; exit(0); } numFinalPhen = data->pheno_size(); }
/* * Get data and populate the parameter holder. */ void QSnpgwa::init(){ snp_param->read_parameters(param_reader->get_engine_specific_params()); initializeReader(); // defined in engine.h if(param_reader->get_linkage_map_file().compare("none") == 0){ cerr << "QSNPGWA requires that you enter a map file. Aborting." << endl; exit(0); } Logger::Instance()->init(param_reader->get_out_file() + ".log"); reader->process(data->getDataObject(), param_reader); numInitSNPs = data->geno_size(); numInitPhen = data->pheno_size(); delete reader; // No longer needed. data->getDataObject()->remove_phenotype(numeric_limits<double>::max()); data->getDataObject()->remove_covariate(numeric_limits<double>::max()); data->getDataObject()->prep_data(param_reader); }
/** init() * * Set up the reader and input all data. * Call the data checker in the snp_data method. * */ void ADTree::init(){ ad_param->read_parameters(param_reader->get_engine_specific_params()); initializeReader(); // defined in engine.h reader->process(data->getDataObject(), param_reader); data->getDataObject()->prep_data(param_reader); try{ data->make_categorical(-1,1); }catch(DataException d){ cerr << "Data Exception with message: " << endl << d.message << endl; exit(0); }catch(...){ cerr << "Exception making categorical." << endl; } data->getDataObject()->remove_haplotype(); //data->getDataObject()->pass_through_bootstrap(); delete reader; // No longer needed. }