add trial design store subclasses.
[sgn.git] / lib / CXGN / Trial / ParseUpload.pm
blobe980f8395d9d75e1415b270c362ea7c9b29e94e7
1 package CXGN::Trial::ParseUpload;
3 use Moose;
4 use Data::Dumper;
5 use MooseX::FollowPBP;
6 use Moose::Util::TypeConstraints;
8 with 'MooseX::Object::Pluggable';
11 has 'chado_schema' => (
12 is => 'ro',
13 isa => 'DBIx::Class::Schema',
14 required => 1
17 has 'filename' => (
18 is => 'ro',
19 isa => 'Str',
20 required => 1
23 has 'parse_warnings' => (
24 is => 'ro',
25 isa => 'HashRef',
26 writer => '_set_parse_warnings',
27 reader => 'get_parse_warnings',
28 predicate => 'has_parse_warnings'
31 has 'parse_errors' => (
32 is => 'ro',
33 isa => 'HashRef',
34 writer => '_set_parse_errors',
35 reader => 'get_parse_errors',
36 predicate => 'has_parse_errors'
39 has '_parsed_data' => (
40 is => 'ro',
41 isa => 'HashRef',
42 writer => '_set_parsed_data',
43 predicate => '_has_parsed_data'
46 has 'trial_stock_type' => (
47 isa => 'Str',
48 is => 'rw',
49 predicate => 'has_trial_stock_type',
50 required => 0,
51 default => 'accession'
54 sub parse {
55 my $self = shift;
56 my $args = shift;
58 if (!$self->_validate_with_plugin($args)) {
59 my $errors = $self->get_parse_errors();
60 print STDERR "\nCould not validate trial file: ".$self->get_filename()."\nError:".Dumper($errors)."\n";
61 return;
64 # print STDERR "Check 3.1: ".localtime();
66 if (!$self->_parse_with_plugin($args)) {
67 my $errors = $self->get_parse_errors();
68 print STDERR "\nCould not parse trial file: ".$self->get_filename()."\nError:".Dumper($errors)."\n";
69 return;
72 # print STDERR "Check 3.2: ".localtime();
74 if (!$self->_has_parsed_data()) {
75 my $errors = $self->get_parse_errors();
76 print STDERR "\nNo parsed data for trial file: ".$self->get_filename()."\nError:".Dumper($errors)."\n";
77 return;
78 } else {
79 return $self->_parsed_data();
82 #print STDERR "Check 3.3: ".localtime();
84 my $errors = $self->get_parse_errors();
85 print STDERR "\nError parsing trial file: ".$self->get_filename()."\nError:".Dumper($errors)."\n";
86 return;