1 package Index::FastaCMD;
7 Index::FastaCMD - module to use the fastacmd program to read BLAST formatted databases
11 This module was written as a replacement for Index::EMBOSS as EMBOSS needed to be statically linked to libgd, whcih wasn't a very sysadmin-friendly way of installing the software. As BLAST is pretty ubiquitous the fastacmd was deemed to be a better option. Copied heavily from Index::EMBOSS.
21 Added 'use Path' module to ensure that the correct fastacmd binary is used. Previously on the cluster the wrong fastacmd was used, which resulted in a failure. Now is more robust although the path to fastacmd is hardcoded in Paths.pm
25 Chris Cole <christian@cole.name>
35 use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG);
41 use Paths qw($fastacmd);
44 my ($self, $key, $db) = @_;
46 my $appName = $fastacmd;
48 croak "No sequence code given for get_sequence" unless $key;
49 croak "No database given for get_sequence" unless $db;
51 my @cmd = split / /, "$appName -s $key -d $db";
53 my $pid = open3(undef, \*RD, \*ERR, @cmd);
55 my $seq = FASTA::File->new(read => \*RD);
64 # Everything was okay...
65 if (WIFEXITED($?) and not WEXITSTATUS($?)) { return $seq }
67 elsif (WIFEXITED($?) and WEXITSTATUS($?)) {
68 carp "Command: '@cmd' had a problem: $?; $!";
71 # Was it stopped by an external program
72 elsif (WIFSIGNALED($?)) {
73 carp "$appName halted by external signal ".WTERMSIG($?)
76 carp "$appName suffered from a random pantwetting event"