9 #include "stat_soap_coverage.h"
15 cerr
<< "Description:" << endl
16 << " it is a program to stat about the gc_depth and base coverage ratio and base_depth with *.soap.coverage result." << endl
18 << "Name: gc_coverage_bias" << endl
19 << "Compile Date: 2011-08-03" << endl
20 << "Author: ganjun" << endl
21 << "Version: 1.01" << endl
22 << "Contact: ganjun@genomics.org,cn" << endl
;
24 cerr
<< "\n\nUsage:\tgc_coverage_bias [options] <*.soap.coverage>" << endl
25 << "Option: -r <string> a reference sequence file about FA format " << endl
26 << " -o <string> the the prefix about output file" << endl
27 << " -w <string> the window length[such as:100,200,300] " << endl
28 << " --gcdump output the gc ratio in the window length " << endl
29 << " --depwindump output the avg depth in the window length " << endl
;
31 cerr
<< "\n\nUsage:" << endl
32 << "\t./gc_coverage_bias -r test.fa -o test -w 40,50 [--gcdump --depwindump] test.depth" << endl
;
37 map<string, string> DealReference(string str_ref_file_name);
38 map<string, vector<vector<uint64_t, uint64_t, uint64_t> >, uint64_t> DealSoapCoverage()
42 int main(int argc
, char* argv
[])
50 string str_ref_file_name
;
52 string str_output_prefix
;
53 bool b_gcdump
= false;
54 bool b_depwindump
= false;
55 vector
<string
> vec_soap_file_name
;
56 vector
<string
> vec_width
;
58 for(int i
=1; i
<argc
; ++i
)
62 if(str_argv
.compare("-r") == 0)
65 str_ref_file_name
= argv
[i
];
69 if(str_argv
.compare("-o") == 0)
72 str_output_prefix
= argv
[i
];
76 if(str_argv
.compare("-w") == 0)
83 if(str_argv
.compare("--gcdump") == 0)
89 if(str_argv
.compare("--depwindump") == 0)
95 vec_soap_file_name
.push_back(argv
[i
]);
98 if(str_ref_file_name
.empty())
103 igzstream
in(str_ref_file_name
.c_str());
107 cerr
<< "can't open the reference file " << str_ref_file_name
<< ", please check!" << endl
;
114 if(str_output_prefix
.empty())
119 if(str_width
.empty())
125 vec_width
= splitString(str_width
, ",");
128 //cerr << vec_soap_file_name.size() << endl;
129 for(vector
<string
>::iterator it
= vec_soap_file_name
.begin(); it
!= vec_soap_file_name
.end(); ++it
)
131 igzstream
in((*it
).c_str());
135 cerr
<< "can't open the reference file " << *it
<< ", please check!" << endl
;
142 stat_soap_coverage
test(str_ref_file_name
, str_output_prefix
, vec_soap_file_name
, vec_width
, b_gcdump
, b_depwindump
);
146 map<string, string> DealReference(string str_ref_file_name)
148 igzstream in(str_ref_file.name);
150 map<string, string> map_reference_base;
154 while(getline(in, line))
161 if(sequence.length() != 0)
163 map_reference_base[keyname] = sequence;
166 if(((index = line.find(" ")) == string::npos) || ((index = line.find("\t")) == string::npos) || ((index = line.find("\n")) == string::npos))
168 keyname = line.substr(1, index);
177 if(sequence.length() != 0)
179 map_reference_base[keyname] = sequence;