Skip to content

Commit

Permalink
Updated dox, fixed checks for SPChromosome, added PositiveInt subtype…
Browse files Browse the repository at this point in the history
…, fixed SPComment length check. For #25
  • Loading branch information
suryasaha committed May 12, 2015
1 parent e3000bb commit f6cb53a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/Bio/GenomeUpdate/SP/SPLine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use Data::Dumper;#for debugging
=head1 DESCRIPTION
This class stores information for transitions between TPF components including chromosome, accessions and coordinates for generating a switch point (SP) file. The switch point file specifies the exact point of transition between two consecutive components in the TPF file.
This class stores information for transitions between TPF components including chromosome, accessions and coordinates for generating a switch point (SP) file. The switch point file specifies the exact point of transition between two consecutive components in the AGP file.
=head2 Methods
Expand All @@ -36,7 +36,11 @@ Gets the chromosome.
=cut

has 'chromosome' => ( isa => 'Str', is => 'rw', required => 1, clearer => 'clear_chromosome' );
subtype 'SPChromosome', #only works for genomes with 12 chrs or less.
as 'Str',
where { $_ eq '1' || $_ eq '2' || $_ eq '3' || $_ eq '4' || $_ eq '5' || $_ eq '6' || $_ eq '7' || $_ eq '8' || $_ eq '9' || $_ eq '10' || $_ eq '11' || $_ eq '12' || $_ eq "Un" },#does NOT work. need to do -> if int check 1-12, if str check Un
message { "The string, $_, was not a valid chromosome number. Valid values for Solanum lycopersicum are 1-12 and Un." };
has 'chromosome' => ( isa => 'SPChromosome', is => 'rw', required => 1, clearer => 'clear_chromosome' );

has 'accession_prefix' => ( isa => 'Str', is => 'rw', required => 1, clearer => 'clear_accession_prefix' );
has 'accession_suffix' => ( isa => 'Str', is => 'rw', required => 1, clearer => 'clear_accession_suffix' );
Expand All @@ -45,16 +49,19 @@ subtype 'SPOrientationType',
as 'Str',
where { $_ eq "+" || $_ eq "-" || $_ eq "?" || $_ eq "0" || $_ eq "na"},
message { "The string, $_, was not a valid orientation type. Valid types are: + - ? 0 na" };

has 'accession_prefix_orientation' => ( isa => 'SPOrientationType', is => 'rw', required => 1, clearer => 'clear_accession_prefix_orientation' );
has 'accession_suffix_orientation' => ( isa => 'SPOrientationType', is => 'rw', required => 1, clearer => 'clear_accession_suffix_orientation' );

has 'accession_prefix_last_base' => ( isa => 'Int', is => 'rw', required => 1, clearer => 'clear_accession_prefix_last_base' );
has 'accession_suffix_first_base' => ( isa => 'Int', is => 'rw', required => 1, clearer => 'clear_accession_suffix_first_base' );
subtype 'PositiveInt',
as 'Int',
where { $_ > 0 },
message { "The string, $_, was not a positive coordinate" };
has 'accession_prefix_last_base' => ( isa => 'PositiveInt', is => 'rw', required => 1, clearer => 'clear_accession_prefix_last_base' );
has 'accession_suffix_first_base' => ( isa => 'PositiveInt', is => 'rw', required => 1, clearer => 'clear_accession_suffix_first_base' );

subtype 'SPComment',
as 'Str',
where { scalar $_ >= 25 },
where { (length $_) >= 25 },
message { "The string, $_, was shorter than the minimum length of 25 characters." };
has 'comment' => ( isa => 'SPComment', is => 'rw', required => 1, clearer => 'clear_comment' );

Expand Down

0 comments on commit f6cb53a

Please sign in to comment.