Beispiel #1
0
int main(void)
{
  // read lines, get sorted nodes
  Time *nodes = read();

  find_overlap( nodes );

  return 0;
}
Beispiel #2
0
int CReadBlastApp::simple_overlaps()
{
  int nabsent=0;
  int saved_m_verbosity_threshold = m_verbosity_threshold;
  // m_verbosity_threshold = 300;
  if(PrintDetails()) NcbiCerr << "simple_overlaps starts: " << NcbiEndl;
  TSimpleSeqs& seqs=m_simple_seqs;  // now calculated in CopyGenestoforgotthename 

  TSimpleSeqs::iterator first_user_in_range = seqs.begin();
  TSimpleSeqs::iterator first_user_non_in_range = seqs.begin();
  TSimpleSeqs::iterator first_ext_in_range = m_extRNAtable2.begin();
  TSimpleSeqs::iterator first_ext_non_in_range = m_extRNAtable2.begin();
  TSimpleSeqs::iterator seq = seqs.begin();
  NON_CONST_ITERATE(TSimpleSeqs, ext_rna, m_extRNAtable2)
     {
     int from, to;
     from = ext_rna->exons[0].from;  
     to = ext_rna->exons[ext_rna->exons.size()-1].to;
     ENa_strand strand = ext_rna->exons[0].strand;
     int range_scale = to - from;
     int max_distance = get_max_distance(range_scale);
     string type2 = ext_rna->name;
     string ext_rna_range = printed_range(ext_rna);
     if(PrintDetails()) NcbiCerr << "simple_overlaps[" << type2 << "[" << ext_rna_range << "]" << "]" << NcbiEndl;
// find BEST overlap, not good enough here
     TSimpleSeqs best_seq;
     find_overlap(seq, ext_rna, seqs, best_seq); // this will slide seq along seqs
     bool absent = true;
     string diag_name = ext_rna->name;
// for buffer
     int n_user_neighbors=0; int n_ext_neighbors = 0; string bufferstr="";
     NON_CONST_ITERATE(TSimpleSeqs, seq2, best_seq)
       {
       int overlap=0;
       overlaps(ext_rna, seq2, overlap);
       strstream seq2_range_stream; 
       string seq2_range = printed_range(seq2);
       if(PrintDetails()) NcbiCerr << "simple_overlaps"
                                   << "[" << type2 
                                      << "[" << ext_rna_range << "]" 
                                      << "[" << seq2_range << "]" 
                                   << "]" 
                                   << ". "
                                   << "Overlap = " << overlap
                                   << NcbiEndl;
       if(PrintDetails()) NcbiCerr << "ext_rna->type = " << ext_rna->type << NcbiEndl;
       if(PrintDetails()) NcbiCerr << "seq2->type = " << seq2->type  << NcbiEndl;
       if(PrintDetails()) NcbiCerr << "strand = " << int(strand) << NcbiEndl;
       if(PrintDetails()) NcbiCerr << "seq2->exons[0].strand = " << int(seq2->exons[0].strand) << NcbiEndl;
       absent =  absent && (!overlap || ext_rna->type != seq2->type); // Absent
       bool bad_strand =  (overlap>0 && ext_rna->type == seq2->type &&  strand != seq2->exons[0].strand); // BadStrand
       if(!bad_strand) continue;
       string diag_name2 = seq2->name;
       int from2, to2;
       from2 = seq2->exons[0].from;  
       to2 = seq2->exons[seq2->exons.size()-1].to;
       bool undef_strand = seq2->exons[0].strand == eNa_strand_unknown;
       if(!bufferstr.size())
         {
         if(PrintDetails())
           {
           if(first_user_in_range==seqs.end())
              {
              NcbiCerr << "simple_overlaps: first_user_in_range is already at the end" << NcbiEndl;
              }
           else
              {
              NcbiCerr << "simple_overlaps: first_user_in_range = " << printed_range(first_user_in_range) << NcbiEndl;
              }
           }
         ugly_simple_overlaps_call(n_user_neighbors, n_ext_neighbors,
            ext_rna, first_user_in_range, first_user_non_in_range, seqs, max_distance,
            first_ext_in_range, first_ext_non_in_range, bufferstr);
         }
       strstream misc_feat;
       string seq_range = printed_range(seq);
       EProblem trnaStrandProblem = undef_strand ? eTRNAUndefStrand : eTRNABadStrand;
       misc_feat << "RNA does not match strand for feature located at " << seq_range << NcbiEndl;
       misc_feat << '\0';
// this goes to the misc_feat, has to be original location, and name, corrected strand
       problemStr problem = {trnaStrandProblem, bufferstr, misc_feat.str(), "", "", from2, to2, strand};
       m_diag[diag_name2].problems.push_back(problem);
       if(PrintDetails()) NcbiCerr << "simple_overlaps: adding problem:" << "\t"
               << diag_name << "\t"
               << "eTRNABadStrand" << "\t"
               << bufferstr << "\t"
               << NcbiEndl; 
// this goes to the log, has to be new
       problemStr problem2 = {trnaStrandProblem, bufferstr, "", "", "", from, to, strand};
       m_diag[diag_name].problems.push_back(problem2);

       } // best_Seq iteration NON_CONST_ITERATE(TSimpleSeqs, seq2, best_seq)