3 load_locus_publications.pl - a script to associate publications (pubmed IDs) with locus
7 load_locus_publications.pl -p [person_id] -H [hostname] -D [database name] file
9 where file contains a column with locus names and a column with associated pubmed_ids.
13 Lukas Mueller <lam87@cornell.edu>
21 use File
::Slurp qw
| slurp
|;
22 use CXGN
::DB
::InsertDBH
;
23 use CXGN
::Phenome
::Locus
;
24 use CXGN
::Chado
::Dbxref
;
27 getopts
('p:H:D:', \
%opts);
31 my @lines = slurp
($file);
34 my $dbh = CXGN
::DB
::InsertDBH
->new( { dbname
=> $opts{D
},
40 foreach my $l (@lines) {
41 my ($locus_name, $pubmed_id) = split /\t/, $l;
42 my $sth = $dbh->prepare("SELECT locus_id FROM phenome.locus WHERE locus_name = ?");
43 $sth->execute($locus_name);
44 my ($locus_id) = $sth->fetchrow_array();
45 my $locus = CXGN
::Phenome
::Locus
->new($dbh, $locus_id);
47 my $pub = CXGN
::Chado
::Publication
->get_pub_by_accession($dbh, $pubmed_id);
49 my ($dbxref, @more_dbxrefs) = $pub->get_dbxrefs();
50 print STDERR
"Adding dbxref ".($dbxref->get_dbxref_id())."...\n";
51 my $dbxref = CXGN
::Chado
::Dbxref
->new($dbh, $dbxref->get_dbxref_id);
53 $locus->add_locus_dbxref($dbxref, undef, $opts{p
});