4 load_qtl_loci.pl - load the qtls as loci
8 Loads the QTL markers in a map file as loci into the locus database and attributes them to sp_person_id provided by -p option. It connects the loci to the map location. Note that the map needs to be loaded, using load_map_data.pl, before this script is run.
12 perl load_qtl_loci.pl -H hostname -D dbname -p locus_owner_id -c common_name_id <-t> marker_file
14 Note: with the -t flag, data is not actually stored (test run).
15 The marker file is the same as for map loading (see load_map_data.pl).
19 Lukas Mueller <lam87@cornell.edu>
25 use CXGN
::Phenome
::Locus
;
26 use CXGN
::Phenome
::LocusMarker
;
28 use CXGN
::DB
::InsertDBH
;
32 getopts
('H:D:p:tc:', \
%opts);
34 if (!exists($opts{p
})) {
35 die "need -p parameter (sp_person_id of locus owner)";
38 if (!exists($opts{c
})) {
39 die "need -c parameter (common_name_id)";
45 my $dbh = CXGN
::DB
::InsertDBH
->new({ dbname
=> $opts{D
},
48 open(my $F, "<", $file) || die "Can't open file $file\n";
51 my ($qtl, $chr, $pos, $protocol, $confidence, $description, $pubmed_id) = split /\t/;
54 if ($protocol =~ /QTL/i) {
55 my $l = CXGN
::Phenome
::Locus
->new($dbh);
57 print STDERR
"Setting locus name and symbol ($qtl)...\n";
58 $l->set_locus_name($qtl);
60 if ($symbol =~ /.*\_(.*\d+\_\d+)/) {
64 $l->set_locus_symbol($symbol);
65 $l->set_common_name_id($opts{c
});
66 print STDERR
"Setting description...\n";
67 $l->set_description($description);
68 $l->set_sp_person_id($opts{p
});
70 print STDERR
"Adding publication $pubmed_id...\n";
71 my $sth = $dbh->prepare("SELECT dbxref_id FROM dbxref WHERE accession=?");
72 $sth->execute($pubmed_id);
73 my ($dbxref_id) = $sth->fetchrow_array();
75 print STDERR
"Adding dbxref_id $dbxref_id...\n";
76 my $dbxref = CXGN
::Chado
::Dbxref
->new($dbh, $dbxref_id);
77 $dbxref->set_sp_person_id($opts{p
});
78 $dbxref->set_accession($pubmed_id);
79 $dbxref->set_db_name('PMID');
80 $l->add_locus_dbxref($dbxref) if $dbxref;
85 print STDERR
"Storing...\n";
86 my $locus_id = $l->store();
88 $l->add_owner($opts{p
});
90 my $sth = $dbh -> prepare
("SELECT marker_id FROM sgn.marker_alias WHERE alias =?");
93 my ($marker_id) = $sth->fetchrow_array();
95 if (!$marker_id) { die "Couldn't find a marker for $qtl!"; }
96 print STDERR
"Found marker $marker_id. Associating it...\n";
98 my $lm = CXGN
::Phenome
::LocusMarker
->new($dbh);
99 $lm->set_marker_id($marker_id);
100 $lm->set_locus_id($locus_id);
105 $l->add_locus_marker($lm);
111 print STDERR
"NOT storing (-t in effect!)\n";
118 ###$l->associate_publication($pubmed, $opts{p});
124 print STDERR
"Committing!!!!!\n";
128 print STDERR
"Done. Processed $count qtls\n";