changeset 3:c0fb858f44a2 draft default tip

fix domtblout hdr
author Edward Kirton <eskirton@lbl.gov>
date Tue, 11 Sep 2012 00:40:34 -0700
parents 376092ae10ed
children
files hmmer_wrapper.pl
diffstat 1 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hmmer_wrapper.pl	Thu Aug 30 11:58:27 2012 -0700
+++ b/hmmer_wrapper.pl	Tue Sep 11 00:40:34 2012 -0700
@@ -12,11 +12,11 @@
 $domtblout = $1;
 my $output = `$cmd 2>&1`;
 die("HMMer failure: $output\n") unless $? == 0;
-reformat($tblout);
-reformat($domtblout);
+reformat_tblout($tblout);
+reformat_domtblout($domtblout);
 exit;
 
-sub reformat
+sub reformat_tblout
 {
     my $infile = shift;
     my $outfile = "$infile.new";
@@ -36,4 +36,23 @@
     move($outfile,$infile);
 }
 
+sub reformat_domtblout
+{
+    my $infile = shift;
+    my $outfile = "$infile.new";
+    open(IN, "<$infile") or die($!);
+    open(OUT, ">$outfile") or die($!);
+    print OUT "#target name\taccession\ttlen\tquery name\taccession\tqlen\tE-value (full)\tscore (full)\tbias (full)\t# (this)\tof (this)\tc-Evalue (this)\ti-Evalue (this)\tscore (this)\tbias (this)\tfrom (hmm)\tto (hmm)\tfrom (ali)\tto (ali)\tfrom (env)\tto (env)\tacc\tdescription of target\n";
+    while (<IN>)
+    {
+        next if /^#/;
+        my @row0 = split(/\s+/);
+        my @row = @row0[0..21];
+        push @row, join(' ', @row0[22..$#row0]);
+        print OUT join("\t", @row), "\n";
+    }
+    close(IN);
+    close(OUT);
+    move($outfile,$infile);
+}
 __END__