5 use Bio
::Chado
::Schema
;
7 use CXGN
::DB
::InsertDBH
;
8 use SGN
::Model
::Cvterm
;
19 my $dbh = CXGN
::DB
::InsertDBH
->new( { dbhost
=>"$dbhost",
21 dbargs
=> {AutoCommit
=> 1,
28 my $schema= Bio
::Chado
::Schema
->connect( sub { $dbh->get_actual_dbh() });
30 my $formula_cvterm = $schema->resultset("Cv::Cvterm")->create_with({
32 cv
=> "cvterm_property",
35 my $type_id = $formula_cvterm->cvterm_id();
37 open (my $file_fh, "<", $file ) || die ("\nERROR: the file $file could not be found\n" );
39 my $header = <$file_fh>;
40 while (my $line = <$file_fh>) {
43 my ($my_trait,$my_formula) = split("\t", $line);
44 push @traits, $my_trait;
45 push @formulas, $my_formula;
48 for (my $n=0; $n<scalar(@traits); $n++) {
49 print STDERR
$traits[$n]."\n";
50 my $trait_cvterm = SGN
::Model
::Cvterm
->get_cvterm_row_from_trait_name($schema, $traits[$n]);
52 print STDERR
"The trait $traits[$n] is not in the database. Skipping...\n";
56 my $cvterm_id = $trait_cvterm->cvterm_id();
57 my $new_prop= $trait_cvterm->create_cvtermprops({formula
=>$formulas[$n]} , {} );