SHORE API
Main Page
Namespaces
Classes
Files
File List
File Members
SHORE API
Namespaces
Classes
Files
File List
shore
algo
base
container
datatype
fmtio
alignment.hpp
aln.hpp
bed.hpp
eland.hpp
fasta.hpp
fastq.hpp
flatread.hpp
gff.hpp
maplist.hpp
mummer.hpp
psl.hpp
qseq.hpp
read.hpp
refdict.hpp
sam.hpp
segment.hpp
sff.hpp
text.hpp
vcf.hpp
parallel
processing
program
statistics
stream
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
flatread.hpp
Go to the documentation of this file.
1
2
/*
3
* Copyright 2008,2009,2010,2011,2012 Stephan Ossowski, Korbinian Schneeberger,
4
* Felix Ott, Joerg Hagmann, Alf Scotland, Sebastian Bender
5
*
6
* This file is part of SHORE.
7
*
8
* SHORE is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* SHORE is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with SHORE. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
25
26
#ifndef SHORE_IO_FLATREAD_HPP__
27
#define SHORE_IO_FLATREAD_HPP__
28
29
#include <iostream>
30
#include <vector>
31
#include <set>
32
33
#include "
shore/processing/pipeline.hpp
"
34
#include "
shore/datatype/alignment_processing.hpp
"
35
#include "
shore/datatype/datatypes.hpp
"
36
#include "
shore/algo/sort_file.hpp
"
37
#include "
shore/fmtio/text.hpp
"
38
#include "
shore/fmtio/sff.hpp
"
39
40
namespace
shore {
41
43
class
flatread_tags_parser
44
{
45
private
:
46
47
typedef
boost::function<void ()> tagfun_t;
49
tagfun_t *m_tagfuns;
50
51
const
char
*m_tagbeg;
52
const
char
*m_tagend;
53
54
static
size_t
th(
const
char
*
const
s);
55
56
protected
:
57
58
static
const
size_t
MAXTAGS=128*128;
59
60
shore::read::accessory
*m_readtags;
61
62
flatread_tags_parser
();
63
~
flatread_tags_parser
();
64
65
void
parse_tags(std::string &s);
66
67
void
tagfun_invalid();
68
void
tagfun_BAx();
69
void
tagfun_DST();
70
void
tagfun_CLx();
71
void
tagfun_RGR();
72
void
tagfun_ORI();
73
void
tagfun_NUM();
74
};
75
77
class
basic_flatread_reader
78
:
public
flatread_tags_parser
79
{
80
private
:
81
82
shore::basic_line_reader
m_reader;
83
std::string m_linebuf;
84
std::string m_tagbuf;
85
shore::read::InsertState
m_insstate_conv[256];
86
87
std::string m_readgroup_default;
88
size_t
m_cliplen_default;
89
shore::read::InsertState
m_pestate_default;
90
91
92
void
set_default_tags(
shore::read
&r);
93
94
public
:
95
96
typedef
shore::read
current_type
;
97
99
basic_flatread_reader
(
const
std::string& fn);
100
basic_flatread_reader
(std::istream *
const
is);
101
102
bool
next(
shore::read
&r);
103
104
const
std::string &get_name()
const
;
105
};
106
108
typedef
shore::monolithic
<
basic_flatread_reader
,
109
shore::read
,shore::read::compare_type>
flatread_reader
;
110
112
typedef
shore::source<flatread_reader>
flatread_source
;
113
115
class
flatread_writer
116
{
117
public
:
118
119
typedef
shore::read
append_type
;
120
121
private
:
122
123
shore::ostreams
m_os;
124
shore::read
m_readbuf;
125
126
shore::feed<shore::alignment>
m_alfeed;
127
shore::flatten_alignment_pipe
m_fa;
128
shore::sink<flatread_writer>
m_thissink;
129
130
shore::feed<shore::sff_read>
m_sfffeed;
131
shore::sff_flatten_pipe
m_sffflatten;
132
134
bool
m_writetags;
135
138
bool
m_applytags;
139
141
bool
m_discard_qual_aux;
142
143
public
:
144
145
flatread_writer
(
const
std::string& fn);
146
flatread_writer
(std::ostream*
const
os);
147
149
void
set_writetags
(
const
bool
w);
150
153
void
set_applytags
(
const
bool
a);
154
156
void
set_discard_qual_aux
(
const
bool
b);
157
158
void
append(
const
shore::read
& f);
159
void
append(
const
shore::alignment
& f);
160
void
append(
const
shore::sff_read
& f);
161
162
void
flush();
163
165
static
std::ostream &
write_read
(std::ostream &out,
166
const
shore::read
&e,
167
const
bool
discard_qual_aux=
false
);
168
};
169
171
std::ostream&
operator<<
(std::ostream& out,
const
shore::read
&e);
172
174
typedef
shore::sink<flatread_writer>
flatread_sink
;
175
176
}
// namespace
177
178
#endif // SHORE_IO_FLATREAD_HPP__
179
shore
fmtio
flatread.hpp
Generated on Thu Jun 20 2013 15:49:38 for SHORE API by
1.8.4