brapi refactor error response
[sgn.git] / lib / CXGN / Pedigree / ParseUpload.pm
blobcf4686cda9afdcb8668ccdb7f1df5ba6973c26ee
1 package CXGN::Pedigree::ParseUpload;
3 use Moose;
4 use MooseX::FollowPBP;
5 use Moose::Util::TypeConstraints;
6 use Bio::GeneticRelationships::Pedigree;
7 use Bio::GeneticRelationships::Individual;
9 with 'MooseX::Object::Pluggable';
12 has 'chado_schema' => (
13 is => 'ro',
14 isa => 'DBIx::Class::Schema',
15 required => 1,
18 has 'filename' => (
19 is => 'ro',
20 isa => 'Str',
21 required => 1,
24 has 'parse_errors' => (
25 is => 'ro',
26 isa => 'ArrayRef[Str]',
27 writer => '_set_parse_errors',
28 reader => 'get_parse_errors',
29 predicate => 'has_parse_errors',
32 has '_parsed_data' => (
33 is => 'ro',
34 isa => 'HashRef',
35 writer => '_set_parsed_data',
36 predicate => '_has_parsed_data',
39 sub parse {
40 my $self = shift;
42 if (!$self->_validate_with_plugin()) {
43 print STDERR "\nCould not validate cross file: ".$self->get_filename()."\n";
44 return;
47 if (!$self->_parse_with_plugin()) {
48 print STDERR "\nCould not parse cross file: ".$self->get_filename()."\n";
49 return;
52 if (!$self->_has_parsed_data()) {
53 print STDERR "\nNo parsed data for cross file: ".$self->get_filename()."\n";
54 return;
55 } else {
56 return $self->_parsed_data();
59 print STDERR "\nError parsing cross file: ".$self->get_filename()."\n";
60 return;