You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/06/02 17:22:48 UTC

[airavata-php-gateway] 01/14: adding a prefix for output file

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch dreg-gateway
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git

commit 1fe068716937b1695479f890e0a3e7e1c5b7e345
Author: root <ro...@osboxes>
AuthorDate: Wed Mar 14 16:09:31 2018 +0000

    adding a prefix for output file
---
 app/libraries/FileTransfer.php               | 46 ++++++++++++++++++++++------
 app/views/partials/experiment-info.blade.php | 38 ++++++++++++++++++-----
 2 files changed, 66 insertions(+), 18 deletions(-)

diff --git a/app/libraries/FileTransfer.php b/app/libraries/FileTransfer.php
index c59b280..73882a6 100644
--- a/app/libraries/FileTransfer.php
+++ b/app/libraries/FileTransfer.php
@@ -24,15 +24,16 @@ class FileTransfer {
         $filelist = explode("\n", RBase64::decode( $filelist ) );
         $folder_path=$filelist[0]. "ARCHIVE" ;
         $content = "[ \n";
+        $out_prefix = $filelist[3];
 
         $content = $content . ' {
             type:"bigwig",
-            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode($filelist[2]). '",
+            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode($filelist[0].'/'.$filelist[1]). '",
             name: "'. $filelist[1] .'",
             #fixedscale:{min:0,max:20},
             summarymethod:"max",
-            colorpositive:"#B30086",
-            colornegative:"#0000e5",
+            colorpositive:"#C5000B",
+            colornegative:"#0084D1",
             height:100,
             mode: "show",
             },'. "\n" ;
@@ -40,19 +41,19 @@ class FileTransfer {
 
        $content = $content . ' {
             type:"bigwig",
-            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode($filelist[4]). '",
+            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode($filelist[0].'/'.$filelist[2]). '",
             name: "'. $filelist[3] .'",
             #fixedscale:{min:0,max:20},
             summarymethod:"min",
-            colorpositive:"#B30086",
-            colornegative:"#0000e5",
+            colorpositive:"#C5000B",
+            colornegative:"#0084D1",
             height:100,
             mode: "show",
             },'. "\n" ;
 
         $content = $content . '{
-            type:"bedgraph",
-            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/out.dREG.infp.bed.gz').'",
+            type:"bigwig",
+            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/'. $out_prefix .'.dREG.infp.bw').'",
             name: "dREG Info. Sites:",
             mode: "show",
             colorpositive:"#B30086",
@@ -63,8 +64,8 @@ class FileTransfer {
         },'. "\n";
 
         $content = $content . '{
-            type:"bedgraph",
-            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/out.dREG.peak.score.bed.gz').'",
+            type:"bigwig",
+            url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/'. $out_prefix .'.dREG.peak.score.bw').'",
             name: "dREG Peak Calling:",
             mode: "show",
             colorpositive:"#B30086",
@@ -76,6 +77,31 @@ class FileTransfer {
 
 
         #$content = $content . '{
+        #    type:"bedgraph",
+        #    url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/out.dREG.infp.bed.gz').'",
+        #    name: "dREG Info. Sites:",
+        #    mode: "show",
+        #    colorpositive:"#B30086",
+        #    colornegative:"#0000e5",
+        #    backgroundcolor:"#ffffe5",
+        #    height:40,
+        #    fixedscale:{min:0, max:1},
+        #},'. "\n";
+
+        #$content = $content . '{
+        #    type:"bedgraph",
+        #    url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/out.dREG.peak.score.bed.gz').'",
+        #    name: "dREG Peak Calling:",
+        #    mode: "show",
+        #    colorpositive:"#B30086",
+        #    colornegative:"#0000e5",
+        #    backgroundcolor:"#ffffe5",
+        #    height:40,
+        #    fixedscale:{min:0.2, max:1.0},
+        #},'. "\n";
+
+
+        #$content = $content . '{
         #    type:"bigwig",
         #    url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.RBase64::encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
         #    name: "imputed DNase-I signal:",
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 4f43aee..268058b 100755
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -200,16 +200,32 @@
     }
 
     $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
+
+
+    $param_prefix = "out";
+    if( count( $experiment->experimentInputs) > 0 ) 
+       foreach( $experiment->experimentInputs as $input)
+       {
+          if ($input->applicationArgument == "prefix") {
+              $param_prefix = $input->value;
+          }
+       } 
 ?>
             <td>
                 <select id="download">
                     <option value=''>Select results</option>
-@if(file_exists($dataRoot . '/' . $expDataDir. '/ARCHIVE/out.dREG.tar.gz') )
-                    <option value="out.dREG.tar.gz">Full results</option>  
+@if(file_exists($dataRoot . '/' . $expDataDir. '/ARCHIVE/'.$param_prefix.'.tar.gz') )
+                    <option value=<?php echo $param_prefix.".tar.gz" ?>>Full results</option>  
+@endif
+@if(file_exists($dataRoot . '/' . $expDataDir. '/ARCHIVE/'.$param_prefix.'.dREG.infp.bed.gz') )
+                    <option value=<?php echo $param_prefix.".dREG.infp.bed.gz"?>>dREG informative sites</option>
+@endif
+@if(file_exists($dataRoot . '/' . $expDataDir. '/ARCHIVE/'.$param_prefix.'.dREG.peak.full.bed.gz') )
+                    <option value=<?php echo $param_prefix.".dREG.peak.full.bed.gz"?>>dREG peaks </option> 
+@endif
+@if(file_exists($dataRoot . '/' . $expDataDir. '/ARCHIVE/'.$param_prefix.'.dREG.peak.score.bed.gz') )
+                    <option value=<?php echo $param_prefix.".dREG.peak.score.bed.gz"?>>dREG peak(only with scores)</option>
 @endif
-                    <option value="out.dREG.infp.bed.gz">dREG informative sites</option>
-                    <option value="out.dREG.peak.full.bed.gz">dREG peaks </option> 
-                    <option value="out.dREG.peak.score.bed.gz">dREG peak(only with scores)</option>
                 </select> &nbsp;&nbsp;&nbsp;&nbsp;
 
    	       <a href="" target="_blank" id="retLinks">Download&nbsp;<span class="glyphicon glyphicon-save"  style="width:20px"></span></a>
@@ -497,12 +513,18 @@
                         $currentOutputPath = $rp->filePath;
                       break;
                     }
-                   
-                    $path = str_replace($dataRoot, "", parse_url($currentOutputPath, PHP_URL_PATH));
-                    $filelist = $filelist . $input->name . "\n". $path. "\n";
+                    $path = str_replace($dataRoot.$expDataDir, "", parse_url($currentOutputPath, PHP_URL_PATH));
+                    $filelist = $filelist . $path. "\n";
+                }
+                else
+                {
+                    $filelist = $filelist . $input->value. "\n";
                 }
 
     $filelist = $expDataDir ."\n". $filelist;
+    // in case no prefix label for output file in the interface, put "out" at the end
+    $filelist =  $filelist . "out\n";
+
     $protocol = 'http';
     if ( isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') 
         $protocol = 'https';