int GenomeMaps::report_mapped_region(Chromosome const &chr, int chr_start, int chr_end, int num_matches) { reported_mapped_regions++ ; //fprintf(stdout, "mapped_region:\tchr=%s\tstart=%i\tend=%i\tmatches=%i\n", CHR_DESC[chr], chr_start, chr_end, num_matches) ; //assert(chr_start>=0 && chr_start<CHR_LENGTH[chr]) ; //assert(chr_end>=0 && chr_end<CHR_LENGTH[chr]) ; if (!(chr_start>=0 && (size_t)chr_start<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_mapped_region: start out of bounds\n") ; if (chr_start<0) chr_start = 0 ; else chr_start = chr.length() ; } if (!(chr_end>=0 && (size_t)chr_end<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_mapped_region: end out of bounds\n") ; if (chr_end<0) chr_end = 0 ; else chr_end = chr.length() ; } for (int i=chr_start; i<chr_end; i++) if ((CHR_MAP(chr,i) & MASK_MAPPED_REGION) ==0 ) { covered_mapped_region_positions++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i) + MASK_MAPPED_REGION) ; } return 0 ; }
int GenomeMaps::report_repetitive_seed(Chromosome const &chr, int chr_start, int count) { //fprintf(stdout, "repetitive_seed:\tchr=%s\tpos=%i\tcount=%i\n", CHR_DESC[chr], chr_start, count) ; if (count<Config::REPORT_REPETITIVE_SEED_COUNT) return 0 ; if (!(chr_start>=0 && (size_t)chr_start<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_mapped_region: start out of bounds\n") ; if (chr_start<0) chr_start = 0 ; else chr_start = chr.length() ; } assert(chr_start>=0 && (size_t)chr_start<chr.length()) ; //fprintf(stdout, "repetitive_seed:\tchr=%s\tpos=%i\tcount=%i\n", CHR_DESC[chr], chr_start, count) ; reported_repetitive_seeds++ ; for (unsigned int i=chr_start; i<chr_start+_config.INDEX_DEPTH+REPORT_REPETITIVE_SEED_DEPTH_EXTRA && i<chr.length(); i++) if ((CHR_MAP(chr,i) & MASK_REPETITIVE_SEED) == 0) { covered_repetitive_seed_positions++ ; CHR_MAP_set(chr,i, CHR_MAP(chr,i) + MASK_REPETITIVE_SEED) ; } do_reporting() ; if (count<Config::REPORT_REPETITIVE_SEED_COUNT_MANY1) return 0 ; for (unsigned int i=chr_start; i<chr_start+_config.INDEX_DEPTH+REPORT_REPETITIVE_SEED_DEPTH_EXTRA && i<chr.length(); i++) if ((CHR_MAP(chr,i) & MASK_REPETITIVE_SEED_MANY1) == 0) { covered_repetitive_seed_positions_many1++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i) + MASK_REPETITIVE_SEED_MANY1) ; } if (count<Config::REPORT_REPETITIVE_SEED_COUNT_MANY2) return 0 ; for (unsigned int i=chr_start; i<chr_start+_config.INDEX_DEPTH+REPORT_REPETITIVE_SEED_DEPTH_EXTRA && i<chr.length(); i++) if ((CHR_MAP(chr,i) & MASK_REPETITIVE_SEED_MANY2) == 0) { covered_repetitive_seed_positions_many2++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i) + MASK_REPETITIVE_SEED_MANY2) ; } return 1 ; }
int GenomeMaps::report_spliced_read(Chromosome const &chr, std::vector<int> & exons, int num_matches, int nbest_hit) { reported_spliced_reads++ ; //fprintf(stdout, "mapped_read: \tchr=%s\tstart=%i\tend=%i\tmatches=%i\tnbest=%i\n", CHR_DESC[chr], start, end, num_matches, nbest_hit) ; if (exons.size()==2) { return report_mapped_read(chr, exons[0], exons[1], num_matches, nbest_hit) ; } for (size_t e=0; e<exons.size(); e+=2) { int start = exons[e] ; int end = exons[e+1] ; if (!(start>=0 && (size_t)start<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_spliced_read: start out of bounds\n") ; if (start<0) start = 0 ; else start = chr.length(); } if (!(end>=0 && (size_t)end<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_spliced_read: end out of bounds\n") ; if (end<0) end = 0 ; else end = chr.length(); } //assert(start>=0 && (size_t)start<=CHR_LENGTH[chr]) ; //assert(end>=0 && (size_t)end<=CHR_LENGTH[chr]) ; int start_map = start - Config::QPALMA_USE_MAP_WINDOW ; if (start_map<0) start_map=0 ; int end_map = end + Config::QPALMA_USE_MAP_WINDOW ; if (end_map>(int)chr.length()) end_map=chr.length() ; for (int i=start_map; i<end_map; i++) { if (nbest_hit==0 && (CHR_MAP(chr,i) & MASK_SPLICED_READ_BEST) == 0 ) { covered_spliced_read_positions_best++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i)+MASK_SPLICED_READ_BEST) ; } #ifndef CHR_MAP_DNAARRAY if ((CHR_MAP(chr,i) & MASK_SPLICED_READ) == 0 ) { covered_spliced_read_positions++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i)+MASK_SPLICED_READ) ; } #else #ifndef CHR_MAP_DNAARRAY_2BIT if ((CHR_MAP(chr,i) & MASK_SPLICED_READ) == 0 ) { covered_spliced_read_positions++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i)+MASK_SPLICED_READ) ; } #else assert(MASK_SPLICED_READ_BEST<4) ; #endif #endif } if (_config.REPORT_GENOME_COVERAGE>0) for (int i=start; i<end; i++) { if (CHR_MAP_cov(chr,i)<std::numeric_limits<unsigned int>::max()) { CHR_MAP_set_cov(chr, i, CHR_MAP_cov(chr,i)+1) ; } } } return 0 ; }
int GenomeMaps::report_mapped_read(Chromosome const &chr, int start, int end, int num_matches, int nbest_hit) { reported_mapped_reads++ ; if (!(start>=0 && (size_t)start<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_mapped_read: start out of bounds (start=%i no in [0,%i))\n", start, chr.length()) ; if (start<0) start = 0 ; else start = chr.length() ; } if (!(end>=0 && (size_t)end<=chr.length())) { if (_config.VERBOSE>0) fprintf(stdout, "report_mapped_read: end out of bounds (end=%i not in [0,%i))\n", end, chr.length()) ; if (end<0) end = 0 ; else end = chr.length() ; } //fprintf(stdout, "mapped_read: \tchr=%s\tstart=%i\tend=%i\tmatches=%i\tnbest=%i\n", chr.desc(), start, end, num_matches, nbest_hit) ; int start_map=start-Config::QPALMA_USE_MAP_WINDOW ; if (start_map<0) start_map=0 ; int end_map=end+Config::QPALMA_USE_MAP_WINDOW ; if (end_map>(int)chr.length()) end_map=chr.length() ; for (int i=start_map; i<end_map; i++) { if (nbest_hit==0 && (CHR_MAP(chr,i) & MASK_MAPPED_READ_BEST) == 0 ) { covered_mapped_read_positions_best++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i)+MASK_MAPPED_READ_BEST) ; } #ifndef CHR_MAP_DNAARRAY if ((CHR_MAP(chr,i) & MASK_MAPPED_READ) == 0 ) { covered_mapped_read_positions++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i)+ MASK_MAPPED_READ) ; } #else #ifndef CHR_MAP_DNAARRAY_2BIT if ((CHR_MAP(chr,i) & MASK_MAPPED_READ) == 0 ) { covered_mapped_read_positions++ ; CHR_MAP_set(chr, i, CHR_MAP(chr,i)+ MASK_MAPPED_READ) ; } #endif #endif } if (_config.REPORT_GENOME_COVERAGE>0) for (int i=start; i<end; i++) { if (CHR_MAP_cov(chr,i)<std::numeric_limits<unsigned int>::max()) { CHR_MAP_set_cov(chr, i, CHR_MAP_cov(chr,i)+1) ; } } do_reporting() ; return 0 ; }