Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fastq.h
Go to the documentation of this file.
1 #ifndef gamgee__fastq__guard
2 #define gamgee__fastq__guard
3 
4 #include <string>
5 
6 namespace gamgee {
7 
13 class Fastq {
14 
15  public:
16 
18  Fastq() :
19  m_name {}, m_comment {}, m_sequence{}, m_quals{} {}
20 
22  Fastq(std::string name,
23  std::string comment,
24  std::string sequence,
25  std::string quals = ""
26  ) :
27  m_name {name}, m_comment {comment}, m_sequence{sequence}, m_quals{quals}
28  {}
29 
30  Fastq(const Fastq&) = default;
31  Fastq& operator=(const Fastq&) = default;
32  Fastq(Fastq&&) = default;
33  Fastq& operator=(Fastq&&) = default;
34 
35 
41  bool operator!=(const Fastq& other) const {
42  return !(*this == other);
43  }
44 
50  bool operator==(const Fastq& other) const {
51  return m_name == other.m_name &&
52  m_comment == other.m_comment &&
53  m_sequence == other.m_sequence &&
54  m_quals == other.m_quals;
55  }
56 
57 
58  std::string name() const { return m_name; }
59  std::string comment() const { return m_comment; }
60  std::string sequence() const { return m_sequence; }
61  std::string quals() const { return m_quals; }
62  void set_name(const std::string& name) { m_name = name; }
63  void set_comment(const std::string& comment) { m_comment = comment; }
64  void set_sequence(const std::string& sequence) { m_sequence = sequence; }
65  void set_quals(const std::string& quals) { m_quals = quals; }
66 
67  void chop(const int nBases);
68  void reverse_complement();
69  bool is_fastq() const;
70 
71  private:
72 
73  std::string m_name;
74  std::string m_comment;
75  std::string m_sequence;
76  std::string m_quals;
77 
78 };
79 
80 } // end of namespace
81 
88 std::ostream& operator<< (std::ostream& os, const gamgee::Fastq& fq);
89 
90 #endif // gamgee__fastq__guard
void set_sequence(const std::string &sequence)
Definition: fastq.h:64
bool is_fastq() const
true if the record has a quals in it's qual field
Definition: fastq.cpp:10
std::string comment() const
Definition: fastq.h:59
void set_name(const std::string &name)
Definition: fastq.h:62
void reverse_complement()
transform the sequence into it's reverse complement.
Definition: fastq.cpp:20
Fastq & operator=(const Fastq &)=default
std::string sequence() const
Definition: fastq.h:60
Utility class to hold one FastA or FastQ record.
Definition: fastq.h:13
bool operator!=(const Fastq &other) const
inequality comparison of all fields in the record
Definition: fastq.h:41
void chop(const int nBases)
hard clips the first n bases of the read.
Definition: fastq.cpp:14
std::string quals() const
Definition: fastq.h:61
bool operator==(const Fastq &other) const
equality comparison of all fields in the record
Definition: fastq.h:50
void set_quals(const std::string &quals)
Definition: fastq.h:65
Definition: exceptions.h:9
std::ostream & operator<<(std::ostream &os, const gamgee::Fastq &fq)
outputs the fastq record in fastq format.
Definition: fastq.cpp:34
Fastq(std::string name, std::string comment, std::string sequence, std::string quals="")
creates a full object by assigning all fields
Definition: fastq.h:22
void set_comment(const std::string &comment)
Definition: fastq.h:63
Fastq()
creates an empty record
Definition: fastq.h:18
std::string name() const
Definition: fastq.h:58