1 package CXGN
::Pedigree
::ParseUpload
::Plugin
::StoreExistingProgeniesExcel
;
4 use Spreadsheet
::ParseExcel
;
5 use Spreadsheet
::ParseXLSX
;
6 use CXGN
::Stock
::StockLookup
;
7 use SGN
::Model
::Cvterm
;
9 use CXGN
::List
::Validate
;
10 use CXGN
::Stock
::RelatedStocks
;
13 sub _validate_with_plugin
{
14 return 1; #storing after validation plugin
17 sub _parse_with_plugin
{
19 my $filename = $self->get_filename();
20 my $schema = $self->get_chado_schema();
22 # Match a dot, extension .xls / .xlsx
23 my ($extension) = $filename =~ /(\.[^.]+)$/;
26 if ($extension eq '.xlsx') {
27 $parser = Spreadsheet
::ParseXLSX
->new();
30 $parser = Spreadsheet
::ParseExcel
->new();
36 $excel_obj = $parser->parse($filename);
41 $worksheet = ($excel_obj->worksheets())[0];
42 my ($row_min, $row_max) = $worksheet->row_range();
43 my ($col_min, $col_max) = $worksheet->col_range();
45 my %cross_progenies_hash;
47 for my $row (1 .. $row_max){
51 if ($worksheet->get_cell($row,0)){
52 $cross_name = $worksheet->get_cell($row,0)->value();
53 $cross_name =~ s/^\s+|\s+$//g;
55 if ($worksheet->get_cell($row,1)){
56 $progeny_name = $worksheet->get_cell($row,1)->value();
57 $progeny_name =~ s/^\s+|\s+$//g;
59 #skip blank lines or lines with no name, type and parent
60 if (!$cross_name && !$progeny_name) {
64 push @
{$cross_progenies_hash{$cross_name}}, $progeny_name;
66 $self->_set_parsed_data(\
%cross_progenies_hash);