From f88c96ae83875a87603aa79d333a2ab2738e5adb Mon Sep 17 00:00:00 2001 From: Graham McVicker <mcvicker@sanger.ac.uk> Date: Fri, 9 Jan 2004 14:15:14 +0000 Subject: [PATCH] out of date --- scripts/make_db_flatfiles | 177 -------------------------------------- 1 file changed, 177 deletions(-) delete mode 100755 scripts/make_db_flatfiles diff --git a/scripts/make_db_flatfiles b/scripts/make_db_flatfiles deleted file mode 100755 index 6891200d01..0000000000 --- a/scripts/make_db_flatfiles +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/local/bin/perl - -BEGIN { - unshift(@INC,"../ensembl/modules"); - unshift(@INC,"../bioperl-live"); -} - -use Bio::EnsEMBL::DBLoader; -use Bio::EnsEMBL::DBSQL::Obj; -use Bio::EnsEMBL::EMBL_Dump; -use strict; -use Bio::EnsEMBL::Utils::Eprof qw( eprof_start eprof_end eprof_dump); - - - - -my $dbuser = 'ensro'; -my $dbname = 'ensembl080'; -#my $host = 'obi-wan'; -#my $host = 'cgisrv4'; -my $host = 'ensrv1'; -my $dbpass = undef; - -sub get_locator { - return "Bio::EnsEMBL::DBSQL::Obj/host=$host;dbname=$dbname;user=$dbuser;pass=$dbpass"; -} - -$|=1; - -my $outpath = '/mysql/dumps/'; -my @clones = (); -my @contigs; -my $db; -my $count = 0; - -eval { - my $locator = get_locator(); - $db = Bio::EnsEMBL::DBLoader->new($locator); -}; - -if( $@ ) { - print STDERR "Apologies. An exception occured: $@\n"; - exit; -} - - -@clones = &find_clones($db); - - - - - -if ($ARGV[1] =~ /start=(.*)/){ - while ($clones[0] ne $1){ - shift(@clones); - } -} - -for (0..7){ shift @clones;} - -my $num = scalar @clones; -print STDERR "Writing flat files for $num clones...\n"; - -die "No clones!\n" unless (@clones); - - - -my $emblout; -my ($clone,$as); - -HOP: foreach my $c (@clones){ - $count++; - - - -#&eprof_dump(\*STDERR); - - eval{ - $clone = $db->get_Clone($c); - $as = $clone->virtualcontig; - }; - - if ($@){ - print STDERR "Exception in embldump for $c!: $@\n"; - next; - } - - eval{ - &eprof_start('make_db_flatfiles - genbank'); - my $filename = "$outpath/genbank/$c.genbank"; - print STDERR "Creating genbank dump file $count: $filename...\n"; - open (FLAT, ">$filename") or die "Cannot create flat file ($filename): $!\n"; - - &eprof_start('make_db_flatfiles - add_comments'); - &Bio::EnsEMBL::EMBL_Dump::add_ensembl_comments($as); - &eprof_end('make_db_flatfiles - add_comments'); - - &eprof_start('make_db_flatfiles - bio_seq'); - my $gbout = Bio::SeqIO->new( '-format' => 'GenBank', -fh => \*FLAT); - &eprof_end('make_db_flatfiles - bio_seq'); - - &eprof_start('make_db_flatfiles - ensembl_dump'); - &Bio::EnsEMBL::EMBL_Dump::ensembl_annseq_output($gbout); - &eprof_end('make_db_flatfiles - ensembl_dump'); - - # genbank format - the ID line is wrong. Fall back to locus - #$gbout->_id_generation_func(undef); - #$gbout->_ac_generation_func(undef); - #$as->accession($clone->id()); - #$as->division("PRI"); - - &eprof_start('make_db_flatfiles - write_seq'); - - $gbout->write_seq($as); - &eprof_end('make_db_flatfiles - write_seq'); - - - close(FLAT); - - &eprof_end('make_db_flatfiles - genbank'); - - my $filename = "$outpath/embl/$c.embl"; - print STDERR "Creating embldump file $count: $filename...\n"; - open (FLAT, ">$filename") or die "Cannot create flat file ($filename): $!\n"; - my $emblout = Bio::SeqIO->new( '-format' => 'EMBL', -fh => \*FLAT); - &Bio::EnsEMBL::EMBL_Dump::ensembl_annseq_output($emblout); - $emblout->write_seq($as); - - close(FLAT); - }; - - if ($@){ - print STDERR "Exception in embldump for $c!: $@\n"; - next; - } -} - -1; - -############################################################################ - -sub find_clones { - - my ($db) = @_; - my @clones; - my $sql = ""; - - if ($ARGV[0] eq 'all'){ - $sql = "select id from clone"; - } - elsif ($ARGV[0] =~ /clone=(.*)/){ - $sql = "select id from clone where id= '$1'"; - } - else{ - $sql = "select id from clone where stored>'2000-05-04 17:22:05'"; - } - - my $sth = $db->prepare("$sql"); - my $rv = $sth->execute(); - - while (my $row = $sth->fetchrow) { - push (@clones,$row); - } - - return @clones; -} - -############################################################################ - - - - - - - - - -- GitLab