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
12 linked to libgd, whcih was is a very sysadmin-friendly way of installing the software.
13 As BLAST is pretty ubiquitous the fastacmd was deemed to be a better option. Copied heavily
24 Added 'use Path' module to ensure that the correct fastacmd binary is used. Previously on the
25 cluster the wrong fastacmd was used, which resulted in a failure. Now is more robust although
26 the path to fastacmd is hardcoded in Paths.pm
30 Chris Cole <christian@cole.name>
38 use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG);
44 use Paths qw($fastacmd);
47 my ( $self, $key, $db ) = @_;
49 croak "No sequence code given for get_sequence" unless $key;
50 croak "No database given for get_sequence" unless $db;
52 my @cmd = split / /, "$fastacmd -s $key -d $db";
54 my $pid = open3( undef, \*RD, \*ERR, @cmd );
56 my $seq = FASTA::File->new( read => \*RD );
66 # Everything was okay...
67 if ( WIFEXITED($?) and not WEXITSTATUS($?) ) { return $seq }
70 elsif ( WIFEXITED($?) and WEXITSTATUS($?) ) {
71 carp "Command: '@cmd' had a problem: $?; $!";
75 # Was it stopped by an external program
76 elsif ( WIFSIGNALED($?) ) {
77 carp "$fastacmd halted by external signal " . WTERMSIG($?);
79 carp "$fastacmd suffered from a random pantwetting event";