-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrealignmentcaller.h
executable file
·66 lines (50 loc) · 2.14 KB
/
realignmentcaller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef REALIGNMENTCALLER
#define REALIGNMENTCALLER
#include "sequencealigner.h"
#include "sequencefetcher.h"
#include "CallResult.h"
#include "softclippedread.h"
#include "ChromoFragment.h"
#include "CallParams.h"
class IRealignmentCaller
{
public:
IRealignmentCaller(ISequenceAligner *pSeqAligner, ISequenceFetcher *pSeqFetcher)
: pSeqAligner(pSeqAligner),
pSeqFetcher(pSeqFetcher)
{}
virtual ~IRealignmentCaller() {}
CallResult *Call(ISoftClippedRead *pRead, const ChromosomeRegion& cRegion, const CallParams& cParams)
{
ChromoFragment cFragment = pSeqFetcher->Fetch(cRegion);
ChromoFragment modifiedFrag = PreprocessFragment(pRead, cFragment);
std::string v = modifiedFrag.GetSequence();
std::string w = GetSeqFromRead(pRead);
IAlignmentResult *pAlnResult = pSeqAligner->Align(v, w, MakeScoreParam());
// if (pRead->GetClipPosition().GetPosition() == 10111162)
// {
// std::cout << cFragment.GetSequence() << std::endl;
// std::cout << modifiedFrag.GetStartPos() << std::endl;
// std::cout << modifiedFrag.GetSequence() << std::endl;
// std::cout << pRead->GetAlignedRegion() << std::endl;
// std::cout << w << std::endl;
// std::cout << "#####################" << std::endl;
// pAlnResult->PrintAlignment();
// }
if (!IsAlnResultQualified(pRead, pAlnResult, cParams))
{
return NULL;
}
return MakeCallResult(pRead, modifiedFrag.GetStartPos(), pAlnResult);
}
private:
ISequenceAligner *pSeqAligner;
virtual ChromoFragment PreprocessFragment(ISoftClippedRead *pRead, const ChromoFragment& cFragment) = 0;
virtual std::string GetSeqFromRead(ISoftClippedRead *pRead) = 0;
virtual ScoreParam MakeScoreParam() = 0;
virtual bool IsAlnResultQualified(ISoftClippedRead *pRead, IAlignmentResult *pAlnResult, const CallParams& cParams) = 0;
virtual CallResult *MakeCallResult(ISoftClippedRead *pRead, int refStartPos, IAlignmentResult *pAlnResult) = 0;
protected:
ISequenceFetcher *pSeqFetcher;
};
#endif // REALIGNMENTCALLER