ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/tophat_cpp/fragments.cpp
Revision: 29
Committed: Tue Aug 2 21:24:54 2011 UTC (8 years, 10 months ago) by gpertea
File size: 1307 byte(s)
Log Message:
adding tophat source work

Line User Rev File contents
1 gpertea 29 /*
2     * fragments.cpp
3     * TopHat
4     *
5     * Created by Cole Trapnell on 1/14/09.
6     * Copyright 2009 Cole Trapnell. All rights reserved.
7     *
8     */
9    
10     #ifdef HAVE_CONFIG_H
11     #include <config.h>
12     #endif
13    
14     #include <cassert>
15     #include "bwt_map.h"
16     #include "fragments.h"
17    
18     void best_fragment_mappings(uint64_t refid,
19     const string& name,
20     HitList& hits_in_ref,
21     ReadTable& it,
22     BestFragmentAlignmentTable& best_status_for_fragments)
23     {
24     for (size_t i = 0; i < hits_in_ref.size(); ++i)
25     {
26     BowtieHit& h1 = hits_in_ref[i];
27     uint64_t fragment_id = h1.insert_id();
28     uint32_t obs_order = it.observation_order(fragment_id);
29    
30     JunctionSet dummy;
31     FragmentAlignmentGrade s(h1, dummy);
32    
33     pair<FragmentAlignmentGrade, vector<FragmentAlignment*> >& fragment_best
34     = best_status_for_fragments[obs_order];
35     FragmentAlignmentGrade& current = fragment_best.first;
36     // Is the new status better than the current best one?
37     if (current < s)
38     {
39     fragment_best.second.clear();
40     current = s;
41     fragment_best.second.push_back(&h1);
42     }
43     else if (! (s < current)) // is it just as good?
44     {
45     fragment_best.second.push_back(&h1);
46     }
47     }
48     }
49    
50     bool valid_fragment_alignment(const FragmentAlignmentGrade& g, const FragmentAlignment& a)
51     {
52     // stub
53     return true;
54     }