Repository 'hmmer'
hg clone https://toolshed.g2.bx.psu.edu/repos/edward-kirton/hmmer

Changeset 3:c0fb858f44a2 (2012-09-11)
Previous changeset 2:376092ae10ed (2012-08-30)
Commit message:
fix domtblout hdr
modified:
hmmer_wrapper.pl
b
diff -r 376092ae10ed -r c0fb858f44a2 hmmer_wrapper.pl
--- 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__