Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting replace_plots.pl to get plot id #4774

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions bin/replace_plots.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ =head1 DESCRIPTION

The infile provided has three columns:

1) the stock_id of the plot that needs to be changed.
1) the plot name that needs to be changed.
2) the stock uniquename as it is in the database that is currently associated
3) the new stock uniquename (needs to be in the database).
4) optional: a new plot name
Expand Down Expand Up @@ -51,6 +51,7 @@ =head1 AUTHOR
use Bio::Chado::Schema;
use CXGN::DB::InsertDBH;
use Try::Tiny;
use SGN::Model::Cvterm;

our ($opt_H, $opt_D, $opt_i, $opt_t);

Expand Down Expand Up @@ -94,13 +95,16 @@ =head1 AUTHOR
for my $row ( 0 .. $row_max ) {

my $plot_name = $worksheet->get_cell($row, 0)->value();
my $plot_id = $worksheet->get_cell($row, 1)->value();
my $db_uniquename = $worksheet->get_cell($row,2)->value();
my $new_uniquename = $worksheet->get_cell($row,3)->value();
my $plot_cvterm_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'plot', 'stock_type')->cvterm_id();
my $plot_id = $schema->resultset('Stock::Stock')->find({uniquename=>$plot_name, type_id=>$plot_cvterm_id})->stock_id();

# my $plot_id = $worksheet->get_cell($row, 1)->value();
my $db_uniquename = $worksheet->get_cell($row,1)->value();
my $new_uniquename = $worksheet->get_cell($row,2)->value();

my $new_plotname = "";
eval {
$new_plotname = $worksheet->get_cell($row, 4)->value();
$new_plotname = $worksheet->get_cell($row, 3)->value();
};

if ($@) {
Expand Down
Loading