Mercurial > repos > edward-kirton > hmmer
comparison hmmpress_wrapper.pl @ 0:c16d8db9338a
init repo
author | eskirton@lbl.gov |
---|---|
date | Mon, 05 Mar 2012 22:43:09 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c16d8db9338a |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 use warnings; | |
4 use strict; | |
5 | |
6 die("Infile, outfile, outdir required\n") unless @ARGV == 3; | |
7 my ($infile, $outfile, $outdir)=@ARGV; | |
8 | |
9 # setup | |
10 -d $outdir or mkdir($outdir) or die($!); | |
11 symlink($infile,"$outdir/hmm"); | |
12 | |
13 # create output header file | |
14 open(IN, "<$infile") or die($!); | |
15 open(OUT, ">$outfile") or die($!); | |
16 my $ok=0; | |
17 while (my $line=<IN>) { | |
18 if (!$ok) { | |
19 die("Invalid input file (HMMER3 format required)\n") unless $line =~ /^HMMER3/; | |
20 $ok=1; | |
21 } elsif ($line =~ /^HMM/) { | |
22 last; | |
23 } else { | |
24 print OUT $line; | |
25 } | |
26 } | |
27 close IN; | |
28 close OUT; | |
29 | |
30 # hmmpress | |
31 my $output=`hmmpress $outdir/hmm 2>&1`; | |
32 if ($? != 0) { | |
33 $output="FAILED\n" unless $output; | |
34 die($output); | |
35 } | |
36 unlink("$outdir/hmm"); | |
37 my @output=split(/\n/, $output); | |
38 print $output[1], "\n"; | |
39 exit; |