statonlab / tripal_manage_analyses

GNU General Public License v3.0
0 stars 1 forks source link

make child sequence path configurable site to site #72

Open bradfordcondon opened 5 years ago

bradfordcondon commented 5 years ago

https://github.com/statonlab/tripal_manage_analyses/pull/71

This PR adds support for sequences as stored in i5k. In short:

I think this would be better if we had a configuration section for the field. You would then a) specify which features to display sequences for, and b) what to pass to options to determine how to build the features for your particular site.

 $check = ['polypeptide', 'mRNA', 'CDS'];

    if (!in_array($type, $check)) {
      $out = 'N/A';
      return $out;
    }

    $options = ['width' => 40, 'is_html' => 1];
    // TODO: add in more options based on the sequence we're looking at.
    // aggregate: Set to '1' if the sequence should only contain sub features, excluding intro sub feature sequence. For example, set this option to obtain just the coding sequence of an mRNA.
    // sub_feature_types: Only include sub features (or child features) of the types provided in the array.
    // TODO: I guess this should be done in the LOAD instead of the formatter?

    if ($type == 'CDS') {
      $options['aggregate'] = 1;
      $options['sub_feature_types'] = ['exon'];
    }

    $returned = chado_get_feature_sequences(['feature_id' => $info->feature_id], $options);

    if (!$returned[0]['residues']) {
      $options['derive_from_parent'] = 1;
      $returned = chado_get_feature_sequences(['feature_id' => $info->feature_id], $options);
    }