Quellcode durchsuchen

fixed issues of cannot find right path for tracks. Need more tests.

Jiu9Shen vor 5 Jahren
Ursprung
Commit
d04f147763

+ 7 - 1
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt.api.inc

@@ -289,7 +289,7 @@ function tripal_jbrowse_mgmt_get_organisms_list() {
  * @return mixed
  */
 function tripal_jbrowse_mgmt_analysis_parse_4id($name_id) {
-  
+
 
   return $analysis_id;
 }
@@ -424,6 +424,9 @@ function tripal_jbrowse_mgmt_copy_file($source, $destination, $sym_link) {
  */
 function tripal_jbrowse_mgmt_build_http_query($instance) {
   $path = tripal_jbrowse_mgmt_make_slug($instance->title);
+  if(isset($instance->analysis_id)){
+    $path = $path . '_' . $instance->analysis_id;
+  }
   $added_tracks = tripal_jbrowse_mgmt_get_tracks($instance);
   $properties = tripal_jbrowse_mgmt_get_instance_properties($instance->id);
 
@@ -555,6 +558,9 @@ function tripal_jbrowse_mgmt_get_track_list_file_path($instance) {
 
   $path = $settings['data_dir'];
   $path .= '/' . tripal_jbrowse_mgmt_make_slug($instance->title);
+  if(isset($instance->analysis_id)){
+    $path = $path . '_' . $instance->analysis_id;
+  }
   $path .= '/data/trackList.json';
 
   return $path;

+ 2 - 1
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_add.form.inc

@@ -260,7 +260,8 @@ function tripal_jbrowse_mgmt_add_form_submit($form, &$form_state) {
   dpm($form_state, '$form_state in tripal_jbrowse_mgmt_add_form_submit');
   $values = $form_state['values'];
   $organism_id = $values['organism'];
-  $analysis_id = $values['analysis_id'];
+  preg_match_all('!\d+!', $values['analysis'], $match_analysis);
+  $analysis_id = array_pop($match_analysis[0]);
   $description = isset($values['description']) ? $values['description'] : '';
 
   // Check if this is an add or edit form.

+ 0 - 1
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_commands.inc

@@ -65,7 +65,6 @@ function tripal_jbrowse_mgmt_cmd_add_track($track) {
   if(isset($instance->analysis_id)){
     $path = $path . '_' . $instance->analysis_id;
   }
-
   $out = $path . '/data';
 
   if (!file_exists($out)) {

+ 6 - 1
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_tracks.form.inc

@@ -128,7 +128,11 @@ function tripal_jbrowse_mgmt_add_track_form_validate($form, &$form_state) {
   $symbolic_link = $values['symbolic_link'];
   $path = NULL;
 
-  $base_path = $data . '/' . tripal_jbrowse_mgmt_make_slug($instance->title) . '/data';
+  $base_path = $data . '/' . tripal_jbrowse_mgmt_make_slug($instance->title);
+  if(isset($instance->analysis_id)){
+    $base_path = $base_path . '_' . $instance->analysis_id;
+  }
+  $base_path = $base_path . '/data';
 
   if ($file_type === 'vcf') {
     $path = $base_path . '/vcf';
@@ -272,6 +276,7 @@ function tripal_jbrowse_mgmt_add_track_form_validate($form, &$form_state) {
  */
 function tripal_jbrowse_mgmt_add_track_form_submit($form, &$form_state) {
   global $user;
+  dpm($form_state, '$form_state in tripal_jbrowse_mgmt_add_track_form_submit');
   $values = $form_state['values'];
 
   $file = isset($values['file_path']) ? $values['file_path'] : NULL;