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