string line_str(line);
vector<string> fields;
split(line_str, delim, fields);
- if(fields.size() <= 3) { continue; }
+ if(fields.size() <= 4) { continue; }
vector<string> location; split(fields[3], location_delim, location);
+ if(location.size() != 2) { continue; }
int chr = chromstr_to_int(location[0]);
- if(chr == -1) { continue; }
+ if(chr < 0) { continue; }
int pos = atoi(location[1].c_str());
bool strand = ((fields[4].c_str())[0] == 'F')?0:1;
}
unsigned int count_complexity(Hits& data) {
- int chrom = -1;
+ unsigned int num_hits = data.size();
unsigned int n_island = 0;
unsigned int island_size = 0;
+ int chrom = data.begin()->chr;
for(Hits::iterator i = data.begin()+1; i != data.end()-1 && i != data.end(); ++i) {
- if(chrom == -1 || i->chr != chrom) {
+ if(i->chr != chrom) {
chrom = i->chr;
} else if( (i+1)->chr != chrom ) { continue; }
int prev = (i-1)->start;
char label1[128]; strcpy(label1,argv[1]);
Hits align1; read_align_file(argv[2], align1);
- int complexity;
- if(align1.size() == 0) complexity = 0; else complexity = count_complexity(align1);
+ if(align1.size() <= 1) { cerr << "No alignment\n"; exit(0); }
+
+ int complexity = count_complexity(align1);
cout << label1 << "\t" << complexity << "\t" << align1.size()/1000000 << "M\t" << (double)complexity/(double)align1.size() << endl;
}