|
From: <all...@su...> - 2006-02-17 02:15:50
|
Update of /cvsroot/libnelson/Pg/celsius/bin In directory sumo.genetics.ucla.edu:/tmp/cvs-serv8931/bin Modified Files: gecIDsync Log Message: now loads annotations to annot.allenday_gec Index: gecIDsync =================================================================== RCS file: /cvsroot/libnelson/Pg/celsius/bin/gecIDsync,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gecIDsync 31 Jan 2006 01:14:42 -0000 1.1 --- gecIDsync 17 Feb 2006 02:15:47 -0000 1.2 *************** *** 9,13 **** my $dbh = DBI->connect('dbi:Pg:dbname=chado-celsius;host=soleus.ctrl.ucla.edu','',''); ! $dbh->do('SET search_path TO cel, public'); my $select1_sth = $dbh->prepare('SELECT cel_id FROM cel_dbxref, dbxref WHERE cel_dbxref.dbxref_id = dbxref.dbxref_id AND dbxref.accession LIKE ?'); --- 9,13 ---- my $dbh = DBI->connect('dbi:Pg:dbname=chado-celsius;host=soleus.ctrl.ucla.edu','',''); ! $dbh->do('SET search_path TO cel, annot, public'); my $select1_sth = $dbh->prepare('SELECT cel_id FROM cel_dbxref, dbxref WHERE cel_dbxref.dbxref_id = dbxref.dbxref_id AND dbxref.accession LIKE ?'); *************** *** 16,19 **** --- 16,20 ---- my $insert1_sth = $dbh->prepare('INSERT INTO dbxref (db_id, accession) VALUES ((SELECT db_id FROM db WHERE name = ?),?)'); my $insert2_sth = $dbh->prepare('INSERT INTO cel_dbxref (cel_id, dbxref_id) VALUES (?,?)'); + my $insert3_sth = $dbh->prepare('INSERT INTO annot.allenday_gec (biomaterial_id, type_id) VALUES (?,(SELECT c.cvterm_id FROM cvterm AS c, dbxref AS x, db AS d WHERE c.dbxref_id = x.dbxref_id AND x.db_id = d.db_id AND x.accession = ? AND d.name = ?))'); my @files = $dom->getElementsByTagName('file'); *************** *** 41,44 **** --- 42,52 ---- ( $x ) = $select2_sth->fetchrow_array(); $insert2_sth->execute( $c, $x ); + + my @annots = $file->getElementsByTagName('annotation'); + foreach my $annot ( @annots ) { + my $accession = $annot->getAttribute( 'accession' ); + my ( $db, $acc ) = $accession =~ m/^(.+?):(.+?)$/; + $insert3_sth->execute( $c, $acc, $db ); + } } |