function tripal_feature_get_matched_alignments

2.x tripal_feature.theme.inc tripal_feature_get_matched_alignments($feature)
3.x tripal_feature.theme.inc tripal_feature_get_matched_alignments($feature)
1.x tripal_feature.module tripal_feature_get_matched_alignments($feature)

This function is for features that align through an intermediate such as 'EST_match' or 'match'. This occurs in the case where two sequences align but where one does not align perfectly. Some ESTs may be in a contig but not all of the EST. Portions may overhang and not be included in the consensus if quality is bad. For example: Feature 1: Contig -------------------- Feature 2: EST_match ------- Feature 3: EST ---------

The feature provided to the function will always be the feature 1. The featureloc columns prefixed with 'right' (e.g. right_fmin) belong to the alignment of feature 3 with feature 2

Features may align to more than one feature and are not matches. We do not want to include these, so we have to filter on the SO terms: match, or %_match

Related topics

1 call to tripal_feature_get_matched_alignments()

File

tripal_feature/theme/tripal_feature.theme.inc, line 617

Code

function tripal_feature_get_matched_alignments($feature) {

  $sql = "
     SELECT
       FL1.featureloc_id    as left_featureloc_id,
       FL1.srcfeature_id    as left_srcfeature_id,
       FL1.feature_id       as left_feature_id,
       FL1.fmin             as left_fmin,
       FL1.is_fmin_partial  as left_is_fmin_partial,
       FL1.fmax             as left_fmax,
       FL1.is_fmax_partial  as left_is_fmax_partial,
       FL1.strand           as left_strand,
       FL1.phase            as left_phase,
       FL1.locgroup         as left_locgroup,
       FL1.rank             as left_rank,
       FL2.featureloc_id    as right_featureloc_id,
       FL2.srcfeature_id    as right_srcfeature_id,
       FL2.feature_id       as right_feature_id,
       FL2.fmin             as right_fmin,
       FL2.is_fmin_partial  as right_is_fmin_partial,
       FL2.fmax             as right_fmax,
       FL2.is_fmax_partial  as right_is_fmax_partial,
       FL2.strand           as right_strand,
       FL2.phase            as right_phase,
       FL2.locgroup         as right_locgroup,
       FL2.rank             as right_rank
     FROM {feature} F1
       INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id
       INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id
       INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id
       INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id
     WHERE
       F1.feature_id = :feature_id  AND
       (CVT2.name = 'match' or CVT2.name like '%_match')
     ORDER BY FL1.fmin
   ";

  $results = chado_query($sql, array(':feature_id' => $feature->feature_id));

  // iterate through the results and add them to our featurelocs array
  $featurelocs = array();
  while ($fl = $results->fetchObject()) {
    // ignore featurelocs where the left and right srcfeature is the same
    if (strcmp($fl->left_srcfeature_id, $fl->right_srcfeature_id) == 0) {
      continue;
    }
    $featurelocs[] = $fl;
  }
  return $featurelocs;
}