# HG changeset patch # User Edward Kirton # Date 1346353107 25200 # Node ID 376092ae10ed9fbceeeb001becf2172b629f331d # Parent 66f8262e1686d258e9e575bc0896a1471a3cd273 reformat output to tabular diff -r 66f8262e1686 -r 376092ae10ed hmmer.xml --- 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 @@ hmmscan/search seqs vs profiles - + + hmmer + + +hmmer_wrapper.pl $program -##--cpu 8 +--cpu 8 --tblout $tblout --domtblout $domtblout $acc @@ -126,10 +130,6 @@ - - hmmscan - hmmsearch - diff -r 66f8262e1686 -r 376092ae10ed hmmer_wrapper.pl --- /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 () + { + 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__