From: Scott C. <sco...@us...> - 2006-12-20 15:48:37
|
Update of /cvsroot/gmod/schema/chado/lib/Bio/GMOD/DB In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv28210/lib/Bio/GMOD/DB Modified Files: Adapter.pm Log Message: adding the ability to use the feature_property cv that comes with chado and squashing a bug that caused loads to fail if --recreate is specified on the command line and the cache table doesn't already exist. Index: Adapter.pm =================================================================== RCS file: /cvsroot/gmod/schema/chado/lib/Bio/GMOD/DB/Adapter.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Adapter.pm 15 Dec 2006 22:59:48 -0000 1.38 --- Adapter.pm 20 Dec 2006 15:48:31 -0000 1.39 *************** *** 194,197 **** --- 194,198 ---- $self->unique_target( $arg{unique_target} ); $self->dbxref( $arg{dbxref} ); + $self->fp_cv( $arg{fp_cv} ); $self->{const}{source_success} = 1; #flag to indicate GFF_source is in db table *************** *** 873,876 **** --- 874,910 ---- } + =head2 fp_cv + + =over + + =item Usage + + $obj->fp_cv() #get existing value + $obj->fp_cv($newval) #set new value + + =item Function + + Gets/sets the name of the feature property cv + + =item Returns + + value of fp_cv (a scalar) + + =item Arguments + + new value of fp_cv (to set) + + =back + + =cut + + sub fp_cv { + my $self = shift; + my $fp_cv = shift if defined(@_); + return $self->{'fp_cv'} = $fp_cv if defined($fp_cv); + return $self->{'fp_cv'}; + } + + =head2 recreate_cache *************** *** 979,983 **** if (!$table_exists || $self->recreate_cache() ) { print STDERR "(Re)creating the uniquename cache in the database... "; ! $dbh->do(DROP_CACHE_TABLE) if $self->recreate_cache(); print STDERR "\nCreating table...\n"; --- 1013,1017 ---- if (!$table_exists || $self->recreate_cache() ) { print STDERR "(Re)creating the uniquename cache in the database... "; ! $dbh->do(DROP_CACHE_TABLE) if ($self->recreate_cache() and $table_exists); print STDERR "\nCreating table...\n"; *************** *** 2763,2774 **** unless ($self->{const}{auto_cv_id}){ ! my $sth = $self->dbh->prepare("SELECT cv_id FROM cv WHERE name='autocreated'"); $sth->execute; ($self->{const}{auto_cv_id}) = $sth->fetchrow_array; } unless ( $self->cache('type',$tag) ) { ! $self->{queries}{search_cvterm_id}->execute($tag, $self->{const}{auto_cv_id}); my ($tag_cvterm) = $self->{queries}{search_cvterm_id}->fetchrow_array; if ($tag_cvterm) { #good, the term is already there $self->cache('type',$tag,$tag_cvterm); --- 2797,2827 ---- unless ($self->{const}{auto_cv_id}){ ! my $sth = $self->dbh->prepare("SELECT cv_id FROM cv WHERE name='autocreated' or name='". $self->fp_cv ."'"); $sth->execute; ($self->{const}{auto_cv_id}) = $sth->fetchrow_array; } + if (!$self->{const}{tried_fp_cv} and !$self->{const}{fp_cv_id}) { + my $sth = $self->dbh->prepare("SELECT cv_id FROM cv WHERE name='". $self->fp_cv ."'"); + $sth->execute; + ($self->{const}{fp_cv_id}) = $sth->fetchrow_array; + $self->{const}{tried_fp_cv} = 1; + } + unless ( $self->cache('type',$tag) ) { ! #check fp cv first, then autocreated ! $self->{queries}{search_cvterm_id}->execute( ! $tag, ! $self->{const}{fp_cv_id}) ! if $self->{const}{fp_cv_id}; my ($tag_cvterm) = $self->{queries}{search_cvterm_id}->fetchrow_array; + + unless ($tag_cvterm) { + $self->{queries}{search_cvterm_id}->execute( + $tag, + $self->{const}{auto_cv_id}); + ($tag_cvterm) = $self->{queries}{search_cvterm_id}->fetchrow_array; + } + if ($tag_cvterm) { #good, the term is already there $self->cache('type',$tag,$tag_cvterm); |