changeset 2:4c225e57d44b draft default tip

Uploaded
author pitagora
date Wed, 09 Jul 2014 05:23:25 -0400
parents 75dc30937969
children
files export.pl export.xml link_path.pl link_path.xml
diffstat 4 files changed, 117 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/export.pl	Wed Jul 09 05:23:25 2014 -0400
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use File::Copy;
+use File::Basename;
+
+# ARGS
+my ($symlink, $dest, $logfile, @files)=@ARGV;
+die("Absolute path required\n") unless $dest =~ /^\//;
+die("Paths containing '..' are disallowed\n") if $dest =~ /\/\.\.\//;
+die("Only /home/*, /house/*, and /ifs/* paths are allowed\n") unless $dest =~ /^\/home/ or $dest =~ /^\/house/ or $dest =~ /^\/ifs/;
+die("Destination folder does not exist: $dest\n") unless -e $dest;
+die("Destination path is not a folder: $dest\n") unless -d $dest;
+
+# CP
+open(OUT, ">$logfile") or die($!);
+while (@files) {
+    my $file=shift @files or die("Source filename required\n");
+    my $name=shift @files or die("Destination filename required\n");
+    print OUT "$file -> $dest/$name\n";
+    if ($symlink) {
+        symlink($file, "$dest/$name");
+    } else {
+        copy($file, "$dest/$name");
+    }
+}
+close OUT;
+print "Exported ", scalar(@files), " to $dest\n";
+exit;
+__END__
+Copyright (c) 2011 US DOE Joint Genome Institute.
+Use freely under the same license as Galaxy itself.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/export.xml	Wed Jul 09 05:23:25 2014 -0400
@@ -0,0 +1,29 @@
+<tool id="export" name="Export" version="1.0.0">
+<description>to a Local File</description>
+<command interpreter="perl">export.pl $symlink $dest $logfile
+#for $i in $files
+${i.file} ${i.name}
+#end for
+</command>
+<inputs>
+    <param name="symlink" type="select" display="radio" label="Copy or symlink files?">
+        <option value="0">COPY the files so I may delete the files from Galaxy</option>
+        <option value="1">SYMLINK the files; I will not delete the files from Galaxy</option>
+    </param>
+    <param name="dest" type="text" size='120' value="/home/galaxy/galaxy-work/" label="Destination folder" help="Must be writable by Galaxy user" />
+	<repeat name="files" title="Files to export">
+		<param name="file" type="data" format="data" label="File"/>
+        <param name="name" type="text" size='20' value="" label="Name" />
+	</repeat>
+</inputs>
+<outputs>
+    <data name="logfile" format="txt" />
+</outputs>
+<help>
+**What it does**
+
+This tool allows staff to export files from Galaxy to a specified NFS path.
+
+The destination folder must be writable by the Galaxy user. It is suggested that you create a folder ~/dropbox and chmod 777 it.
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/link_path.pl	Wed Jul 09 05:23:25 2014 -0400
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+
+# INTERNAL USE ONLY!
+# THIS TOOLS IS WRITTEN BASED ON link_path.pl FROM US DOE Joint Genome Institute.
+# 2012-02-10 Yamanaka
+
+# THIS TOOL HAS BEEN DEPRECATED IN FAVOR OF THE galaxy_import.pl AND gcpd.pl METHOD
+# WHICH DON'T REQUIRE SETTING METADATA MANUALLY FOR EACH FILE.
+
+use strict;
+use File::Copy;
+
+# CONFIG
+my @allowed_paths = ('/');
+
+# ARGS
+my ($src, $dest, $symlink)=@ARGV;
+die("Absolute path required\n") unless $src =~ /^\//;
+die("Paths containing '..' are disallowed\n") if $src =~ /\/\.\.\//;
+my $ok=0;
+foreach my $dir (@allowed_paths) {
+    my $re="^$dir";
+    $re =~ s/\//\\\//g;
+    if ($src =~ /$re/) {
+        $ok=1;
+        last;
+    }
+}
+die("Not an allowed source path\n") unless $ok;
+
+# CP
+unlink($dest);
+if ($symlink) {
+    symlink($src, $dest);
+} else {
+    copy($src,$dest);
+}
+exit;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/link_path.xml	Wed Jul 09 05:23:25 2014 -0400
@@ -0,0 +1,18 @@
+<tool id="import" name="Import" version="1.0.0">
+<description>a Local File</description>
+<command interpreter="perl">link_path.pl $source $dest $symlink</command>
+<inputs>
+    <param name="source" type="text" size='100' value='' label="Complete pathname" />
+    <param name="symlink" type="select" display="radio" label="Is that a permanent location?">
+        <option value="0">No, COPY the file</option>
+        <option value="1">Yes, SYMLINK the file</option>
+    </param>
+</inputs>
+<outputs>
+    <data format="data" name="dest" />
+</outputs>
+<help>
+This tool allows you to import a local file into Galaxy.
+You have to edit the imported file's metadata to assign it to the appropriate datatype.
+</help>
+</tool>