-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathread_seq.h
More file actions
145 lines (108 loc) · 3.7 KB
/
read_seq.h
File metadata and controls
145 lines (108 loc) · 3.7 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//Copyright 1999-2002 Gavin Conant
#ifndef ___READ_SEQ_H___
#define ___READ_SEQ_H___
#include <fstream>
#include <iostream>
using namespace std;
#include "gen_dna_funcs.h"
struct sequence {
int site;
sequence *next_site;
};
BOOL test_interleave(char *filename);
class Read_Sequence
{
public:
//Functions
Read_Sequence();
virtual Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, BOOL is_aa_seq)=0;
virtual Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, DATATYPE type)=0;
virtual Sequence_dataset * get_dataset(int &num_taxa, int &num_sites, DATATYPE type)=0;
int get_num_taxa();
int get_num_chars();
BOOL protein_data();
DATATYPE get_type() {return(ctype);};
virtual ~Read_Sequence() {};
protected:
int size, ntaxa, *sizes;
char last_char, inbase;
BOOL std_in, finished;
istream *var_stream;
ifstream file_stream;
BOOL aa_data;
DATATYPE ctype;
sequence *in_seq, *in_seq_start, *temp;
List_Molecule_Sequence *build_taxa, *taxa_start, *temp_taxa;
int (*convert_char)(char);
BOOL(*valid_input)(char);
//Functions
void get_sequence_array_size_known(Molecule_Sequence *new_sequence);
void get_sequence_array(Molecule_Sequence *&new_sequence);
void set_datatype(DATATYPE cdata);
void get_next_list_element(List_Molecule_Sequence *&thelist);
void get_next_sequence_element(sequence *&thelist);
BOOL read_finished();
char next_char();
};
class Read_PIR : public Read_Sequence
{
public:
Read_PIR(): Read_Sequence() {};
~Read_PIR();
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, BOOL is_aa_seq);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, DATATYPE type);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites, DATATYPE type);
};
class Read_Nexus : public Read_Sequence
{
public:
Read_Nexus(): Read_Sequence() {};
~Read_Nexus();
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, BOOL is_aa_seq);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, DATATYPE type);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites, DATATYPE type);
};
class Read_Phylip_interleave : public Read_Sequence
{
public:
Read_Phylip_interleave(): Read_Sequence() {};
~Read_Phylip_interleave();
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, BOOL is_aa_seq);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, DATATYPE type);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites, DATATYPE type);
};
class Read_Phylip_noninterleave : public Read_Sequence
{
public:
Read_Phylip_noninterleave(): Read_Sequence() {};
~Read_Phylip_noninterleave();
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, BOOL is_aa_seq);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, DATATYPE type);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites, DATATYPE type);
};
class Read_FASTA : public Read_Sequence
{
public:
Read_FASTA() :Read_Sequence() {finished=FALSE; started=FALSE;}
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, BOOL is_aa_seq);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites,
const char *filename, DATATYPE type);
Sequence_dataset * get_dataset(int &num_taxa, int &num_sites, DATATYPE type);
Sequence_dataset * get_data_subset(int size, string filename, int &num_taxa, DATATYPE type);
BOOL finished_reading() {return(finished);};
~Read_FASTA();
protected:
BOOL finished, started;
};
#endif