int simulateGenome(char const * filename, MasonSimulateGenomeOptions const & options) { seqan::SequenceStream stream; open(stream, filename, seqan::SequenceStream::WRITE, seqan::SequenceStream::FASTA); if (!isGood(stream)) { std::cerr << "ERROR: Could not open " << filename << "for writing!\n"; return 1; } return simulateGenome(stream, options); }
int main(int argc, char const ** argv) { // Parse the command line. seqan::ArgumentParser parser; MasonGenomeOptions options; seqan::ArgumentParser::ParseResult res = parseCommandLine(options, argc, argv); // If there was an error parsing or built-in argument parser functionality // was triggered then we exit the program. The return code is 1 if there // were errors and 0 if there were none. if (res != seqan::ArgumentParser::PARSE_OK) return res == seqan::ArgumentParser::PARSE_ERROR; std::cout << "MASON GENOME SIMULATOR\n" << "======================\n\n"; // Print the command line arguments back to the user. if (options.verbosity > 0) { std::cout << "__OPTIONS____________________________________________________________________\n" << '\n' << "VERBOSITY \t" << options.verbosity << '\n' << "\n" << "SEED \t" << options.seed << '\n' << "\n" << "OUTPUT FILE\t" << options.outputFilename << "\n" << "CONTIG LENS\t"; for (unsigned i = 0; i < length(options.contigLengths); ++i) { if (i > 0) std::cout << ", "; std::cout << options.contigLengths[i]; }; std::cout << "\n\n"; } // Perform genome simulation. std::cout << "__SIMULATING GENOME__________________________________________________________\n" << "\n"; MasonSimulateGenomeOptions simOptions; simOptions.contigLengths = options.contigLengths; simOptions.seed = options.seed; if (simulateGenome(toCString(options.outputFilename), simOptions) != 0) return 1; std::cerr << "\nDone.\n"; return 0; }