From: Arnaud K. <ax...@sa...> - 2003-02-24 16:51:18
|
Pjm wrote: > Steve, Jonathan, > > when doing a `ga +create GUS::Common::Plugin::LoadPfam --commit` > it complained because my plugin did not match anything from > AlgorithmParamKeyType table. This was because it ws empty. I think I deleted them, sorry!! Can anyone confirm that they are generated during the build process ? Arnaud > > Finding this in the code; > > $RV = { 'str' => 0, > 'flo' => 1, > 'int' => 2, > 'ref' => 3, > 'boo' => 4, > > I did this; > > insert into AlgorithmParamKeyType > VALUES (0, 'string',sysdate, 1,1,1,1,1,1,1,1,1,1); > insert into AlgorithmParamKeyType > VALUES (1, 'float',sysdate, 1,1,1,1,1,1,1,1,1,1); > insert into AlgorithmParamKeyType > VALUES (2, 'integer',sysdate, 1,1,1,1,1,1,1,1,1,1); > insert into AlgorithmParamKeyType > VALUES (3, 'ref',sysdate, 1,1,1,1,1,1,1,1,1,1); > insert into AlgorithmParamKeyType > VALUES (4, 'boolean',sysdate, 1,1,1,1,1,1,1,1,1,1); > > After doing this I found the original string in ImportPfam describing > the flat file argument was too big! AlgorithmParamKey.DESCRIPTION > > h => ("Flat file containing the release of Pfam to load. Expects\n" . > "\t\t\tthe file containing the annotation and full alignments in > Pfam\n" . > "\t\t\tformat of all Pfam-A families (called \"Pfam-A.full\" in > release 5.2)\n" . > "\t\t\tThe specified file may be in gzip (.gz) or compressed > (.Z) format."), > > This string is 280 characters! Does anyone mind if I change the length > to 512 and do a cvs commit? > > > Also, could you pass this on to debbie please, although she may > already know? > > make step 2 of the conversion guide to include; > > "@ISA = qw(GUS::PluginMgr::Plugin); #defines what is inherited" > > > Paul. > > > steve fischer wrote: > >> yes, gus 3.0. >> >> can we set a time for tuesday? i think an hour will more than do it. >> we are 5 hours behind you. i get in around 10:30. >> >> meanwhile, i have attached debbie's notes on how to convert a plugin, >> and a canonical plugin so you can get a start. >> >> steve >> >> pjm wrote: >> >>> steve fischer wrote: >>> >>> >>>> paul- >>>> >>>> finally got the GUS grant out the door. >>>> >>>> still waiting for James Cuff to move the gus cvs to sanger. i sent it >>>> to him more than a week ago. i just reminded him again today. >>>> >>>> so, early next week will be a good time to go over the plugin stuff. >>>> >>>> i have a meeting monday morning, so maybe tuesday? >>>> >>>> steve >>>> >>> >>> >>> >>> Tuesday will be good. I have a couple of smaller jobs to do but we >>> are all keen >>> to get hacking, err, writing code for GUS30! >>> >>> I take it you mean you sent a GUS30 tar ball to James? >>> >>> >>> >>> >> >> >> ------------------------------------------------------------------------ >> >> 1) Give the package name a complete path e.g.package >> DoTS::DotsBuild::Plugin::ExtractAndBlockAssemblySequences; >> >> 2) Give all of our 'use' objects full paths >> e.g.use GUS::Model::DoTS::AssemblySequence; >> use CBIL::Bio::SequenceUtils; >> >> 3) Change 'sub new' >> a. Copy new from template: >> >> sub new { >> my $Class = shift; >> my $self = {}; >> bless($self,$class); >> my $usage = 'Extract unprocessed AssembySequences........'; >> my $easycsp = >> [ >> {o => 'testnumber', >> t => 'int', >> h => 'number of iterations for testing', >> }]; >> $self->initialize({requiredDbVersion => {}, >> cvsRevision => '$Revision: 1.6 $', # cvs fills this in! >> cvsTag => '$Name: $', # cvs fills this in! >> name => ref($m), >> revisionNotes => 'make consistent with GUS 3.0', >> easyCspOptions => $easycsp, >> usage => $usage >> }); >> return $self; >> } >> b. Replace usage string with string in original usage sub, delete >> usage sub >> >> c. replace easycsp hashes with original EasyCspOptions hash, >> delete keys and conform to above model >> >> 4) put $self = shift at beginning of all subs >> 5) call all subs with $self->subname (search for & and replace with >> $self->) >> >> 6) replace $ctx->{cla}-> with $self->getCla >> >> 7) replace $ctx->{'self_inv'}->getQueryHandle with $self->getQueryHandle >> >> 8) use $self->getQueryHandle instead of passing a database handle or >> using a global database handle >> >> 9) avoid use DBI or DbiDatabase >> >> 10) search for 'new' (instantiating new database objects) and add the >> full path for objects e.g. GUS::Model::DoTS::AssemblySequence-> >> new( { 'assembly_sequence_id' => $id } ); >> >> 11) use $self->undefPointerCache instead of newObject->undefPointerCache >> >> 12) substitute 'sub run' for 'sub Run' >> >> >> ------------------------------------------------------------------------ >> >> package GUS::Common::Plugin::UpdateGusFromXML; >> >> @ISA = qw(GUS::PluginMgr::Plugin); >> use strict; >> >> use FileHandle; >> >> # ---------------------------------------------------------------------- >> # create and initalize new plugin instance. >> >> sub new { >> my ($class) = @_; >> >> my $self = {}; >> bless($self, $class); >> >> my $usage = 'update GUS from an XML file. ("// on newline delimits >> submits)'; >> >> my $easycsp = >> [ >> { h => 'if true then will update the row with new modification >> data and algorithmInvocation regardless if has changed from the >> database', >> t => 'boolean', >> o => 'refresh', >> }, >> { h => 'name of file containing XML', >> t => 'string', >> d => '-', >> o => 'filename', >> }, >> ]; >> >> $self->initialize({requiredDbVersion => {}, >> cvsRevision => '$Revision: 1.8 $', # cvs fills this in! >> cvsTag => '$Name: $', # cvs fills this in! >> name => ref($self), >> revisionNotes => 'make consistent with GUS 3.0', >> easyCspOptions => $easycsp, >> usage => $usage >> }); >> >> return $self; >> } >> >> # ---------------------------------------------------------------------- >> # plugin-global variables. >> >> my $countObjs = 0; >> my $countUpdates = 0; >> >> # ---------------------------------------------------------------------- >> # run method to do the work >> >> sub run { >> my $self = shift; >> >> my $RV; >> >> my $fh = FileHandle->new('<'.$self->getCla->{'filename'}); >> if ($fh) { >> >> $self->logAlert('COMMIT', $self->getCla->{commit} ? 'ON' : 'OFF' ); >> >> ##testing exitOnFailure... >> $self->getDb()->setExitOnSQLFailure(0); >> >> # process XML file. >> my @xml; >> while (<$fh>) { >> if (/^\/\/\s*$/) { ##"//" on a newline defines entry >> $self->process(\@xml) if scalar(@xml) > 1; ##must be at least 3 >> actually to be valid... >> undef @xml; ##reset for the new one... >> } else { >> push(@xml,$_); >> } >> } >> $self->process(\@xml) if scalar(@xml) > 1; ##must be at least 3 >> actually to be valid... >> $fh->close; >> >> # create, log, and return result string. >> $RV = join(' ', >> "processed $countObjs objects, inserted", >> $self->getSelfInv->getTotalInserts(), >> 'and updated', >> $self->getSelfInv->getTotalUpdates() || 0, >> ); >> } >> >> # no file. >> else { >> $RV = join(' ', >> 'a valid --filename <filename> must be on the commandline', >> $self->getCla->{filename}, >> $!); >> } >> >> $self->logAlert('RESULT', $RV); >> return $RV; >> } >> >> # ---------------------------------------------------------------------- >> # do the real work. >> sub process { >> my $self = shift; >> my($xml) = @_; >> >> $self->getSelfInv->parseXML($xml); >> $self->countChangedObjs($self->getSelfInv); >> >> ##now submit the sucker... >> ##must first remove invocation parent before submitting immediate >> children >> $self->getSelfInv->manageTransaction(undef,'begin'); >> foreach my $c ($self->getSelfInv->getAllChildren()) { >> $c->removeParent($self->getSelfInv); >> $c->submit(undef,1); >> $c->setParent($self->getSelfInv); ##add back so can see at the end... >> } >> $self->getSelfInv->manageTransaction(undef,'commit'); >> if (!$self->getCla->{commit}) { >> $self->logAlert('ERROR', "XML that was not committed to the >> database\n\n"); >> foreach my $c ($self->getSelfInv->getAllChildren()) { >> $self->logAlert('BAD-XML', $c->toXML()); >> } >> } >> $self->getSelfInv->removeAllChildren(); >> $self->getSelfInv->undefPointerCache(); >> } >> >> sub countChangedObjs { >> my $self = shift; >> my($par) = @_; >> >> foreach my $c ($par->getAllChildren()) { >> $self->logAlert('DEBUG', >> "Checking to see if has changed attributes\n".$c->toXML()) if >> $self->getCla->{debug}; >> $countObjs++; >> $countUpdates++; >> if (!$self->getCla->{refresh} && !$c->hasChangedAttributes()) { >> $self->logAlert('DEBUG','There are no changed attributes') if >> $self->getCla->{debug}; >> $countUpdates--; >> } >> $self->countChangedObjs($c); >> } >> } >> >> 1; >> > > |