Exemple #1
0
void FastaWriter::WriteSequence(const Sequence& seq, const std::string& id, const std::string& comment)
{
    assert(m_fileHandle != NULL);
    int n = fprintf(m_fileHandle, ">%s %s\n%s\n", id.c_str(), comment.c_str(), seq.c_str());
    if (n < 0)
        die(m_path);
}
Exemple #2
0
void FastaWriter::WriteSequence(const Sequence& seq, unsigned id,
                                unsigned multiplicity, const string& comment)
{
    assert(m_fileHandle != NULL);
    const char *sep = comment.empty() ? "" : " ";
    int n = opt::rank < 0
            ? fprintf(m_fileHandle, ">%llu %zu %u%s%s\n%s\n",
                      (long long unsigned)id,
                      seq.length(), multiplicity,
                      sep, comment.c_str(),
                      seq.c_str())
            : fprintf(m_fileHandle, ">%u:%llu %zu %u%s%s\n%s\n",
                      opt::rank,
                      (long long unsigned)id,
                      seq.length(), multiplicity,
                      sep, comment.c_str(),
                      seq.c_str());
    if (n < 0)
        die(m_path);
}