Exemple #1
0
void FineSegmenter::findCDR3(){

  JUNCTIONstart = box_V->marked_pos;
  JUNCTIONend = box_J->marked_pos;

  // There are two cases when we can not detect a JUNCTION/CDR3:
  // - Germline V or J gene has no 'marked_pos'
  // - Sequence may be too short on either side, and thus the backtrack did not find a suitable 'marked_pos'
  if (JUNCTIONstart == 0 || JUNCTIONend == 0)
    return;

  // We require at least two codons
  if (JUNCTIONend - JUNCTIONstart + 1 < 6) {
    JUNCTIONstart = -1 ;
    JUNCTIONend = -1 ;
    return ;
  }

  // We require at least one more nucleotide to export a CDR3
  if (JUNCTIONend - JUNCTIONstart + 1 < 7) {
    JUNCTIONproductive = false ;
    return ;
  }
  
  // IMGT-CDR3 is, on each side, 3 nucleotides shorter than IMGT-JUNCTION
  CDR3start = JUNCTIONstart + 3;
  CDR3end = JUNCTIONend - 3;

  CDR3nuc = subsequence(getSequence().sequence, CDR3start, CDR3end);

  if (CDR3nuc.length() % 3 == 0)
    {
      CDR3aa = nuc_to_aa(CDR3nuc);
    }
  else
    {
      // start of codon fully included in the germline J
      int CDR3startJfull = JUNCTIONend - ((JUNCTIONend - box_J->start) / 3) * 3 + 1 ;

      CDR3aa =
        nuc_to_aa(subsequence(getSequence().sequence, CDR3start, CDR3startJfull-1)) +
        nuc_to_aa(subsequence(getSequence().sequence, CDR3startJfull, CDR3end));
    }

  JUNCTIONaa = nuc_to_aa(subsequence(getSequence().sequence, JUNCTIONstart, CDR3start-1))
    + CDR3aa + nuc_to_aa(subsequence(getSequence().sequence, CDR3end+1, JUNCTIONend));

  JUNCTIONproductive = (CDR3nuc.length() % 3 == 0) && (JUNCTIONaa.find('*') == string::npos);
}
Exemple #2
0
// begin main function //
int main(void)
{
    // local variables //
    int x=0, search=0;
    
    
    // seed random number gen //
    srand(time(NULL));
    
    // initialize array elements
    init();
    
    // print elements of array //
    printf("\n\nArray elements:  ");
    print(0, array_size);
    
    // find LIS //
    subsequence();
    
    // search for frequency of user input value //
    printf("\nEnter a number 0-9 to search:  ");
    scanf("%d", &search);
    
    while (search < 0 || search > 9)
    {
        printf("\n\nYou entered an invalid search input.\nPlease enter a number 0-9 to search:  ");
        scanf("%d", &search);
    }
    
    x = frequency(search);
    
    if (x==0)
        printf("The target value does not appear in the array.\n\n");
    else
        printf("The target value appears in the array %d time(s).\n\n", x);
    
    // end main function, return 0 //
    return 0;
}