Mercurial > repos > edward-kirton > hmmer
view hmmer_wrapper.pl @ 2:376092ae10ed draft
reformat output to tabular
author | Edward Kirton <eskirton@lbl.gov> |
---|---|
date | Thu, 30 Aug 2012 11:58:27 -0700 |
parents | |
children | c0fb858f44a2 |
line wrap: on
line source
#!/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__