Beispiel #1
0
bool AlleleIdentity::CharacterizeVariantStatus(const LocalReferenceContext &reference_context,
    const ReferenceReader &ref_reader, int chr_idx)
{
  //cout << "Hello from CharacterizeVariantStatus; " << altAllele << endl;
  bool is_ok = true;
  status.isIndel       = false;
  status.isHPIndel     = false;
  status.isSNP         = false;
  status.isMNV         = false;
  status.isPaddedSNP   = false;
  status.doRealignment = false;

  // Get Anchor length
  ref_hp_length = reference_context.my_hp_length[0];
  left_anchor = 0;
  unsigned int a_idx = 0;
  while (a_idx < altAllele.length() and a_idx < reference_context.reference_allele.length()
         and altAllele[a_idx] == reference_context.reference_allele[a_idx]) {
    a_idx++;
    left_anchor++;
  }
  if (DEBUG > 0)
    cout << "- Alternative Allele " << altAllele << " (anchor length " << left_anchor << ") ";


  const string& ref_allele = reference_context.reference_allele;
  const string& alt_allele = altAllele;
  int ref_length = ref_allele.length();
  int alt_length = alt_allele.length();
  while (alt_length > 1 and ref_length > 1 and alt_allele[alt_length-1] == ref_allele[ref_length-1]) {
    --alt_length;
    --ref_length;
  }
  int prefix = 0;
  while (prefix < alt_length and prefix < ref_length and alt_allele[prefix] == ref_allele[prefix])
    ++prefix;
  ref_length -= prefix;
  alt_length -= prefix;

  // Change classification to better reflect what we can get with haplotyping
  if (altAllele.length() != reference_context.reference_allele.length()) {
    status.isIndel = true;
    is_ok = SubCategorizeInDel(reference_context, ref_reader, chr_idx);

  } else if ((int)altAllele.length() == 1) { // Categorize function only works with this setting
    status.isSNP = true;
    SubCategorizeSNP(reference_context);
    if (DEBUG > 0) cout << " is a SNP." << endl;

  } else {
    status.isMNV = true;
    ref_hp_length = reference_context.my_hp_length[left_anchor];
    if (ref_length == 1 and alt_length == 1)
      status.isPaddedSNP = true;
    SubCategorizeMNP(reference_context);
    if (DEBUG > 0)
      cout << " is an MNP." << endl;
  }
  return (is_ok);
}
Beispiel #2
0
bool AlleleIdentity::CharacterizeVariantStatus(LocalReferenceContext &reference_context, int min_hp_for_overcall) {
  //cout << "Hello from CharacterizeVariantStatus; " << altAllele << endl;
  bool is_ok = true;
  status.isIndel   = false;
  status.isHPIndel = false;
  status.isSNP     = false;
  status.isMNV     = false;

  // Get Anchor length
  anchor_length = 0;
  unsigned int a_idx = 0;
  while (a_idx < altAllele.length() and a_idx < reference_context.reference_allele.length()
         and altAllele[a_idx] == reference_context.reference_allele[a_idx]) {
    a_idx++;
    anchor_length++;
  }
  if (DEBUG > 0)
    cout << "- Alternative Allele " << altAllele << " (anchor length " << anchor_length << ")";

  // Change classification to better reflect what we can get with haplotyping
  if (altAllele.length() != reference_context.reference_allele.length()) {
    status.isIndel = true;
    is_ok = SubCategorizeInDel(reference_context);
  }
  else
    if ((int)altAllele.length() == 1) { // Categorize function only works with this setting
      status.isSNP = true;
      SubCategorizeSNP(reference_context, min_hp_for_overcall);
    }
    else {
      status.isMNV = true;
      if (anchor_length < (int)reference_context.reference_allele.length())
        ref_hp_length = reference_context.my_hp_length.at(anchor_length);
      if (DEBUG > 0)
        cout << " is an MNV." << endl;
    }
  return (is_ok);
}