From 3583d1804b8b348f03bf46a1e3eb6be3bba72d59 Mon Sep 17 00:00:00 2001 From: nickmorales Date: Wed, 14 Sep 2016 17:49:49 +0000 Subject: [PATCH] upload fieldbook images test. also test no longer uses simulatec --- .gitignore | 1 + lib/CXGN/Phenotypes/StorePhenotypes.pm | 13 +- lib/SGN/Image.pm | 7 +- sgn_fixture_template.conf | 2 + t/lib/SGN/Test/Fixture.pm | 50 +++++++ t/unit_fixture/CXGN/Uploading/PhenotypeUpload.t | 176 ++++++++++++------------ 6 files changed, 147 insertions(+), 102 deletions(-) diff --git a/.gitignore b/.gitignore index 767dff48b..51056aeed 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ system_message.txt #sgn_local.conf# sgn_local.conf.old export/* +temp_images/* \ No newline at end of file diff --git a/lib/CXGN/Phenotypes/StorePhenotypes.pm b/lib/CXGN/Phenotypes/StorePhenotypes.pm index 1ecb73aa1..821b11273 100644 --- a/lib/CXGN/Phenotypes/StorePhenotypes.pm +++ b/lib/CXGN/Phenotypes/StorePhenotypes.pm @@ -234,10 +234,7 @@ sub store { my $schema = $c->dbic_schema("Bio::Chado::Schema"); my $metadata_schema = $c->dbic_schema("CXGN::Metadata::Schema"); my $phenome_schema = $c->dbic_schema("CXGN::Phenome::Schema"); - my $user_id = $c->user()->get_object()->get_sp_person_id(); - if (!$user_id) { #For unit_test, SimulateC - $user_id = $c->sp_person_id(); - } + my $user_id = $c->can('user_exists') ? $c->user->get_object->get_sp_person_id : $c->sp_person_id; my $archived_file = $phenotype_metadata->{'archived_file'}; my $archived_file_type = $phenotype_metadata->{'archived_file_type'}; my $operator = $phenotype_metadata->{'operator'}; @@ -303,7 +300,7 @@ sub store { $timestamp = 'NA'.$upload_date; } - if ($trait_value || $trait_value eq '0') { + if (defined($trait_value) && length($trait_value)) { #Remove previous phenotype values for a given stock and trait, if $overwrite values is checked if ($overwrite_values) { @@ -413,7 +410,7 @@ sub store { $timestamp = 'NA'; } - if ($trait_value || $trait_value eq '0') { + if (defined($trait_value) && length($trait_value)) { #Remove previous phenotype values for a given stock and trait, if $overwrite values is checked if ($overwrite_values) { @@ -504,12 +501,12 @@ sub store { my %image_plot_full_names; if ($archived_image_zipfile_with_path) { #print STDERR $archived_image_zipfile_with_path."\n"; - + my $dbh = $schema->storage->dbh; my $archived_zip = CXGN::ZipFile->new(archived_zipfile_path=>$archived_image_zipfile_with_path); my $file_members = $archived_zip->file_members(); foreach (@$file_members) { - my $image = SGN::Image->new( $c->dbc->dbh, undef, $c ); + my $image = SGN::Image->new( $dbh, undef, $c ); #print STDERR Dumper $_; my $img_name = substr($_->fileName(), 0, -24); $img_name =~ s/^.*photos\///; diff --git a/lib/SGN/Image.pm b/lib/SGN/Image.pm index b27fb11b2..78f5d1368 100644 --- a/lib/SGN/Image.pm +++ b/lib/SGN/Image.pm @@ -48,6 +48,7 @@ use File::Basename qw/ basename /; use File::Spec; use CXGN::DB::Connection; use CXGN::Tag; +use CXGN::Metadata::Metadbdata; use CatalystX::GlobalContext '$c'; @@ -372,10 +373,10 @@ sub associate_stock { my $self = shift; my $stock_id = shift; if ($stock_id) { - my $user = $self->config->user_exists; - if ($user) { + my $username = $self->config->can('user_exists') ? $self->config->user->get_object->get_username : $self->config->username; + if ($username) { my $metadata_schema = $self->config->dbic_schema('CXGN::Metadata::Schema'); - my $metadata = CXGN::Metadata::Metadbdata->new($metadata_schema, $self->config->user->get_object->get_username); + my $metadata = CXGN::Metadata::Metadbdata->new($metadata_schema, $username); my $metadata_id = $metadata->store()->get_metadata_id(); my $q = "INSERT INTO phenome.stock_image (stock_id, image_id, metadata_id) VALUES (?,?,?) RETURNING stock_image_id"; diff --git a/sgn_fixture_template.conf b/sgn_fixture_template.conf index 7b4d5ab53..50205bae7 100644 --- a/sgn_fixture_template.conf +++ b/sgn_fixture_template.conf @@ -26,6 +26,8 @@ gbs_temp_data /tmp archive_path /tmp/archive_test +static_datasets_path /export/prod/tmp +image_dir /images/image_files production_server 0 diff --git a/t/lib/SGN/Test/Fixture.pm b/t/lib/SGN/Test/Fixture.pm index bdd384250..caee288aa 100644 --- a/t/lib/SGN/Test/Fixture.pm +++ b/t/lib/SGN/Test/Fixture.pm @@ -42,6 +42,8 @@ use Bio::Chado::Schema; use CXGN::Phenome::Schema; use CXGN::Metadata::Schema; use SGN::Schema; +use Catalyst::Authentication::User; +use CXGN::People::Person; use warnings; @@ -73,6 +75,13 @@ sub BUILD { $self->metadata_schema(CXGN::Metadata::Schema->connect($dsn, $self->config->{dbuser}, $self->{config}->{dbpass}, { on_connect_do => [ 'SET search_path TO metadata, public, sgn' ] })); + #Janedoe in fixture db + my $catalyst_user = Catalyst::Authentication::User->new(); + my $sgn_user = CXGN::People::Person->new($self->dbh, 41); + $catalyst_user->set_object($sgn_user); + $self->user($catalyst_user); + $self->sp_person_id(41); + $self->username('janedoe'); } has 'config' => ( isa => "Ref", @@ -100,4 +109,45 @@ has 'metadata_schema' => (isa => 'CXGN::Metadata::Schema', is => 'rw', ); +has 'user' => ( isa => 'Object', + is => 'rw', +); + +has 'sp_person_id' => ( isa => 'Int', + is => 'rw', +); + +has 'username' => ( isa => 'Str', + is => 'rw', +); + +sub dbic_schema { + my $self = shift; + my $name = shift; + + if ($name eq 'Bio::Chado::Schema') { + return $self->bcs_schema(); + } + if ($name eq 'CXGN::Phenome::Schema') { + return $self->phenome_schema(); + } + if ($name eq 'SGN::Schema') { + return $self->sgn_schema(); + } + if ($name eq 'CXGN::Metadata::Schema') { + return $self->metadata_schema(); + } + + return undef; +} + +sub get_conf { + my $self = shift; + my $name = shift; + + return $self->config->{$name}; +} + + + 1; diff --git a/t/unit_fixture/CXGN/Uploading/PhenotypeUpload.t b/t/unit_fixture/CXGN/Uploading/PhenotypeUpload.t index 731fe2acd..562ecc44a 100644 --- a/t/unit_fixture/CXGN/Uploading/PhenotypeUpload.t +++ b/t/unit_fixture/CXGN/Uploading/PhenotypeUpload.t @@ -15,41 +15,35 @@ use Data::Dumper; my $f = SGN::Test::Fixture->new(); -my $c = SimulateC->new( { dbh => $f->dbh(), - bcs_schema => $f->bcs_schema(), - metadata_schema => $f->metadata_schema(), - phenome_schema => $f->phenome_schema(), - sp_person_id => 41 }); - ####################################### #Find out table counts before adding anything, so that changes can be compared -my $phenotyping_experiment_cvterm_id = SGN::Model::Cvterm->get_cvterm_row($c->bcs_schema, 'phenotyping_experiment', 'experiment_type')->cvterm_id(); -my $experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); +my $phenotyping_experiment_cvterm_id = SGN::Model::Cvterm->get_cvterm_row($f->bcs_schema, 'phenotyping_experiment', 'experiment_type')->cvterm_id(); +my $experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); my $pre_experiment_count = $experiment->count(); -my $phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +my $phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); my $pre_phenotype_count = $phenotype_rs->count(); -my $exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +my $exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); my $pre_exp_prop_count = $exp_prop_rs->count(); -my $exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +my $exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); my $pre_exp_stock_count = $exp_stock_rs->count(); -my $exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +my $exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); my $pre_exp_proj_count = $exp_proj_rs->count(); -my $exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +my $exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); my $pre_exp_pheno_count = $exp_pheno_rs->count(); -my $md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +my $md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); my $pre_md_count = $md_rs->count(); -my $md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +my $md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); my $pre_md_files_count = $md_files_rs->count(); -my $exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +my $exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); my $pre_exp_md_files_count = $exp_md_files_rs->count(); @@ -389,7 +383,7 @@ my @traits = @{$parsed_file->{'traits'}}; my $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); my $size = scalar(@plots) * scalar(@traits); -my $stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); +my $stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); ok(!$stored_phenotype_error_msg, "check that store pheno spreadsheet works"); my $tn = CXGN::Trial->new( { bcs_schema => $f->bcs_schema(), @@ -426,55 +420,55 @@ is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits 70773 from phenotyping spreadsheet upload' ); -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); my $post1_experiment_count = $experiment->count(); my $post1_experiment_diff = $post1_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post1_experiment_diff."\n"; ok($post1_experiment_diff == 60, "Check num rows in NdExperiment table after addition of phenotyping spreadsheet upload"); -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); my $post1_phenotype_count = $phenotype_rs->count(); my $post1_phenotype_diff = $post1_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post1_phenotype_diff."\n"; ok($post1_phenotype_diff == 60, "Check num rows in Phenotype table after addition of phenotyping spreadsheet upload"); -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); my $post1_exp_prop_count = $exp_prop_rs->count(); my $post1_exp_prop_diff = $post1_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post1_exp_prop_diff."\n"; ok($post1_exp_prop_diff == 120, "Check num rows in Experimentprop table after addition of phenotyping spreadsheet upload"); -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); my $post1_exp_proj_count = $exp_proj_rs->count(); my $post1_exp_proj_diff = $post1_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post1_exp_proj_diff."\n"; ok($post1_exp_proj_diff == 60, "Check num rows in NdExperimentproject table after addition of phenotyping spreadsheet upload"); -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); my $post1_exp_stock_count = $exp_stock_rs->count(); my $post1_exp_stock_diff = $post1_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post1_exp_stock_diff."\n"; ok($post1_exp_stock_diff == 60, "Check num rows in NdExperimentstock table after addition of phenotyping spreadsheet upload"); -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); my $post1_exp_pheno_count = $exp_pheno_rs->count(); my $post1_exp_pheno_diff = $post1_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post1_exp_pheno_diff."\n"; ok($post1_exp_pheno_diff == 60, "Check num rows in NdExperimentphenotype table after addition of phenotyping spreadsheet upload"); -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); my $post1_md_count = $md_rs->count(); my $post1_md_diff = $post1_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post1_md_diff."\n"; ok($post1_md_diff == 1, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); my $post1_md_files_count = $md_files_rs->count(); my $post1_md_files_diff = $post1_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post1_md_files_diff."\n"; ok($post1_md_files_diff == 1, "Check num rows in MdFiles table after addition of phenotyping spreadsheet upload"); -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); my $post1_exp_md_files_count = $exp_md_files_rs->count(); my $post1_exp_md_files_diff = $post1_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post1_exp_md_files_diff."\n"; @@ -503,7 +497,7 @@ my @plots = @{$parsed_file->{'plots'}}; my @traits = @{$parsed_file->{'traits'}}; $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); -$stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); +$stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); ok(!$stored_phenotype_error_msg, "check that store pheno spreadsheet works"); my $traits_assayed = $tn->get_traits_assayed(); @@ -537,55 +531,55 @@ is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits 70773 from phenotyping spreadsheet upload' ); -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); my $post2_experiment_count = $experiment->count(); my $post2_experiment_diff = $post2_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post2_experiment_diff."\n"; ok($post2_experiment_diff == 120, "Check num rows in NdExperiment table after second addition of phenotyping spreadsheet upload"); -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); my $post2_phenotype_count = $phenotype_rs->count(); my $post2_phenotype_diff = $post2_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post2_phenotype_diff."\n"; ok($post2_phenotype_diff == 120, "Check num rows in Phenotype table after second addition of phenotyping spreadsheet upload"); -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); my $post2_exp_prop_count = $exp_prop_rs->count(); my $post2_exp_prop_diff = $post2_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post2_exp_prop_diff."\n"; ok($post2_exp_prop_diff == 240, "Check num rows in Experimentprop table after second addition of phenotyping spreadsheet upload"); -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); my $post2_exp_proj_count = $exp_proj_rs->count(); my $post2_exp_proj_diff = $post2_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post2_exp_proj_diff."\n"; ok($post2_exp_proj_diff == 120, "Check num rows in NdExperimentproject table after second addition of phenotyping spreadsheet upload"); -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); my $post2_exp_stock_count = $exp_stock_rs->count(); my $post2_exp_stock_diff = $post2_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post2_exp_stock_diff."\n"; ok($post2_exp_stock_diff == 120, "Check num rows in NdExperimentstock table after second addition of phenotyping spreadsheet upload"); -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); my $post2_exp_pheno_count = $exp_pheno_rs->count(); my $post2_exp_pheno_diff = $post2_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post2_exp_pheno_diff."\n"; ok($post2_exp_pheno_diff == 120, "Check num rows in NdExperimentphenotype table after second addition of phenotyping spreadsheet upload"); -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); my $post2_md_count = $md_rs->count(); my $post2_md_diff = $post2_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post2_md_diff."\n"; ok($post2_md_diff == 2, "Check num rows in MdMetadata table after second addition of phenotyping spreadsheet upload"); -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); my $post2_md_files_count = $md_files_rs->count(); my $post2_md_files_diff = $post2_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post2_md_files_diff."\n"; ok($post2_md_files_diff == 2, "Check num rows in MdFiles table after second addition of phenotyping spreadsheet upload"); -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); my $post2_exp_md_files_count = $exp_md_files_rs->count(); my $post2_exp_md_files_diff = $post2_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post2_exp_md_files_diff."\n"; @@ -816,7 +810,7 @@ $phenotype_metadata{'date'}="2016-01-16_03:15:26"; $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); $size = scalar(@plots) * scalar(@traits); -$stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); +$stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots', 0, 't/data/fieldbook/photos.zip'); ok(!$stored_phenotype_error_msg, "check that store fieldbook works"); $tn = CXGN::Trial->new( { bcs_schema => $f->bcs_schema(), @@ -841,55 +835,55 @@ my @pheno_for_trait_sorted = sort {$a <=> $b} @pheno_for_trait; is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits 70741 from phenotyping spreadsheet upload' ); -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); $post1_experiment_count = $experiment->count(); $post1_experiment_diff = $post1_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post1_experiment_diff."\n"; ok($post1_experiment_diff == 150, "Check num rows in NdExperiment table after addition of fieldbook upload"); -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); $post1_phenotype_count = $phenotype_rs->count(); $post1_phenotype_diff = $post1_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post1_phenotype_diff."\n"; ok($post1_phenotype_diff == 150, "Check num rows in Phenotype table after addition of fieldbook upload"); -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); $post1_exp_prop_count = $exp_prop_rs->count(); $post1_exp_prop_diff = $post1_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post1_exp_prop_diff."\n"; ok($post1_exp_prop_diff == 300, "Check num rows in Experimentprop table after addition of fieldbook upload"); -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); $post1_exp_proj_count = $exp_proj_rs->count(); $post1_exp_proj_diff = $post1_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post1_exp_proj_diff."\n"; ok($post1_exp_proj_diff == 150, "Check num rows in NdExperimentproject table after addition of fieldbook upload"); -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); $post1_exp_stock_count = $exp_stock_rs->count(); $post1_exp_stock_diff = $post1_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post1_exp_stock_diff."\n"; ok($post1_exp_stock_diff == 150, "Check num rows in NdExperimentstock table after addition of fieldbook upload"); -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); my $post1_exp_pheno_count = $exp_pheno_rs->count(); my $post1_exp_pheno_diff = $post1_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post1_exp_pheno_diff."\n"; ok($post1_exp_pheno_diff == 150, "Check num rows in NdExperimentphenotype table after addition of fieldbook upload"); -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); my $post1_md_count = $md_rs->count(); my $post1_md_diff = $post1_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post1_md_diff."\n"; -ok($post1_md_diff == 3, "Check num rows in MdMetadata table after addition of fieldbook upload"); +ok($post1_md_diff == 5, "Check num rows in MdMetadata table after addition of fieldbook upload"); -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); my $post1_md_files_count = $md_files_rs->count(); my $post1_md_files_diff = $post1_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post1_md_files_diff."\n"; ok($post1_md_files_diff == 3, "Check num rows in MdFiles table after addition of fieldbook upload"); -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); my $post1_exp_md_files_count = $exp_md_files_rs->count(); my $post1_exp_md_files_diff = $post1_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post1_exp_md_files_diff."\n"; @@ -1234,7 +1228,7 @@ $phenotype_metadata{'date'}="2016-02-16_07:11:98"; $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); $size = scalar(@plots) * scalar(@traits); -$stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); +$stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); ok(!$stored_phenotype_error_msg, "check that store fieldbook works"); $tn = CXGN::Trial->new( { bcs_schema => $f->bcs_schema(), @@ -1271,55 +1265,55 @@ is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits 70773 from phenotyping spreadsheet upload' ); -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}); $post1_experiment_count = $experiment->count(); $post1_experiment_diff = $post1_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post1_experiment_diff."\n"; ok($post1_experiment_diff == 207, "Check num rows in NdExperiment table after addition of datacollector upload"); -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); $post1_phenotype_count = $phenotype_rs->count(); $post1_phenotype_diff = $post1_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post1_phenotype_diff."\n"; ok($post1_phenotype_diff == 207, "Check num rows in Phenotype table after addition of datacollector upload"); -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); $post1_exp_prop_count = $exp_prop_rs->count(); $post1_exp_prop_diff = $post1_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post1_exp_prop_diff."\n"; ok($post1_exp_prop_diff == 414, "Check num rows in Experimentprop table after addition of datacollector upload"); -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); $post1_exp_proj_count = $exp_proj_rs->count(); $post1_exp_proj_diff = $post1_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post1_exp_proj_diff."\n"; ok($post1_exp_proj_diff == 207, "Check num rows in NdExperimentproject table after addition of datacollector upload"); -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); $post1_exp_stock_count = $exp_stock_rs->count(); $post1_exp_stock_diff = $post1_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post1_exp_stock_diff."\n"; ok($post1_exp_stock_diff == 207, "Check num rows in NdExperimentstock table after addition of datacollector upload"); -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); my $post1_exp_pheno_count = $exp_pheno_rs->count(); my $post1_exp_pheno_diff = $post1_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post1_exp_pheno_diff."\n"; ok($post1_exp_pheno_diff == 207, "Check num rows in NdExperimentphenotype table after addition of datacollector upload"); -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); my $post1_md_count = $md_rs->count(); my $post1_md_diff = $post1_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post1_md_diff."\n"; -ok($post1_md_diff == 4, "Check num rows in MdMetadata table after addition of datacollector upload"); +ok($post1_md_diff == 6, "Check num rows in MdMetadata table after addition of datacollector upload"); -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); my $post1_md_files_count = $md_files_rs->count(); my $post1_md_files_diff = $post1_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post1_md_files_diff."\n"; ok($post1_md_files_diff == 4, "Check num rows in MdFiles table after addition of datacollector upload"); -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); my $post1_exp_md_files_count = $exp_md_files_rs->count(); my $post1_exp_md_files_diff = $post1_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post1_exp_md_files_diff."\n"; @@ -1893,7 +1887,7 @@ $phenotype_metadata{'date'}="2016-02-16_05:55:55"; $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); $size = scalar(@plots) * scalar(@traits); -$stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); +$stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plots'); ok(!$stored_phenotype_error_msg, "check that store large pheno spreadsheet works"); $tn = CXGN::Trial->new( { bcs_schema => $f->bcs_schema(), @@ -1955,7 +1949,7 @@ is_deeply(\@pheno_for_trait_sorted, \@pheno_for_trait_check, 'check pheno traits -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}, {order_by => {-asc => 'nd_experiment_id'}}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}, {order_by => {-asc => 'nd_experiment_id'}}); $post1_experiment_count = $experiment->count(); $post1_experiment_diff = $post1_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post1_experiment_diff."\n"; @@ -1968,7 +1962,7 @@ while (my $rs = $nd_experiment_table_tail->next() ) { } #print STDERR Dumper \@nd_experiment_table; -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); $post1_phenotype_count = $phenotype_rs->count(); $post1_phenotype_diff = $post1_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post1_phenotype_diff."\n"; @@ -1981,7 +1975,7 @@ while (my $rs = $pheno_table_tail->next() ) { } #print STDERR Dumper \@pheno_table; -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); $post1_exp_prop_count = $exp_prop_rs->count(); $post1_exp_prop_diff = $post1_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post1_exp_prop_diff."\n"; @@ -1994,7 +1988,7 @@ while (my $rs = $exp_prop_table_tail->next() ) { } #print STDERR Dumper \@exp_prop_table; -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); $post1_exp_proj_count = $exp_proj_rs->count(); $post1_exp_proj_diff = $post1_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post1_exp_proj_diff."\n"; @@ -2007,7 +2001,7 @@ while (my $rs = $exp_proj_table_tail->next() ) { } #print STDERR Dumper \@exp_proj_table; -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); $post1_exp_stock_count = $exp_stock_rs->count(); $post1_exp_stock_diff = $post1_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post1_exp_stock_diff."\n"; @@ -2020,7 +2014,7 @@ while (my $rs = $exp_stock_table_tail->next() ) { } #print STDERR Dumper \@exp_stock_table; -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); $post1_exp_pheno_count = $exp_pheno_rs->count(); $post1_exp_pheno_diff = $post1_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post1_exp_pheno_diff."\n"; @@ -2033,11 +2027,11 @@ while (my $rs = $exp_pheno_table_tail->next() ) { } #print STDERR Dumper \@exp_pheno_table; -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); $post1_md_count = $md_rs->count(); $post1_md_diff = $post1_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post1_md_diff."\n"; -ok($post1_md_diff == 5, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); +ok($post1_md_diff == 7, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); my @md_table; my $md_table_tail = $md_rs->slice($post1_md_count-5, $post1_md_count); @@ -2046,7 +2040,7 @@ while (my $rs = $md_table_tail->next() ) { } #print STDERR Dumper \@md_table; -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); $post1_md_files_count = $md_files_rs->count(); $post1_md_files_diff = $post1_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post1_md_files_diff."\n"; @@ -2059,7 +2053,7 @@ while (my $rs = $md_files_table_tail->next() ) { } #print STDERR Dumper \@md_files_table; -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); $post1_exp_md_files_count = $exp_md_files_rs->count(); $post1_exp_md_files_diff = $post1_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post1_exp_md_files_diff."\n"; @@ -2442,7 +2436,7 @@ $phenotype_metadata{'date'}="2016-02-16_05:15:21"; $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); $size = scalar(@plots) * scalar(@traits); -$stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plants'); +$stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plants'); ok(!$stored_phenotype_error_msg, "check that store large pheno spreadsheet works"); $tn = CXGN::Trial->new( { bcs_schema => $f->bcs_schema(), @@ -2569,7 +2563,7 @@ is_deeply(\@pheno_for_trait_sorted, [ ], "check pheno trait 70727 after plant upload."); -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}, {order_by => {-asc => 'nd_experiment_id'}}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}, {order_by => {-asc => 'nd_experiment_id'}}); $post1_experiment_count = $experiment->count(); $post1_experiment_diff = $post1_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post1_experiment_diff."\n"; @@ -2582,7 +2576,7 @@ while (my $rs = $nd_experiment_table_tail->next() ) { } #print STDERR Dumper \@nd_experiment_table; -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); $post1_phenotype_count = $phenotype_rs->count(); $post1_phenotype_diff = $post1_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post1_phenotype_diff."\n"; @@ -2595,7 +2589,7 @@ while (my $rs = $pheno_table_tail->next() ) { } #print STDERR Dumper \@pheno_table; -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); $post1_exp_prop_count = $exp_prop_rs->count(); $post1_exp_prop_diff = $post1_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post1_exp_prop_diff."\n"; @@ -2608,7 +2602,7 @@ while (my $rs = $exp_prop_table_tail->next() ) { } #print STDERR Dumper \@exp_prop_table; -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); $post1_exp_proj_count = $exp_proj_rs->count(); $post1_exp_proj_diff = $post1_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post1_exp_proj_diff."\n"; @@ -2621,7 +2615,7 @@ while (my $rs = $exp_proj_table_tail->next() ) { } #print STDERR Dumper \@exp_proj_table; -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); $post1_exp_stock_count = $exp_stock_rs->count(); $post1_exp_stock_diff = $post1_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post1_exp_stock_diff."\n"; @@ -2634,7 +2628,7 @@ while (my $rs = $exp_stock_table_tail->next() ) { } #print STDERR Dumper \@exp_stock_table; -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); $post1_exp_pheno_count = $exp_pheno_rs->count(); $post1_exp_pheno_diff = $post1_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post1_exp_pheno_diff."\n"; @@ -2647,11 +2641,11 @@ while (my $rs = $exp_pheno_table_tail->next() ) { } #print STDERR Dumper \@exp_pheno_table; -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); $post1_md_count = $md_rs->count(); $post1_md_diff = $post1_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post1_md_diff."\n"; -ok($post1_md_diff == 6, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); +ok($post1_md_diff == 8, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); my @md_table; my $md_table_tail = $md_rs->slice($post1_md_count-5, $post1_md_count); @@ -2660,7 +2654,7 @@ while (my $rs = $md_table_tail->next() ) { } #print STDERR Dumper \@md_table; -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); $post1_md_files_count = $md_files_rs->count(); $post1_md_files_diff = $post1_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post1_md_files_diff."\n"; @@ -2673,7 +2667,7 @@ while (my $rs = $md_files_table_tail->next() ) { } #print STDERR Dumper \@md_files_table; -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); $post1_exp_md_files_count = $exp_md_files_rs->count(); $post1_exp_md_files_diff = $post1_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post1_exp_md_files_diff."\n"; @@ -2778,7 +2772,7 @@ $phenotype_metadata{'date'}="2016-02-16_05:55:17"; $store_phenotypes = CXGN::Phenotypes::StorePhenotypes->new(); $size = scalar(@plots) * scalar(@traits); -$stored_phenotype_error_msg = $store_phenotypes->store($c,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plants'); +$stored_phenotype_error_msg = $store_phenotypes->store($f,$size,\@plots,\@traits, \%parsed_data, \%phenotype_metadata, 'plants'); ok(!$stored_phenotype_error_msg, "check that store fieldbook plants works"); $tn = CXGN::Trial->new( { bcs_schema => $f->bcs_schema(), @@ -2789,7 +2783,7 @@ $traits_assayed = $tn->get_traits_assayed(); #print STDERR Dumper \@traits_assayed_sorted; is_deeply(\@traits_assayed_sorted, [[70666, 'Fresh root weight'], [70668, 'Harvest index variable'], [70681,'Top yield'], [ 70700, 'Sprouting proportion'], [70706,'Root number counting'],[70713,'Flower'],[ 70727, 'Dry yield' ], [70741,'Dry matter content percentage' ], [ 70773, 'Fresh shoot weight measurement in kg' ] ], 'check traits assayed after plant upload' ); -$experiment = $c->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}, {order_by => {-asc => 'nd_experiment_id'}}); +$experiment = $f->bcs_schema->resultset('NaturalDiversity::NdExperiment')->search({type_id => $phenotyping_experiment_cvterm_id}, {order_by => {-asc => 'nd_experiment_id'}}); $post1_experiment_count = $experiment->count(); $post1_experiment_diff = $post1_experiment_count - $pre_experiment_count; print STDERR "Experiment count: ".$post1_experiment_diff."\n"; @@ -2802,7 +2796,7 @@ while (my $rs = $nd_experiment_table_tail->next() ) { } #print STDERR Dumper \@nd_experiment_table; -$phenotype_rs = $c->bcs_schema->resultset('Phenotype::Phenotype')->search({}); +$phenotype_rs = $f->bcs_schema->resultset('Phenotype::Phenotype')->search({}); $post1_phenotype_count = $phenotype_rs->count(); $post1_phenotype_diff = $post1_phenotype_count - $pre_phenotype_count; print STDERR "Phenotype count: ".$post1_phenotype_diff."\n"; @@ -2815,7 +2809,7 @@ while (my $rs = $pheno_table_tail->next() ) { } #print STDERR Dumper \@pheno_table; -$exp_prop_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); +$exp_prop_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentprop')->search({}); $post1_exp_prop_count = $exp_prop_rs->count(); $post1_exp_prop_diff = $post1_exp_prop_count - $pre_exp_prop_count; print STDERR "Experimentprop count: ".$post1_exp_prop_diff."\n"; @@ -2828,7 +2822,7 @@ while (my $rs = $exp_prop_table_tail->next() ) { } #print STDERR Dumper \@exp_prop_table; -$exp_proj_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); +$exp_proj_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentProject')->search({}); $post1_exp_proj_count = $exp_proj_rs->count(); $post1_exp_proj_diff = $post1_exp_proj_count - $pre_exp_proj_count; print STDERR "Experimentproject count: ".$post1_exp_proj_diff."\n"; @@ -2841,7 +2835,7 @@ while (my $rs = $exp_proj_table_tail->next() ) { } #print STDERR Dumper \@exp_proj_table; -$exp_stock_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); +$exp_stock_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentStock')->search({}); $post1_exp_stock_count = $exp_stock_rs->count(); $post1_exp_stock_diff = $post1_exp_stock_count - $pre_exp_stock_count; print STDERR "Experimentstock count: ".$post1_exp_stock_diff."\n"; @@ -2854,7 +2848,7 @@ while (my $rs = $exp_stock_table_tail->next() ) { } #print STDERR Dumper \@exp_stock_table; -$exp_pheno_rs = $c->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); +$exp_pheno_rs = $f->bcs_schema->resultset('NaturalDiversity::NdExperimentPhenotype')->search({}); $post1_exp_pheno_count = $exp_pheno_rs->count(); $post1_exp_pheno_diff = $post1_exp_pheno_count - $pre_exp_pheno_count; print STDERR "Experimentphenotype count: ".$post1_exp_pheno_diff."\n"; @@ -2867,11 +2861,11 @@ while (my $rs = $exp_pheno_table_tail->next() ) { } #print STDERR Dumper \@exp_pheno_table; -$md_rs = $c->metadata_schema->resultset('MdMetadata')->search({}); +$md_rs = $f->metadata_schema->resultset('MdMetadata')->search({}); $post1_md_count = $md_rs->count(); $post1_md_diff = $post1_md_count - $pre_md_count; print STDERR "MdMetadata count: ".$post1_md_diff."\n"; -ok($post1_md_diff == 7, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); +ok($post1_md_diff == 9, "Check num rows in MdMetadata table after addition of phenotyping spreadsheet upload"); my @md_table; my $md_table_tail = $md_rs->slice($post1_md_count-5, $post1_md_count); @@ -2880,7 +2874,7 @@ while (my $rs = $md_table_tail->next() ) { } #print STDERR Dumper \@md_table; -$md_files_rs = $c->metadata_schema->resultset('MdFiles')->search({}); +$md_files_rs = $f->metadata_schema->resultset('MdFiles')->search({}); $post1_md_files_count = $md_files_rs->count(); $post1_md_files_diff = $post1_md_files_count - $pre_md_files_count; print STDERR "MdFiles count: ".$post1_md_files_diff."\n"; @@ -2893,7 +2887,7 @@ while (my $rs = $md_files_table_tail->next() ) { } #print STDERR Dumper \@md_files_table; -$exp_md_files_rs = $c->phenome_schema->resultset('NdExperimentMdFiles')->search({}); +$exp_md_files_rs = $f->phenome_schema->resultset('NdExperimentMdFiles')->search({}); $post1_exp_md_files_count = $exp_md_files_rs->count(); $post1_exp_md_files_diff = $post1_exp_md_files_count - $pre_exp_md_files_count; print STDERR "Experimentphenotype count: ".$post1_exp_md_files_diff."\n"; -- 2.11.4.GIT