Mercurial > repos > edward-kirton > hmmer
changeset 2:376092ae10ed draft
reformat output to tabular
author | Edward Kirton <eskirton@lbl.gov> |
---|---|
date | Thu, 30 Aug 2012 11:58:27 -0700 |
parents | 66f8262e1686 |
children | c0fb858f44a2 |
files | hmmer.xml hmmer_wrapper.pl |
diffstat | 2 files changed, 45 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hmmer.xml Mon Mar 05 22:51:04 2012 -0800 +++ b/hmmer.xml Thu Aug 30 11:58:27 2012 -0700 @@ -1,8 +1,12 @@ <tool id="hmmer" name="hmmer" version="1.0.0"> <description>hmmscan/search seqs vs profiles</description> -<command> +<requirements> + <requirement type="package">hmmer</requirement> +</requirements> +<command interpreter="perl"> +hmmer_wrapper.pl $program -##--cpu 8 +--cpu 8 --tblout $tblout --domtblout $domtblout $acc @@ -126,10 +130,6 @@ <data name="tblout" format="tabular" label="${tool.name} on $on_string: Per-sequence hits" /> <data name="domtblout" format="tabular" label="${tool.name} on $on_string: Per-domain hits" /> </outputs> -<requirements> - <requirement type="binary">hmmscan</requirement> - <requirement type="binary">hmmsearch</requirement> -</requirements> <tests> </tests> <help>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hmmer_wrapper.pl Thu Aug 30 11:58:27 2012 -0700 @@ -0,0 +1,39 @@ +#!/usr/bin/env perl + +use warnings; +use strict; +use File::Copy; + +my $cmd="@ARGV"; +my ($tblout,$domtblout); +die("Missing --tblout\n") unless $cmd =~ / \-\-?tblout\s+(\S+)/; +$tblout = $1; +die("Missing --domtblout\n") unless $cmd =~ / \-\-?domtblout\s+(\S+)/; +$domtblout = $1; +my $output = `$cmd 2>&1`; +die("HMMer failure: $output\n") unless $? == 0; +reformat($tblout); +reformat($domtblout); +exit; + +sub reformat +{ + my $infile = shift; + my $outfile = "$infile.new"; + open(IN, "<$infile") or die($!); + open(OUT, ">$outfile") or die($!); + print OUT "#target name\taccession\tquery name\taccession\tE-value (full)\tscore (full)\tbias (full)\tE-value (best)\tscore (best)\tbias (best)\texp\treg\tclu\tov\tenv\tdom\trep\tinc\tdescription of target\n"; + while (<IN>) + { + next if /^#/; + my @row0 = split(/\s+/); + my @row = @row0[0..17]; + push @row, join(' ', @row0[18..$#row0]); + print OUT join("\t", @row), "\n"; + } + close(IN); + close(OUT); + move($outfile,$infile); +} + +__END__