File: make_partial_indexes.pl

package info (click to toggle)
libchado-perl 1.22-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 24,024 kB
  • sloc: xml: 192,540; sql: 165,936; perl: 28,298; sh: 101; python: 73; makefile: 46
file content (21 lines) | stat: -rwxr-xr-x 550 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl -w
use strict;

use DBI;

my $dbh = DBI->connect("dbi:Pg:dbname=gadfly",'','');

my $type = 'chromosome_arm';

my $sth = $dbh->prepare("select feature_id from feature f, cvterm cv
                        where cv.name = ? and cv.cvterm_id=f.type_id");
$sth->execute($type);

while (my $ida = $sth->fetchrow_arrayref) {
  my $id = $$ida[0];
  warn "creating partial index on srcfeature_id $id ...\n";
  $dbh->do("create index featureloc_src_$id on featureloc (fmin,fmax)
            where srcfeature_id = $id");  
}

$dbh->disconnect;