Mercurial > repos > omics > fasta_gc
changeset 0:15174d0453f5 draft default tip
"planemo upload commit 7f2686c5c7a5afd898217565f1cee58996f9d285-dirty"
author | omics |
---|---|
date | Tue, 10 Mar 2020 03:45:23 -0400 |
parents | |
children | |
files | count_gc.txt fasta_gc.pl fasta_gc.xml sample.fasta test-data/count_gc.txt |
diffstat | 5 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/count_gc.txt Tue Mar 10 03:45:23 2020 -0400 @@ -0,0 +1,3 @@ +0.520 +0.600 +0.720
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fasta_gc.pl Tue Mar 10 03:45:23 2020 -0400 @@ -0,0 +1,23 @@ +#!/usr/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 ); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fasta_gc.xml Tue Mar 10 03:45:23 2020 -0400 @@ -0,0 +1,13 @@ +<tool id="fasta_gc" name="Fasta GC"> + <description>For each sequence in a fasta</description> + <command>perl '$__tool_directory__/fasta_gc.pl' '$input' output.csv</command> + <inputs> + <param name="input" type="data" format="fasta" label="Fasta file"/> + </inputs> + <outputs> + <data name="output" format="tabular" from_work_dir="output.csv" /> + </outputs> + <help> +This tool computes GC content from a FASTA file. + </help> +</tool> \ No newline at end of file