-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastaEntry.cpp
More file actions
47 lines (33 loc) · 785 Bytes
/
FastaEntry.cpp
File metadata and controls
47 lines (33 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* FastaEntry.cpp
*
* Created on: Mar 10, 2010
* Author: marcus
*/
#include "FastaEntry.h"
FastaEntry::FastaEntry(){
id = "";
sequence = "";
}
FastaEntry::FastaEntry(string name, string seq) {
id = name;
sequence = seq;
}
FastaEntry::~FastaEntry() {
// TODO Auto-generated destructor stub
}
istream& operator>>(istream &stream, FastaEntry& fa) {
char faline[1500];
stream.getline(faline, (streamsize)1500);
while(faline[0] != '>' && !stream.eof()){
stream.getline(faline, (streamsize)1500);
}
if(stream.eof()) return stream;
assert(faline[0] == '>');
string id = string(faline).substr(1, string(faline).length() - 1);
stream.getline(faline, (streamsize) 1500);
string seq = string(faline);
fa.id = id;
fa.sequence = seq;
return stream;
}