| 1 | /* |
|---|
| 2 | Copyright (c) 2006-2018 Elmar Pruesse <elmar.pruesse@ucdenver.edu> |
|---|
| 3 | |
|---|
| 4 | This file is part of SINA. |
|---|
| 5 | SINA is free software: you can redistribute it and/or modify it under |
|---|
| 6 | the terms of the GNU General Public License as published by the Free |
|---|
| 7 | Software Foundation, either version 3 of the License, or (at your |
|---|
| 8 | option) any later version. |
|---|
| 9 | |
|---|
| 10 | SINA is distributed in the hope that it will be useful, but WITHOUT ANY |
|---|
| 11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|---|
| 13 | for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with SINA. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | Additional permission under GNU GPL version 3 section 7 |
|---|
| 19 | |
|---|
| 20 | If you modify SINA, or any covered work, by linking or combining it |
|---|
| 21 | with components of ARB (or a modified version of that software), |
|---|
| 22 | containing parts covered by the terms of the |
|---|
| 23 | ARB-public-library-license, the licensors of SINA grant you additional |
|---|
| 24 | permission to convey the resulting work. Corresponding Source for a |
|---|
| 25 | non-source form of such a combination shall include the source code |
|---|
| 26 | for the parts of ARB used as well as that of the covered work. |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| 29 | #ifndef _RW_FASTA_H_ |
|---|
| 30 | #define _RW_FASTA_H_ |
|---|
| 31 | |
|---|
| 32 | #include "tray.h" |
|---|
| 33 | |
|---|
| 34 | #include <fstream> |
|---|
| 35 | #include <memory> |
|---|
| 36 | #include <boost/program_options.hpp> |
|---|
| 37 | #include <boost/filesystem.hpp> |
|---|
| 38 | |
|---|
| 39 | namespace sina { |
|---|
| 40 | |
|---|
| 41 | class logger_progress; |
|---|
| 42 | |
|---|
| 43 | enum FASTA_META_TYPE { |
|---|
| 44 | FASTA_META_NONE=0, |
|---|
| 45 | FASTA_META_HEADER=1, |
|---|
| 46 | FASTA_META_COMMENT=2, |
|---|
| 47 | FASTA_META_CSV=3 |
|---|
| 48 | }; |
|---|
| 49 | std::ostream& operator<<(std::ostream& out, const sina::FASTA_META_TYPE& m); |
|---|
| 50 | void validate(boost::any& v, const std::vector<std::string>& values, |
|---|
| 51 | sina::FASTA_META_TYPE* /*unused*/, int /*unused*/); |
|---|
| 52 | |
|---|
| 53 | class rw_fasta { |
|---|
| 54 | public: |
|---|
| 55 | class reader { |
|---|
| 56 | struct priv_data; |
|---|
| 57 | std::shared_ptr<priv_data> data; |
|---|
| 58 | public: |
|---|
| 59 | reader(const boost::filesystem::path& infile, |
|---|
| 60 | std::vector<std::string>& fields); |
|---|
| 61 | reader(const reader& r); |
|---|
| 62 | reader& operator=(const reader& r); |
|---|
| 63 | ~reader(); |
|---|
| 64 | bool operator()(tray& t); |
|---|
| 65 | |
|---|
| 66 | void set_progress(logger_progress& p); |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | class writer { |
|---|
| 70 | struct priv_data; |
|---|
| 71 | std::shared_ptr<priv_data> data; |
|---|
| 72 | public: |
|---|
| 73 | writer(const boost::filesystem::path& outfile, |
|---|
| 74 | unsigned int copy_relatives, |
|---|
| 75 | std::vector<std::string>& fields); |
|---|
| 76 | writer(const writer& o); |
|---|
| 77 | writer& operator=(const writer& o); |
|---|
| 78 | ~writer(); |
|---|
| 79 | tray operator()(tray t); |
|---|
| 80 | }; |
|---|
| 81 | |
|---|
| 82 | static void get_options_description(boost::program_options::options_description& main, |
|---|
| 83 | boost::program_options::options_description& adv); |
|---|
| 84 | static void validate_vm(boost::program_options::variables_map& /*unused*/, |
|---|
| 85 | boost::program_options::options_description& /*unused*/); |
|---|
| 86 | |
|---|
| 87 | private: |
|---|
| 88 | struct options; |
|---|
| 89 | static struct options *opts; |
|---|
| 90 | }; |
|---|
| 91 | |
|---|
| 92 | } // namespace sina |
|---|
| 93 | |
|---|
| 94 | #endif // _RW_FASTA_H |
|---|
| 95 | |
|---|
| 96 | /* |
|---|
| 97 | Local Variables: |
|---|
| 98 | mode:c++ |
|---|
| 99 | c-file-style:"stroustrup" |
|---|
| 100 | c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . 0)) |
|---|
| 101 | indent-tabs-mode:nil |
|---|
| 102 | fill-column:99 |
|---|
| 103 | End: |
|---|
| 104 | */ |
|---|
| 105 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
|---|