bpp-core3  3.0.0
NexusIoSequence.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_IO_NEXUSIOSEQUENCE_H
6 #define BPP_SEQ_IO_NEXUSIOSEQUENCE_H
7 
8 
9 #include "../Container/AlignedSequenceContainer.h"
10 #include "../Container/SequenceContainer.h"
11 #include "../Container/VectorSequenceContainer.h"
12 #include "../Sequence.h"
13 #include "AbstractIAlignment.h"
14 
15 // From the STL:
16 #include <iostream>
17 
18 namespace bpp
19 {
35  public AbstractIAlignment2,
36  public virtual ISequence
37 {
38 protected:
42  unsigned int charsByLine_;
43 
45 
46 public:
53  NexusIOSequence(unsigned int charsByLine = 100, bool checkSequenceNames = true) :
54  charsByLine_(charsByLine), checkNames_(checkSequenceNames) {}
55 
56  virtual ~NexusIOSequence() {}
57 
58 public:
64  void appendAlignmentFromStream(std::istream& input, SequenceContainerInterface& sc) const override;
72  const std::string getFormatName() const override;
73 
74  const std::string getFormatDescription() const override;
80  bool checkNames() const { return checkNames_; }
81 
87  void checkNames(bool yn) { checkNames_ = yn; }
88 
89 private:
90  // Reading tools:
91  const std::vector<std::string> splitNameAndSequence_(const std::string& s) const;
92 };
93 } // end of namespace bpp.
94 #endif // BPP_SEQ_IO_NEXUSIOSEQUENCE_H
Partial implementation of the IAlignment and ISequence interface, dedicated to alignment readers...
This alphabet is used to deal NumericAlphabet.
NexusIOSequence(unsigned int charsByLine=100, bool checkSequenceNames=true)
Build a new Nexus file reader.
The Nexus format reader for sequences.
The SequenceContainer interface.
void checkNames(bool yn)
Tell whether the sequence names should be checked when reading from files.
unsigned int charsByLine_
The maximum number of chars to be written on a line.
const std::string getFormatDescription() const override
void appendAlignmentFromStream(std::istream &input, SequenceContainerInterface &sc) const override
Append sequences to a container from a stream.
const std::string getFormatName() const override
const std::vector< std::string > splitNameAndSequence_(const std::string &s) const
bool checkNames() const
The ISequence interface.
Definition: ISequence.h:27