Browse Source

Cleaned out unused functions from feature module

Stephen Ficklin 11 years ago
parent
commit
3df9593c8c
2 changed files with 13 additions and 307 deletions
  1. 13 0
      tripal_feature/api/tripal_feature.api.inc
  2. 0 307
      tripal_feature/tripal_feature.module

+ 13 - 0
tripal_feature/api/tripal_feature.api.inc

@@ -1100,3 +1100,16 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
   }
   return TRUE;
 }
+
+/**
+ *
+ *
+ * @ingroup tripal_feature
+ */
+function tripal_feature_return_fasta($feature, $desc) {
+  $fasta  = ">" . variable_get('chado_feature_accession_prefix', 'FID') . "$feature->feature_id|$feature->name";
+  $fasta .= " $desc\n";
+  $fasta .= wordwrap($feature->residues, 50, "\n", TRUE);
+  $fasta .= "\n\n";
+  return $fasta;
+}

+ 0 - 307
tripal_feature/tripal_feature.module

@@ -735,64 +735,6 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
     }
   }
 }
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function chado_feature_add_gbaccession($accession, $feature_id) {
-
-  // use chado database
-
-  // remove any old accession from genbank dbEST
-  $fdbxref_dsql = "
-    DELETE FROM {feature_dbxref}
-    WHERE feature_id = :feature_id and dbxref_id IN
-      (SELECT DBX.dbxref_id
-       FROM {dbxref} DBX
-         INNER JOIN DB  ON DB.db_id = DBX.db_id
-         INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id
-       WHERE DB.name = 'DB:Genbank' and FDBX.feature_id = :feature_id
-      )
-  ";
-  if (!chado_query($fdbxref_dsql, array(':feature_id' => $feature_id))) {
-    $error .= "Could not remove accession from feature. ";
-  }
-
-  // if we don't have an accession number to add then just return
-  if (!$accession) {
-    return;
-  }
-  // get the db_id
-  $db_sql = "SELECT db_id FROM {DB} WHERE name = 'DB:Genbank_est'";
-  $db = chado_query($db_sql)->fetchObject();
-
-  // check to see if we have this accession number already in the database
-  // if so then don't add it again. it messes up drupal if the insert fails.
-  // It is possible for the accession number to be present and not the feature
-  $dbxref_sql = "SELECT dbxref_id FROM {dbxref} WHERE db_id = :db_id and accession = :accession";
-  $dbxref = chado_query($dbxref_sql, array(':db_id' => $db->db_id, ':accession' => $accession))->fetchObject();
-  if (!$dbxref) {
-    // add the accession number
-    $dbxref_isql = "INSERT INTO {dbxref} (db_id, accession) VALUES (:db_id, :accession) ";
-    if (!chado_query($dbxref_isql, array(':db_id' => $db->db_id, ':accession' => $accession))) {
-      $error .= 'Could not add accession as a database reference ';
-    }
-    // get the dbxref_id for the just added accession number
-    $dbxref_sql = "SELECT dbxref_id FROM {dbxref} WHERE db_id = :db_id and accession = :accession";
-    $dbxref = chado_query($dbxref_sql, array(':db_id' => $db->db_id, ':accession' => $accession))->fetchObject();
-  }
-
-
-  // associate the accession number with the feature
-  $feature_dbxref_isql = "INSERT INTO {feature_dbxref} (feature_id, dbxref_id) VALUES (:feature_id, :dbxref_id) ";
-  if (!chado_query($feature_dbxref_isql, array(':feature_id' => $feature_id, ':dbxref_id' => $dbxref->dbxref_id))) {
-    $error .= 'Could not add feature database reference. ';
-  }
-
-  return $error;
-}
-
 
 /**
  *  When a node is requested by the user this function is called to allow us
@@ -835,96 +777,6 @@ function chado_feature_load($nodes) {
     }
   }
 }
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_load_organism($organism_id) {
-  // add organism details
-  $sql = "SELECT * FROM {organism} WHERE organism_id = :organism_id";
-  $organism = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
-  return $organism;
-}
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_load_synonyms($feature_id) {
-
-  $sql = "
-    SELECT S.name
-    FROM {feature_synonym} FS
-      INNER JOIN {synonym} S  ON FS.synonym_id = S.Synonym_id
-    WHERE FS.feature_id = :feature_id
-    ORDER BY S.name
-   ";
-  $results = chado_query($sql, array(':feature_id' => $feature_id));
-  $synonyms = array();
-  $i=0;
-  while ($synonym = $results->fetchObject()) {
-    $synonyms[$i++] = $synonym;
-  }
-  return $synonyms;
-}
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_load_properties($feature_id) {
-
-  $sql = "
-    SELECT
-      CVT.name as cvname, CVT.definition, CVT.is_obsolete,
-      FS.type_id, FS.value, FS.rank,
-      DBX.dbxref_id,DBX.accession,DB.name as dbname,
-      DB.urlprefix, DB.description as db_description, DB.url
-    FROM {featureprop} FS
-      INNER JOIN {cvterm} CVT ON FS.type_id    = CVT.cvterm_id
-      INNER JOIN {dbxref} DBX ON CVT.dbxref_id = DBX.dbxref_id
-      INNER JOIN {db} DB      ON DB.db_id      = DBX.db_id
-    WHERE
-      FS.feature_id = :feature_id
-    ORDER BY FS.rank ASC
-  ";
-  $results = chado_query($sql, array(':feature_id' => $feature_id));
-  $i=0;
-  $properties = array();
-  while ($property = $results->fetchObject()) {
-    $properties[$i++] = $property;
-  }
-  return $properties;
-}
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_load_references($feature_id) {
-
-  $sql = "
-    SELECT
-       F.uniquename, F.Feature_id,
-       DB.description as dbdesc, DB.db_id, DB.name as db_name, DB.urlprefix,
-       DBX.accession, DBX.dbxref_id
-    FROM {feature} F
-      INNER JOIN {feature_dbxref} FDBX ON F.feature_id  = FDBX.feature_id
-      INNER JOIN {dbxref} DBX          ON DBX.dbxref_id = FDBX.dbxref_id
-      INNER JOIN {db}                  ON DB.db_id      = DBX.db_id
-    WHERE
-      F.feature_id = :feature_id
-    ORDER BY DB.name
-  ";
-  $results = chado_query($sql, array(':feature_id' => $feature_id));
-  $references = array();
-  $i=0;
-  while ($accession = $results->fetchObject()) {
-    $references[$i++] = $accession;
-  }
-  return $references;
-}
 /**
  *
  *
@@ -1351,151 +1203,6 @@ function tripal_feature_load_organism_feature_counts($organism) {
   return array( 'types' => $ordered_types, 'names' => $names, 'enabled' => TRUE );
 }
 
-/**
- * This generates the Feature Browser which can optionally be included on library pages
- * and shows all features belonging to the given library. This Browse can be shown/hidden
- * on the Feature Configuration page.
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_load_library_feature_browser($library) {
-
-  // don't show the browser if the settings in the admin page is turned off
-  // instead return the array indicating the status of the browser
-  $show_browser = variable_get('tripal_library_feature_browse_setting', 'show_feature_browser');
-  if (strcmp($show_browser, 'show_feature_browser')!=0) {
-    return array('enabled' => FALSE);
-  }
-
-  // get a list of feature types to include in the browser
-  $allowed_types = variable_get('chado_browser_feature_types', 'EST contig');
-  $allowed_types = preg_replace("/[\s\n\r]+/", " ", $allowed_types);
-  $so_terms = split(' ', $allowed_types);
-  $where_cvt = "";
-  $args = array();
-  $i = 0;
-  foreach ($so_terms as $term) {
-    $where_cvt .= "CVT.name = :cvtname$i OR ";
-    $args[':cvtname$i'] = $term;
-    $i++;
-  }
-  $where_cvt = drupal_substr($where_cvt, 0, drupal_strlen($where_cvt)-3);  # strip trailing 'OR'
-
-  // get the features for this library
-  $sql  = "
-    SELECT F.name, F.feature_id, F.uniquename, CVT.name as cvname
-    FROM {feature} F
-      INNER JOIN {cvterm} CVT         ON F.type_id = CVT.cvterm_id
-      INNER JOIN {library_feature} LF ON F.feature_id = LF.feature_id
-      INNER JOIN {library} L          ON LF.library_id = L.library_id
-    WHERE LF.library_id = :library_id and ($where_cvt)
-    ORDER BY feature_id ASC
-  ";
-  $args[':library_id'] = $library->libary_id;
-
-  // the counting SQL
-  $csql  = "
-    SELECT count(*)
-    FROM {feature} F
-      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
-      INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id
-      INNER JOIN {library} L on LF.library_id = L.library_id
-    WHERE LF.library_id = :library_id and ($where_cvt)
-      GROUP BY L.library_id ";
-
-  $org_features = chado_pager_query($sql, 10, 0, $csql, $args);
-  $pager = theme('pager');
-
-  // prepare the query that will lookup node ids
-  $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = :feature_id";
-  $i=0;
-  $features = array();
-  while ($feature = $org_features->fetchObject()) {
-    $node = db_query($sql, array(':feature_id' => $feature->feature_id))->fetchObject();
-    $feature->nid = $node->nid;
-    $features[$i++] = $feature;
-  }
-
-  return array( 'features' => $features, 'pager' => $pager, 'enabled' => TRUE );
-}
-/**
- * This generates the Feature Browse which can optionally be included on library pages
- * and shows all features belonging to the given library. This Browse can be shown/hidden
- * on the Feature Configuration page.
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_load_analysis_feature_browser($analysis) {
-
-  // don't show the browser if the settings in the admin page is turned off
-  // instead return the array indicating the status of the browser
-  $show_browser = variable_get('tripal_analysis_feature_browse_setting', 'show_feature_browser');
-  if (strcmp($show_browser, 'show_feature_browser')!=0) {
-    return array('enabled' => FALSE);
-  }
-
-  // get a list of feature types to include in the browser
-  $allowed_types = variable_get('chado_browser_feature_types', 'EST contig');
-  $allowed_types = preg_replace("/[\s\n\r]+/", " ", $allowed_types);
-  $so_terms = split(' ', $allowed_types);
-  $where_cvt = "";
-  $i = 0;
-  $args = array();
-  foreach ($so_terms as $term) {
-    $where_cvt .= "CVT.name = :aname$i OR ";
-    $args[":aname$i"] = $term;
-    $i++;
-  }
-  $where_cvt = drupal_substr($where_cvt, 0, drupal_strlen($where_cvt)-3);  # strip trailing 'OR'
-
-  // get the features for this library
-  $sql  = "
-    SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname
-    FROM {feature} F
-      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
-      INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
-      INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
-    WHERE A.analysis_id = :analysis_id and ($where_cvt)
-    ORDER BY feature_id ASC
-  ";
-  $args[':analysis_id'] = $analysis->analysis_id;
-
-  // the counting SQL
-  $csql  = "
-    SELECT count(*)
-    FROM {feature} F
-      INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id
-      INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id
-      INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id
-    WHERE A.analysis_id = %d and ($where_cvt)
-    GROUP BY A.analysis_id
-  ";
-
-  $org_features = chado_pager_query($sql, 10, 0, $csql, $args);
-  $pager = theme('pager');
-
-  // prepare the query that will lookup node ids
-  $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = :feature_id";
-  $i=0;
-  $features = array();
-  while ($feature = $org_features->fetchObject()) {
-    $node = db_query($sql, array(':feature_id' => $feature->feature_id))->fetchObject();
-    $feature->nid = $node->nid;
-    $features[$i++] = $feature;
-  }
-
-  return array( 'features' => $features, 'pager' => $pager, 'enabled' => TRUE );
-}
-
-/**
- *  used to sort the list of relationship objects by start position
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_sort_rel_objects($a, $b) {
-  return strnatcmp($a->fmin, $b->fmin);
-}
-
 /**
  *  used to sort the list of relationship parts by start position
  *
@@ -2015,20 +1722,6 @@ function tripal_feature_del_vocabulary() {
 
 }
 
-
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_return_fasta($feature, $desc) {
-  $fasta  = ">" . variable_get('chado_feature_accession_prefix', 'FID') . "$feature->feature_id|$feature->name";
-  $fasta .= " $desc\n";
-  $fasta .= wordwrap($feature->residues, 50, "\n", TRUE);
-  $fasta .= "\n\n";
-  return $fasta;
-}
 /**
  *
  *