comparison hmmer_wrapper.pl @ 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
comparison
equal deleted inserted replaced
2:376092ae10ed 3:c0fb858f44a2
10 $tblout = $1; 10 $tblout = $1;
11 die("Missing --domtblout\n") unless $cmd =~ / \-\-?domtblout\s+(\S+)/; 11 die("Missing --domtblout\n") unless $cmd =~ / \-\-?domtblout\s+(\S+)/;
12 $domtblout = $1; 12 $domtblout = $1;
13 my $output = `$cmd 2>&1`; 13 my $output = `$cmd 2>&1`;
14 die("HMMer failure: $output\n") unless $? == 0; 14 die("HMMer failure: $output\n") unless $? == 0;
15 reformat($tblout); 15 reformat_tblout($tblout);
16 reformat($domtblout); 16 reformat_domtblout($domtblout);
17 exit; 17 exit;
18 18
19 sub reformat 19 sub reformat_tblout
20 { 20 {
21 my $infile = shift; 21 my $infile = shift;
22 my $outfile = "$infile.new"; 22 my $outfile = "$infile.new";
23 open(IN, "<$infile") or die($!); 23 open(IN, "<$infile") or die($!);
24 open(OUT, ">$outfile") or die($!); 24 open(OUT, ">$outfile") or die($!);
34 close(IN); 34 close(IN);
35 close(OUT); 35 close(OUT);
36 move($outfile,$infile); 36 move($outfile,$infile);
37 } 37 }
38 38
39 sub reformat_domtblout
40 {
41 my $infile = shift;
42 my $outfile = "$infile.new";
43 open(IN, "<$infile") or die($!);
44 open(OUT, ">$outfile") or die($!);
45 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";
46 while (<IN>)
47 {
48 next if /^#/;
49 my @row0 = split(/\s+/);
50 my @row = @row0[0..21];
51 push @row, join(' ', @row0[22..$#row0]);
52 print OUT join("\t", @row), "\n";
53 }
54 close(IN);
55 close(OUT);
56 move($outfile,$infile);
57 }
39 __END__ 58 __END__