changeset 0:65489579eace draft

Uploaded
author jeltje
date Wed, 07 Jan 2015 14:10:22 -0500
parents
children a5f711786a86
files myTools/test-data/testinput.fa myTools/test-data/testoutput.txt myTools/toolExample.pl myTools/toolExample.xml
diffstat 4 files changed, 58 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/myTools/test-data/testinput.fa	Wed Jan 07 14:10:22 2015 -0500
@@ -0,0 +1,4 @@
+>gi|1731512|gb|U51349.1|TAU51349
+CTACGGCAGGAGAAGACATCCGAAGAAGCTGACACCTCTCGCCTACAAGCAGTTTATCCCTAATGTCGCG
+GAGAAGACCTTAGGGGCCAGCGGCAGATACGAAGGCAAGATAACGCGCAATTCGGAGAGATTTAAAGAAC
+TTACTCCAAATTACAATCCCGACATTATCTTTAAGGATGAGGAGAACACG
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/myTools/test-data/testoutput.txt	Wed Jan 07 14:10:22 2015 -0500
@@ -0,0 +1,1 @@
+0.471
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/myTools/toolExample.pl	Wed Jan 07 14:10:22 2015 -0500
@@ -0,0 +1,23 @@
+#!/usr/local/bin/perl -w
+
+# usage : perl toolExample.pl <FASTA file> <output file>
+
+open (IN, "<$ARGV[0]");
+open (OUT, ">$ARGV[1]");
+while (<IN>) {
+    chop;
+    if (m/^>/) {
+        s/^>//;
+        if ($. > 1) {
+            print OUT sprintf("%.3f", $gc/$length) . "\n";
+        }
+        $gc = 0;
+        $length = 0;
+    } else {
+        ++$gc while m/[gc]/ig;
+        $length += length $_;
+    }
+}
+print OUT sprintf("%.3f", $gc/$length) . "\n";
+close( IN );
+close( OUT );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/myTools/toolExample.xml	Wed Jan 07 14:10:22 2015 -0500
@@ -0,0 +1,30 @@
+<tool id="fa_gc_content_1" name="Compute GC content">
+  <description>for each sequence in a file</description>
+  <command interpreter="perl">toolExample.pl $input $output</command>
+  <inputs>
+    <param format="fasta" name="input" type="data" label="Source file"/>
+  </inputs>
+  <outputs>
+    <data format="tabular" name="output" />
+  </outputs>
+
+  <tests>
+    <test>
+      <param name="input" value="input.fa"/>
+      <output name="out_file1" file="testoutput.txt"/>
+    </test>
+  </tests>
+
+  <help>
+This tool computes GC content from a FASTA file.
+  </help>
+
+<tests>
+    <test>
+      <param name="input1" value="in.fa" />
+      <output name="output" file="out.txt" />     
+    </test>
+</tests>
+
+</tool>
+