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 |
if (status != rhs.status) |
48 |
return status < rhs.status; |
49 |
|
50 |
return rhs.edit_dist < edit_dist; |
51 |
} |
52 |
|
53 |
AlignStatus status; |
54 |
int edit_dist; |
55 |
int num_alignments; // number of equally good alignments for this fragment |
56 |
}; |
57 |
|
58 |
typedef vector<pair<FragmentAlignmentGrade, vector<FragmentAlignment*> > > BestFragmentAlignmentTable; |
59 |
|
60 |
void best_fragment_mappings(uint64_t refid, |
61 |
const string& name, |
62 |
HitList& hits1_in_ref, |
63 |
ReadTable& it, |
64 |
BestFragmentAlignmentTable& best_status_for_fragments); |
65 |
|
66 |
void accept_best_hits(BestFragmentAlignmentTable& best_status_for_fragments); |
67 |
void accept_unique_hits(BestFragmentAlignmentTable& best_status_for_fragments); |
68 |
|
69 |
#endif |