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
fasta.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_FASTA_HPP__
27
#define SHORE_IO_FASTA_HPP__
28
29
#include <vector>
30
#include <string>
31
32
#include "
shore/processing/pipeline.hpp
"
33
#include "
shore/container/intpack.hpp
"
34
#include "
shore/stream/streams.hpp
"
35
#include "
shore/datatype/dna_iterator.hpp
"
36
37
#include "
shore/datatype/datatypes.hpp
"
38
#include "
shore/fmtio/text.hpp
"
39
40
namespace
shore {
41
43
class
fasta_reader
44
{
45
private
:
46
47
shore::sequence_record
m_current;
48
49
std::string m_strbuf;
50
51
std::vector<std::string> m_filenames;
52
shore::istreams
m_in;
53
54
boost::shared_ptr<shore::mmapping> m_mmapping;
55
57
size_t
m_sid;
58
59
bool
m_packed;
60
61
bool
m_hasdata;
62
63
std::string m_tokbuf[2];
64
65
bool
m_shoremode;
66
shore::row_reader
*m_rtrans;
67
shore::row_reader
*m_rref;
68
69
71
void
default_load();
73
void
shore_load();
74
75
public
:
76
77
typedef
sequence_record
current_type
;
78
79
fasta_reader
(
const
std::string& filename,
const
bool
packed=
false
,
80
const
bool
loadfirst=
true
);
81
82
fasta_reader
(
const
std::vector<std::string>& fn,
const
bool
packed=
false
,
83
const
bool
loadfirst=
true
);
84
85
~
fasta_reader
();
86
87
bool
has_data()
const
;
88
89
const
shore::sequence_record
& current()
const
;
90
92
void
next
();
93
};
94
96
typedef
shore::source<fasta_reader>
fasta_source
;
97
99
class
fasta_writer
100
{
101
private
:
102
103
shore::ostreams
m_out;
104
105
bool
m_writetags;
106
107
public
:
108
109
typedef
sequence_record
append_type
;
110
111
fasta_writer
(
const
std::string& fn);
112
113
void
set_writetags(
const
bool
b);
114
115
void
append(
const
shore::sequence_record
& r);
116
void
append(
const
shore::read
& r);
117
void
flush();
118
};
119
121
typedef
shore::sink<fasta_writer>
fasta_sink
;
122
124
typedef
shore::sink<fasta_writer,shore::read>
fasta_read_sink
;
125
126
}
// namespace shore
127
128
#endif // SHORE_IO_FASTA_HPP__
129
shore
fmtio
fasta.hpp
Generated on Thu Jun 20 2013 15:49:38 for SHORE API by
1.8.4