-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMM-to-periodic.C
78 lines (65 loc) · 1.64 KB
/
IMM-to-periodic.C
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
66
67
68
69
70
71
72
73
74
75
76
77
/****************************************************************
IMM-to-periodic.C
Copyright (C)2014 William H. Majoros ([email protected]).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
****************************************************************/
#include <iostream>
#include "BOOM/String.H"
#include "BOOM/CommandLine.H"
#include "BOOM/DnaAlphabet.H"
#include "ThreePeriodicIMM.H"
using namespace std;
using namespace BOOM;
DnaAlphabet alphabet;
class Application
{
public:
Application();
int main(int argc,char *argv[]);
};
int main(int argc,char *argv[])
{
try
{
Application app;
return app.main(argc,argv);
}
catch(const char *p)
{
cerr << p << endl;
}
catch(const string &msg)
{
cerr << msg.c_str() << endl;
}
catch(const exception &e)
{
cerr << "STL exception caught in main:\n" << e.what() << endl;
}
catch(...)
{
cerr << "Unknown exception caught in main" << endl;
}
return -1;
}
Application::Application()
{
// ctor
}
int Application::main(int argc,char *argv[])
{
// Process command line
CommandLine cmd(argc,argv,"");
if(cmd.numArgs()!=2)
throw String("IMM-to-periodic <in.IMM> <out.3PIMM>");
const String infile=cmd.arg(0);
const String outfile=cmd.arg(1);
IMM *imm=new IMM(infile);
const ContentType contentType=imm->getContentType();
ThreePeriodicIMM *imm3p=new ThreePeriodicIMM(FORWARD_STRAND,contentType);
for(int i=0 ; i<3 ; ++i) imm3p->getChain(i)=imm;
// imm3p->reverseComplement();
imm3p->save(outfile);
return 0;
}