[Bio] / FigMetagenomeTools / blast Repository:
ViewVC logotype

View of /FigMetagenomeTools/blast

Parent Directory Parent Directory | Revision Log Revision Log

Revision - (download) (annotate) (vendor branch)
Mon Feb 19 17:15:26 2007 UTC (13 years, 1 month ago) by olson
Branch: x, MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_rel_2008_0806, mgrast_dev_10262011, mgrast_dev_02212011, mgrast_rel_2008_0923, mgrast_release_3_0, mgrast_dev_03252011, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, mgrast_rel_2008_0919, mgrast_rel_2008_1110, myrast_33, mgrast_rel_2008_0917, mgrast_dev_04052011, mgrast_dev_02222011, y, HEAD
Changes since 1.1: +0 -0 lines
Initial import

#!/usr/bin/perl -w

# another blast script

my $usage = "blast [-n,p,x,tn,s,tx] [-0] database file [blast options]
	-n	blastn		nt query, nt database
	-p	blastp		protein query, protein database
	-x	blastx		nt query, protein database
	-tn	tblastn		protein query, nt database
	-s	psitblastn	protein query, nt database psi-blast
	-tx	tblastx		nt query, nt database
	-0	skip responses that don't match anything

my $program=shift || die $usage;
my $skipzero=0; 
if ($program eq "-n") {$program="blastn"}
elsif ($program eq "-p") {$program="blastp"}
elsif ($program eq "-x") {$program="blastx"}
elsif ($program eq "-tn") {$program="tblastn"}
elsif ($program eq "-s") {$program="psitblastn"}
elsif ($program eq "-tx") {$program="tblastx"}
else {die $usage}

my $database=shift || die $usage;
if ($database eq "-0") {
 $database=shift || die $usage;

my $file=shift || die $usage;
my $options=join (" ", @ARGV);

#unless (-e $file && -e "/clusterfs/home/rob/bin/blastalldir/data/$database") {die "$file or /clusterfs/home/rob/bin/blastalldir/data/$database doesn't exist"}

my %output; my %input;
if (-d $file) {
 # $file is a directory
 my $outputdir="$file.$program.$database";

 my $count;
 while (-e "$outputdir") {$count++; $outputdir="$file.$program.$database.$count"}
 mkdir "$outputdir", 0755;
 opendir(DIR, $file) || die "Can't read $file";
 while (my $f  =readdir(DIR)) {
  next if ($f =~ /^\./);
  push (@input, "$file/$f");
elsif (-T $file) {
 ## need to call separate databases
 push (@input, $file);

foreach my $f (@input) {
 my @results=`blastall -p $program -d /clusterfs/data/$database -i $f $options`;
 my @none=grep /No hits found/, @results;
 if ($none[0] && $skipzero) {
  print STDERR "$f skipped. No hits found\n";
 open (OUT, ">$output{$f}") || die "Can't open $output{$f} for writing\n";
 print OUT @results;
 close OUT;

print STDERR "Done in ", time-$^T, " seconds\n";


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3