spficklin 14 years ago
parent
commit
bcf56a9189

+ 38 - 3
tripal_feature/fasta_loader.php

@@ -81,6 +81,39 @@ function tripal_feature_fasta_load_form (){
       '#weight' => 6
    );
 
+
+   $form['analysis'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Analysis Used to Derive Features'),
+      '#weight'=> 6,
+      '#collapsed' => TRUE
+   ); 
+   $form['analysis']['desc'] = array(
+      '#type' => 'markup',
+      '#value' => t("Why specify an analysis for a data load?  All data comes 
+         from some place, even if downloaded from Genbank. By specifying
+         analysis details for all data uploads, it allows an end user to reproduce the
+         data set, but at least indicates the source of the data."), 
+   );
+
+   // get the list of organisms
+   $sql = "SELECT * FROM {analysis} ORDER BY name";
+   $previous_db = tripal_db_set_active('chado');  // use chado database
+   $org_rset = db_query($sql);
+   tripal_db_set_active($previous_db);  // now use drupal database
+   $analyses = array();
+   $analyses[''] = '';
+   while($analysis = db_fetch_object($org_rset)){
+      $analyses[$analysis->analysis_id] = "$analysis->name ($analysis->program $analysis->programversion, $analysis->sourcename)";
+   }
+   $form['analysis']['analysis_id'] = array (
+     '#title'       => t('Analysis'),
+     '#type'        => t('select'),
+     '#description' => t("Choose the analysis to which these features are associated "),
+     '#required'    => TRUE,
+     '#options'     => $analyses,
+   );
+
    // Advanced Options
    $form['advanced'] = array(
       '#type' => 'fieldset',
@@ -288,9 +321,11 @@ function tripal_feature_fasta_load_form_submit ($form, &$form_state){
    $rel_type     = $form_state['values']['rel_type'];
    $re_subject   = trim($form_state['values']['re_subject']);
    $parent_type   = trim($form_state['values']['parent_type']);
+   $analysis_id = $form_state['values']['analysis_id'];
 
    $args = array($dfile,$organism_id,$type,$library_id,$re_name,$re_uname,
-            $re_accession,$db_id,$rel_type,$re_subject,$parent_type,$update,$user->uid);
+            $re_accession,$db_id,$rel_type,$re_subject,$parent_type,$update,
+            $user->uid,$analysis_id);
 
    tripal_add_job("Import FASTA file: $dfile",'tripal_feature',
       'tripal_feature_load_fasta',$args,$user->uid);
@@ -303,7 +338,7 @@ function tripal_feature_fasta_load_form_submit ($form, &$form_state){
  */
 function tripal_feature_load_fasta($dfile, $organism_id, $type,
    $library_id, $re_name, $re_uname, $re_accession, $db_id, $rel_type,
-   $re_subject, $parent_type, $update,$uid, $job = NULL)
+   $re_subject, $parent_type, $update,$uid, $analysis_id, $job = NULL)
 {
 
    print "Opening FASTA file $dfile\n";
@@ -336,7 +371,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
          if($name){
            tripal_feature_fasta_loader_insert_feature($name,$uname,$db_id,
               $accession,$subject,$rel_type,$parent_type,$library_id,$organism_id,$type,
-              $source,$residues,$update);
+              $source,$residues,$update,$re_name);
            $residues = '';
            $name = '';
          }

+ 1 - 6
tripal_feature/gff_loader.php

@@ -97,12 +97,7 @@ function tripal_core_gff3_load_form (){
       '#value' => t("Why specify an analysis for a data load?  All data comes 
          from some place, even if downloaded from Genbank. By specifying
          analysis details for all data uploads, it allows an end user to reproduce the
-         data set.  In some cases some of the fields may not apply.  For 
-         data downloaded from Genbank, the 'program' field does not apply but is
-         required.  In this case, simply provide the name of the data source 
-         (e.g. NCBI Genbank) for the program and use the date accessed for the
-         program version. For the description, be sure to include the search
-         criteria used for selecting data from GenBank."), 
+         data set, but at least indicates the source of the data."), 
    );
 
    // get the list of organisms

+ 11 - 1
tripal_feature/tripal_feature.admin.inc

@@ -54,11 +54,21 @@ function tripal_feature_module_description_page() {
                   <li>Gene Ontology (if loading GO terms for features)</li>
                </ul></p></li>
 
-               <li><p><b>Create Orgnisms</b>:  Before adding feature data you must already have the 
+               <li><p><b>Create Organisms</b>:  Before adding feature data you must already have the 
                organisms loaded in the database.  See the 
                <a href="'.url('admin/tripal/tripal_organism').'">Tripal Organism Admin page</a> for 
                instructions for adding and Syncing organisms.</p></li>
 
+               <li><p><b>Create Analysis</b>:  Tripal requires that feature data loaded using the Tripal loaders
+               be associated with an analyis.  This provides a grouping for the feature data and can be used
+               later to visualize data pipelines.  Before loading feature data through the FASTA or GFF loaders
+               you will need to <a href="'.url('node/add').'">create an analysis</a> for the data.</p></li>
+
+               <li><p><b>Create Database</b>:  If you would like to associate your feature data with an 
+               external reference database, check to ensure that the <a href="'.url('admin/tripal/tripal_db/edit_db').'">
+               database record already exists</a>.  If not you should <a href="'.url('admin/tripal/tripal_db/add_db').'">add a new database record</a> before importing
+               feature data.</p></li>
+
                <li><p><b>Data Import</b>:  if you do not already have an existing Chado database with preloaded data 
                then you will want
                to import data.  You can do so using the Chado perl scripts that come with the normal 

+ 6 - 0
tripal_feature/tripal_feature.module

@@ -2166,6 +2166,12 @@ function tripal_feature_job_describe_args($callback,$args){
       else {
          $new_args['Insert Only New Features'] = 'Yes';
       }
+
+      // add in the analysis 
+      if($args[13]){
+         $analysis = tripal_core_chado_select('analysis',array('name'),array('analysis_id' => $args[13]));
+      }
+      $new_args['Analysis'] = $analysis[0]->name;
    }
    return $new_args;
 }