comparison gene_fraction/src/FastaRecord.h @ 0:f95150c37d38 draft default tip

planemo upload for repository https://github.com/ChrisD11/Tools commit ddc95e5d6b5f2c0a5340c0bc384aa822db8856d5
author chrisd
date Sun, 21 Feb 2016 23:31:55 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f95150c37d38
1 #ifndef FASTA_RECORD_H
2 #define FASTA_RECORD_H
3
4 #include <string>
5 #include <vector>
6
7 /**
8 * Class for dealing with fasta records
9 */
10 class FastaRecord {
11 public:
12 /**
13 * Ctor that initializes gene id and gene
14 */
15 FastaRecord(std::string gene_id, std::string gene);
16
17 /**
18 * Returns a string gene id
19 */
20 std::string gene_id() const;
21
22 /**
23 * Returns the gene associated with gene id
24 */
25 std::string gene() const;
26
27 /**
28 * Returns the total base hits for a gene
29 */
30 int get_base_hits() const;
31
32 /**
33 * Returns the amount of genes that were hit
34 * during the gene fraction calculation
35 */
36 int gene_hits() const;
37
38 /**
39 *
40 */
41 void update_base_hits(const int &index);
42
43 /**
44 *
45 */
46 void update_gene_hits();
47
48 /**
49 * Searches for a fasta record corresponding
50 * to gene id
51 */
52 static int find_gene(const std::vector<FastaRecord> &records,
53 const std::string &gene_id,
54 std::string seq = "");
55
56 /**
57 * Sorts fasta records by gene id
58 */
59 static void sort_by_gene_id(std::vector<FastaRecord> &records);
60
61 /**
62 * Resets base hits vector to 0's.
63 * This occurs after each sample is processed
64 */
65 static void reset_base_hits(std::vector<FastaRecord> &records);
66
67 /**
68 * Resets gene hits primitive to 0.
69 * This happens after each sample is processed
70 */
71 static void reset_gene_hits(std::vector<FastaRecord> &records);
72
73 std::vector<int> &base_hits();
74
75 std::string _gene_id;
76 std::string _gene;
77 std::vector<int> _base_hits;
78
79 private:
80 int _gene_hits;
81 };
82
83
84
85
86 #endif /* FASTA_RECORD_H */