bool write_fasta(const char *filename, Sequences *seqs) { FILE *stream = NULL; if ((stream = fopen(filename, "w")) == NULL) { fprintf(stderr, "cannot open '%s'\n", filename); return false; } write_fasta(stream, seqs); fclose(stream); return true; }
void ExternalAligner::align_seqs_impl(Strings& seqs) const { std::string input = tmp_file(); ASSERT_FALSE(input.empty()); std::string output = tmp_file(); ASSERT_FALSE(output.empty()); { boost::shared_ptr<std::ostream> file = name_to_ostream(input); std::ostream& out = *file; for (int i = 0; i < seqs.size(); i++) { write_fasta(out, TO_S(i), "", seqs[i], 60); } } align_file(input, output); Strings rows; read_alignment(rows, output); ASSERT_EQ(rows.size(), seqs.size()); seqs.swap(rows); if (!go("NPGE_DEBUG").as<bool>()) { remove_file(input); remove_file(output); } }