btllib: btllib::SeqWriter Class Reference

btllib

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
btllib::SeqWriter Class Reference

`#include <seq_writer.hpp>`

## Public Types
enum | Format { FASTA , FASTQ }

## Public Member Functions
| SeqWriter (const std::string &sink_path, Format format=FASTA, bool append=false)
void | close ()
void | write (const std::string &id, const std::string &comment, const std::string &seq, const std::string &qual="")

## Detailed Description

Write FASTA or FASTQ sequences to a file. Capable of writing gzip (.gz), bzip2 (.bz2), xz (.xz), zip (.zip), 7zip (.7z), and lrzip (.lrz) files. Add the appropriate extension to the output filename to automatically compress. Threadsafe.

Examples
  seq_writer.cpp.

## Constructor & Destructor Documentation

## ◆ SeqWriter()

btllib::SeqWriter::SeqWriter | ( | const std::string & | sink_path,
|  | Format | format = FASTA,
|  | bool | append = false )

Construct a SeqWriter to write sequences to a given path.

Parameters

  source_path | Filepath to write to. Pass "-" to write to stdout.
  format | Which format to write the output as.
  append | Whether to append to the target file or write anew.

## Member Function Documentation

## ◆ write()

void btllib::SeqWriter::write | ( | const std::string & | id,
|  | const std::string & | comment,
|  | const std::string & | seq,
|  | const std::string & | qual = "" )

Write a sequence.

Parameters

  id | Sequence ID or name.
  comment | Optional comment after the ID/name.
  seq | The sequence to write.
  qual | Optional quality scores, mandatory if format is FASTQ.

Examples
  seq_writer.cpp.

The documentation for this class was generated from the following file:

- include/btllib/seq_writer.hpp