[Bio] / FigKernelScripts / build_contigs_blastdb.pl Repository:
ViewVC logotype

View of /FigKernelScripts/build_contigs_blastdb.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Fri Mar 11 18:46:48 2016 UTC (3 years, 8 months ago) by olson
Branch: MAIN
New blastdb builders.

# Build a BLAST database of all contigs in this seed.

use strict;
use FIG;
use gjoseqlib;

use Getopt::Long::Descriptive;

my($opt, $usage) = describe_options("%c %o blastdb-file",
				    ["help|h" => "Show this help message"]);

print($usage->text), exit if $opt->help;
die($usage->text) if @ARGV != 1;

my $db_file = shift;

open(DB, ">", $db_file) or die "Cannot write $db_file: $!";

my $fig = new FIG;
for my $g ($fig->genomes)
    my $gs = $fig->genus_species($g);
    my $ctgs = $fig->organism_directory($g) . "/contigs";
    open(my $fh, "<", $ctgs) or die "Cannot read $ctgs: $!";
    while (my($id, $def, $seq) = read_next_fasta_seq($fh))
	print_seq_as_fasta(\*DB, "$g:$id", $gs, $seq);
my @cmd = ("makeblastdb", "-in", $db_file, "-dbtype", "nucl");
print STDERR "@cmd\n";
my $rc = system(@cmd);
$rc == 0 or die "Error $rc from @cmd\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3