-
Notifications
You must be signed in to change notification settings - Fork 3
/
gene.h
107 lines (89 loc) · 2.74 KB
/
gene.h
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
//
// Created by Robert Stolz on 6/27/17.
//
#ifndef RLOOPER2_GENE_H
#define RLOOPER2_GENE_H
#include "structure.h"
#include "exception_handling.h"
#include "model.h"
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
class Gene{
private:
//private member functions
std::string gene_name;
std::string header;
Loci position;
std::vector<char> sequence;
std::vector<Structure> rloop_structures;
long double ground_state_energy;
private:
/**
* parses FASTA headers into the Gene's Loci member.
*/
void parse_header();
public:
Windower windower;
//constructors
Gene();
//destructors
~Gene();
//Gene(std::fstream* fastafile);
//getters and setters
string getName();
const string &getHeader() const;
void setHeader(const string &header);
const Loci &getPosition() const;
void setPosition(const Loci &position);
const vector<char, allocator<char>> &getSequence() const;
//void setSequence(const vector<char, allocator<char>> &sequence);
vector<Structure>& getStructures();
//member functions
/**
* Reads the next FASTA record from the input file. Calls parse_header.
* @param fastafile An address to the open ifstream with at least one FASTA record in it.
* @return returns a boolean indicating if the gene was teh last FASTA record in the file.
*/
bool read_gene(std::ifstream& fastafile);
/**
* useful for debugging. Prints the header and the sequence stored in the current gene.
*/
void print_gene();
void compute_structures_circular(Model& model);
/**
* Takes a model and uses it to allocate and populate a vector<Structure> of structures. Pushes the result to structures.
* @param model a Model object with an implemented compute_structure method.
*/
void compute_structures(Model& model);
/**
* computes residual twist and superhelicity for the ensemble
*/
void compute_residuals(Model& model);
/**
* Clears all structures associated with the gene, correctly deallocating them in memory.
*/
void clear_structures();
/**
* Computes the GC skew of the provided sequence.
* @return returns a float representing the GC skew.
*/
float compute_GC_skew();
/**
* complements the sequence data (A<->T, G<->C)
*/
void complement_sequence();
/**
* inverts the sequence data (GATTACA <-> ACATTAG)
*/
void invert_sequence();
/**
* Returns the length of the gene
* @return returns an int computed from the gene's location
*/
int get_length();
void clear_sequence();
void dump_structures(string outfilename);
};
#endif //RLOOPER2_GENE_H