Repository navigation
Expand file tree
/
Copy pathSHOREmap.cpp
More file actions
executable file
·178 lines (168 loc) · 7.86 KB
/
Copy pathSHOREmap.cpp
File metadata and controls
executable file
·178 lines (168 loc) · 7.86 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// SHOREMap version 3.x: for fast and accurate identification of causal mutations in plants //
// Written by: Hequan Sun, Korbinian Schneeberger //
// Based on: version 2.0 in perl and R, and version 2.1,3.x written in C/C++ //
// Date: 2013-03-01 to 2017-09-26 //
// //
// New features: TO-SPECIFY //
// SHOREmap is available under GPL license //
////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////COPYRIGHT//////////////////////////////////////////////////
/* SHOREMap version 3.x: for fast and accurate identification of causal mutations in plants
Copyright (C) 2013~2017 <Hequan Sun, Korbinian Schneeberger>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include "globals.h"
#include "init_outcross.h"
#include "ShoreMap_extract.h"
#include "ShoreMap_outcross.h"
#include "init_backcross.h"
#include "ShoreMap_annotate.h"
#include "ShoreMap_create2.h" //2013-09-17
#include "ShoreMap_convert.h"
#include "ShoreMap_idFilter.h"
using namespace std;
// declare sub functions
void init_global(int argc, char* argv[]);
int main(int argc, char* argv[])
{
double startT = clock();
init_global(argc, argv);
double finishT = clock();
printf("\nTime consumed %.4f seconds.\n", (finishT-startT)/1000000.0);
return 0;
}
// define functions
void init_global(int argc, char* argv[])
{
// this function read command line parameters
string version = "3.6";
std::string usage_global = "";
usage_global += "Usage of SHOREmap version " + version + ": SHOREmap FUNCTION [OPTIONS]\n\n";
usage_global += " FUNCTION is one of:\n\n";
//usage_global += " outcross \tfor analysis of outcross-mapping population\n";
usage_global += " backcross\tanalyzes backcrossing-derived mapping population\n";
usage_global += " outcross \tanalyzes outcrossing--derived mapping population\n";
usage_global += " annotate \tannotates mutations based on gene feature \n";
usage_global += " create \tcreates markers according to two backgrounds \n";
usage_global += " extract \textracts base call info according to markers \n";
usage_global += " convert \tconverts VCF4.1 into acceptable formats; or \n";
usage_global += " \tconverts shore pileup into shore consensus_summary format \n";
usage_global += " idFilter \tfilters indels in one sample according to another\n";
usage_global += " about \tdisplays general/version/publication info about SHOREmap\n";
usage_global += "\n\nFor detailed OPTIONS, try: SHOREmap FUNCTION.\n\n";
std::string about = "";
about += "\nGeneral: development of SHOREmap was started in the lab of Detlef Weigel, and\n";
about += " is also continued in the lab of Korbinian Schneeberger.\n\n";
about += "Latest version: " + version +", developed by Hequan Sun and Korbinian Schneeberger\n\n";
about += "Publications on SHOREmap:\n";
about += " *Version 3.0 with applications is introduced here: \n";
about += " H.Q. Sun and K. Schneeberger (2015)\n";
about += " SHOREmap v3.0: fast and accurate identification of causal mutations from forward\n";
about += " genetic screens. In: Alonso, J.M., and Stepanova, A.N. (Eds.), \n";
about += " Plant Functional Genomics: Methods and Protocols (pp381-395), 2nd Edition, New York: Springer.\n";
about += " *Original:\n";
about += " K. Schneeberger, S. Ossowski, C. Lanz, T. Juul, et al. (2009)\n";
about += " SHOREmap: simultaneous mapping and mutation identification by deep sequencing.\n";
about += " Nature Methods. 6, 550-551.\n";
about += " *Analysis of outcrossing data is first introduced here\n";
about += " V.C. Galvão, K.J. Nordström, C. Lanz, P. Sulz, et al. (2012) \n";
about += " Synteny-based Mapping-by-Sequencing enabled by Targeted Enrichment. Plant J.\n";
about += " *Analysis of backcrossing data is described here:\n";
about += " B. Hartwig, G.V. James, K. Konrad, K. Schneeberger, F. Turck et al. (2012) \n";
about += " Fast isogenic mapping-by-sequencing of EMS-induced mutant bulks. Plant Physiology.\n";
if (argc < 2)
{
printf("\nNOT enough input parameters. Check necessary parameters below: \n\n");
printf("%s\n", usage_global.c_str());
exit(1);
}
char* myTask = argv[1];
if(!strcmp(myTask, "backcross"))
{
if(argc > 2)
printf("\nCalling %s: \n",
myTask);
strcatCMD += "backcross ";
init_backcross(argc, argv);
printf("\nBackcross analysis done.\n");
}
else if(!strcmp(myTask, "outcross"))
{
if(argc > 2)
printf("\nCalling %s: \n", myTask);
strcatCMD += "outcross ";
if(ShoreMap_outcross(argc, argv))
printf("\nOutcross analysis done.\n");
}
else if(!strcmp(myTask, "annotate"))
{
if(argc > 2)
printf("\nAnnotating markers (SNPs): \n");
strcatCMD += "annotate ";
ShoreMap_annotate(argc, argv);
printf("\nAnnotation done.\n");
}
else if(!strcmp(myTask, "convert"))
{
if(argc > 2)
printf("\nConverting format: \n\n");
strcatCMD += "convert ";
ShoreMap_convert(argc, argv);
printf("\nConvertion done.\n");
}
else if(!strcmp(myTask, "create"))
{
if(argc > 2)
printf("\nCreating F2-markers based on background lines: \n");
strcatCMD += "create ";
ShoreMap_create2(argc, argv); //2013-09-17
printf("\nCreation of markers done.\n");
}
else if(!strcmp(myTask, "extract"))
{
if(argc > 2)
printf("\nExtracting consensus according to markers: \n");
strcatCMD += "extract ";
ShoreMap_extract(argc, argv);
printf("\nEXtraction done.\n");
}
else if(!strcmp(myTask, "idFilter"))
{
if(argc > 2)
printf("\nFiltering indels in one file according to another: \n");
strcatCMD += "idFilter ";
ShoreMap_idFilter(argc, argv);
printf("\nIndel-filering done.\n");
}
else if(!strcmp(myTask, "about"))
{
strcatCMD += "about\n";
printf("%s\n", about.c_str());
exit(0);
}
else
{
printf("\nINVALID command: %s. Check COMMANDs below: \n\n", myTask);
printf("%s\n", usage_global.c_str());
}
}