1 |
#ifndef FRAGMENTS_H |
2 |
#define FRAGMENTS_H |
3 |
/* |
4 |
* fragments.h |
5 |
* TopHat |
6 |
* |
7 |
* Created by Cole Trapnell on 1/14/09. |
8 |
* Copyright 2009 Cole Trapnell. All rights reserved. |
9 |
* |
10 |
*/ |
11 |
|
12 |
#include "bwt_map.h" |
13 |
#include "align_status.h" |
14 |
|
15 |
typedef BowtieHit FragmentAlignment; |
16 |
|
17 |
struct FragmentAlignmentGrade |
18 |
{ |
19 |
FragmentAlignmentGrade() |
20 |
{ |
21 |
//edit_dist = 0; |
22 |
num_alignments = 0; |
23 |
status = AlignStatus(); |
24 |
} |
25 |
|
26 |
FragmentAlignmentGrade(const BowtieHit& h1, const JunctionSet& gtf_junctions) |
27 |
{ |
28 |
status = AlignStatus(h1, gtf_junctions); |
29 |
//edit_dist = h1.edit_dist(); |
30 |
num_alignments = 1; |
31 |
} |
32 |
|
33 |
FragmentAlignmentGrade& operator=(const FragmentAlignmentGrade& rhs) |
34 |
{ |
35 |
status = rhs.status; |
36 |
//edit_dist = rhs.edit_dist; |
37 |
num_alignments = rhs.num_alignments; |
38 |
|
39 |
return *this; |
40 |
} |
41 |
|
42 |
// Returns true if rhs is a "happier" alignment for the ends of this insert |
43 |
// than this InsertStatus. |
44 |
|
45 |
bool operator<(const FragmentAlignmentGrade& rhs) |
46 |
{ |
47 |
// -- Geo: check this |
48 |
//if (status != rhs.status) |
49 |
return status < rhs.status; |
50 |
|
51 |
//return rhs.edit_dist < edit_dist; |
52 |
} |
53 |
|
54 |
AlignStatus status; |
55 |
//int edit_dist; |
56 |
int num_alignments; // number of equally good alignments for this fragment |
57 |
}; |
58 |
|
59 |
typedef vector<pair<FragmentAlignmentGrade, vector<FragmentAlignment*> > > BestFragmentAlignmentTable; |
60 |
|
61 |
void best_fragment_mappings(uint64_t refid, |
62 |
const string& name, |
63 |
HitList& hits1_in_ref, |
64 |
ReadTable& it, |
65 |
BestFragmentAlignmentTable& best_status_for_fragments); |
66 |
|
67 |
void accept_best_hits(BestFragmentAlignmentTable& best_status_for_fragments); |
68 |
void accept_unique_hits(BestFragmentAlignmentTable& best_status_for_fragments); |
69 |
|
70 |
#endif |