Permalink
Browse files

Started refactoring various location attributes to having build method

  • Loading branch information...
cybersiddhu committed Sep 10, 2009
1 parent 33a76d8 commit b8039fab3164f3d0980a45c4d97808d68274684f
Showing with 25,111 additions and 116 deletions.
  1. +342 −0 .dotest/0001
  2. +326 −0 .dotest/0002
  3. +108 −0 .dotest/0003
  4. +80 −0 .dotest/0004
  5. +1 −0 .dotest/binary
  6. +1 −0 .dotest/final-commit
  7. +5 −0 .dotest/info
  8. +1 −0 .dotest/keep
  9. +1 −0 .dotest/last
  10. 0 .dotest/msg
  11. 0 .dotest/msg-clean
  12. +1 −0 .dotest/next
  13. +337 −0 .dotest/patch
  14. +1 −0 .dotest/sign
  15. +1 −0 .dotest/utf8
  16. +1 −0 .dotest/whitespace
  17. +61 −0 Build
  18. +1 −0 _build/auto_features
  19. +118 −0 _build/build_params
  20. +3 −0 _build/cleanup
  21. +1 −0 _build/config_data
  22. +1 −0 _build/features
  23. +1 −0 _build/magicnum
  24. +1 −0 _build/notes
  25. +20 −0 _build/prereqs
  26. +3 −0 _build/runtime_params
  27. +51 −0 blib/lib/Biome.pm
  28. +335 −0 blib/lib/Biome/Annotation/Collection.pm
  29. +185 −0 blib/lib/Biome/Annotation/Comment.pm
  30. +313 −0 blib/lib/Biome/Annotation/DBLink.pm
  31. +584 −0 blib/lib/Biome/Annotation/OntologyTerm.pm
  32. +387 −0 blib/lib/Biome/Annotation/Reference.pm
  33. +223 −0 blib/lib/Biome/Annotation/Relation.pm
  34. +203 −0 blib/lib/Biome/Annotation/SimpleValue.pm
  35. +575 −0 blib/lib/Biome/Annotation/TagTree.pm
  36. +172 −0 blib/lib/Biome/Annotation/Target.pm
  37. +177 −0 blib/lib/Biome/Annotation/TypeManager.pm
  38. +432 −0 blib/lib/Biome/Location/Atomic.pm
  39. +119 −0 blib/lib/Biome/Location/AvWithinCoordPolicy.pm
  40. +421 −0 blib/lib/Biome/Location/Simple.pm
  41. +120 −0 blib/lib/Biome/Location/WidestCoordPolicy.pm
  42. +116 −0 blib/lib/Biome/Meta/Class.pm
  43. +15 −0 blib/lib/Biome/Meta/Role.pm
  44. +25 −0 blib/lib/Biome/PrimarySeq.pm
  45. +21 −0 blib/lib/Biome/Role.pm
  46. +665 −0 blib/lib/Biome/Role/Analysis.pm
  47. +23 −0 blib/lib/Biome/Role/AnalysisParser.pm
  48. +125 −0 blib/lib/Biome/Role/AnalysisResult.pm
  49. +25 −0 blib/lib/Biome/Role/Annotatable.pm
  50. +141 −0 blib/lib/Biome/Role/Annotate.pm
  51. +76 −0 blib/lib/Biome/Role/Cluster.pm
  52. +285 −0 blib/lib/Biome/Role/CollectAnnotation.pm
  53. +271 −0 blib/lib/Biome/Role/CollectTags.pm
  54. +287 −0 blib/lib/Biome/Role/DatabaseLink.pm
  55. +42 −0 blib/lib/Biome/Role/Describe.pm
  56. +154 −0 blib/lib/Biome/Role/Feature.pm
  57. +35 −0 blib/lib/Biome/Role/IdCollection.pm
  58. +156 −0 blib/lib/Biome/Role/Identify.pm
  59. +334 −0 blib/lib/Biome/Role/Location.pm
  60. +37 −0 blib/lib/Biome/Role/Location/CoordinatePolicy.pm
  61. +72 −0 blib/lib/Biome/Role/Location/FuzzyLocation.pm
  62. +56 −0 blib/lib/Biome/Role/Location/SplitLocation.pm
  63. +191 −0 blib/lib/Biome/Role/ManageTypes.pm
  64. +69 −0 blib/lib/Biome/Role/ParameterBase.pm
  65. +345 −0 blib/lib/Biome/Role/PrimarySeq.pm
  66. +479 −0 blib/lib/Biome/Role/Range.pm
  67. +22 −0 blib/lib/Biome/Role/SeqAnalysisParser.pm
  68. +177 −0 blib/lib/Biome/Role/SimpleAnalysis.pm
  69. +441 −0 blib/lib/Biome/Role/Tree/Node.pm
  70. +304 −0 blib/lib/Biome/Role/Tree/Tree.pm
  71. +285 −0 blib/lib/Biome/Root.pm
  72. +43 −0 blib/lib/Biome/Root/Error.pm
  73. +12 −0 blib/lib/Biome/Root/IO.pm
  74. +886 −0 blib/lib/Biome/Tools/CodonTable.pm
  75. +308 −0 blib/lib/Biome/Tools/IUPAC.pm
  76. +52 −0 blib/lib/Biome/Types.pm
  77. +282 −0 blib/libdoc/Biome::Annotation::Collection.3
  78. +261 −0 blib/libdoc/Biome::Annotation::Comment.3
  79. +361 −0 blib/libdoc/Biome::Annotation::DBLink.3
  80. +486 −0 blib/libdoc/Biome::Annotation::OntologyTerm.3
  81. +440 −0 blib/libdoc/Biome::Annotation::Reference.3
  82. +299 −0 blib/libdoc/Biome::Annotation::Relation.3
  83. +286 −0 blib/libdoc/Biome::Annotation::SimpleValue.3
  84. +564 −0 blib/libdoc/Biome::Annotation::TagTree.3
  85. +239 −0 blib/libdoc/Biome::Annotation::Target.3
  86. +235 −0 blib/libdoc/Biome::Annotation::TypeManager.3
  87. +407 −0 blib/libdoc/Biome::Location::Atomic.3
  88. +213 −0 blib/libdoc/Biome::Location::AvWithinCoordPolicy.3
  89. +344 −0 blib/libdoc/Biome::Location::Simple.3
  90. +211 −0 blib/libdoc/Biome::Location::WidestCoordPolicy.3
  91. +731 −0 blib/libdoc/Biome::Role::Analysis.3
  92. +151 −0 blib/libdoc/Biome::Role::AnalysisParser.3
  93. +213 −0 blib/libdoc/Biome::Role::AnalysisResult.3
  94. +153 −0 blib/libdoc/Biome::Role::Annotatable.3
  95. +202 −0 blib/libdoc/Biome::Role::Annotate.3
  96. +191 −0 blib/libdoc/Biome::Role::Cluster.3
  97. +396 −0 blib/libdoc/Biome::Role::CollectAnnotation.3
  98. +330 −0 blib/libdoc/Biome::Role::CollectTags.3
  99. +364 −0 blib/libdoc/Biome::Role::DatabaseLink.3
  100. +166 −0 blib/libdoc/Biome::Role::Describe.3
  101. +212 −0 blib/libdoc/Biome::Role::Feature.3
  102. +161 −0 blib/libdoc/Biome::Role::IdCollection.3
  103. +259 −0 blib/libdoc/Biome::Role::Identify.3
  104. +382 −0 blib/libdoc/Biome::Role::Location.3
  105. +159 −0 blib/libdoc/Biome::Role::Location::CoordinatePolicy.3
  106. +194 −0 blib/libdoc/Biome::Role::Location::FuzzyLocation.3
  107. +171 −0 blib/libdoc/Biome::Role::Location::SplitLocation.3
  108. +262 −0 blib/libdoc/Biome::Role::ManageTypes.3
  109. +186 −0 blib/libdoc/Biome::Role::ParameterBase.3
  110. +151 −0 blib/libdoc/Biome::Role::PrimarySeq.3
  111. +301 −0 blib/libdoc/Biome::Role::Range.3
  112. +151 −0 blib/libdoc/Biome::Role::SeqAnalysisParser.3
  113. +276 −0 blib/libdoc/Biome::Role::SimpleAnalysis.3
  114. +464 −0 blib/libdoc/Biome::Role::Tree::Node.3
  115. +348 −0 blib/libdoc/Biome::Role::Tree::Tree.3
  116. +232 −0 blib/libdoc/Biome::Root.3
  117. +426 −0 blib/libdoc/Biome::Tools::CodonTable.3
  118. +265 −0 blib/libdoc/Biome::Tools::IUPAC.3
  119. +152 −116 lib/Biome/Role/Location.pm
  120. +273 −0 t/SeqFeature/Location.t
  121. +273 −0 t/SeqFeature/Location.t.old
View
@@ -0,0 +1,342 @@
From e18950452af31d84a054c996a0957f33010db4ef Mon Sep 17 00:00:00 2001
From: Siddhartha Basu <biosidd@gmail.com>
Date: Thu, 10 Sep 2009 03:41:14 -0500
Subject: Started refactoring various location attributes to having build method
---
lib/Biome/Role/Location.pm | 281 ++++++++++++++++++++++++--------------------
1 files changed, 152 insertions(+), 129 deletions(-)
diff --git a/lib/Biome/Role/Location.pm b/lib/Biome/Role/Location.pm
index c93a05297151f29b96c3ad1c76a84e69c7b2322c..390d627f76082128389828174117d44fe12cbab4 100644
--- a/lib/Biome/Role/Location.pm
+++ b/lib/Biome/Role/Location.pm
@@ -2,7 +2,8 @@ package Biome::Role::Location;
use Biome::Role;
-with 'Biome::Root::Range';
+##at this point making it independent of range
+#with 'Biome::Root::Range';
=head2 location_type
@@ -17,6 +18,10 @@ with 'Biome::Root::Range';
requires 'location_type';
+#for rest of attributes an empty builder method is provided which should be implemented by
+#the consuming class. This approach is kind of a first stab to see how it works(after
+#discussion with cfields in the bioperl mailing list)
+
=head2 start
Title : start
@@ -43,11 +48,10 @@ See L<Bio::Location::CoordinatePolicy> for more information
=cut
has 'start' => (
- is => 'ro',
- default => sub {
- my ($self) = @_;
- return $self->coordinate_policy->start($self);
- }
+ is => 'rw',
+ isa => 'Int',
+ builder => '_build_start',
+ lazy => 1,
);
=head2 end
@@ -76,11 +80,150 @@ information
=cut
has 'end' => (
+ is => 'rw',
+ isa => 'Int',
+ builder => '_build_end',
+ lazy => 1,
+);
+
+=head2 each_Location
+
+ Title : each_Location
+ Usage : @locations = $locObject->each_Location($order);
+ Function: Conserved function call across Location:: modules - will
+ return an array containing the component Location(s) in
+ that object, regardless if the calling object is itself a
+ single location or one containing sublocations.
+ Returns : an array of Bio::LocationI implementing objects
+ Args : Optional sort order to be passed to sub_Location() for Splits
+
+=cut
+
+has 'each_Location' => (
+ is => 'ro',
+ isa => 'Obj',
+ builder => '_build_each_Location',
+ lazy => 1,
+);
+
+=head2 to_FTstring
+
+ Title : to_FTstring
+ Usage : my $locstr = $location->to_FTstring()
+ Function: returns the FeatureTable string of this location
+ Returns : string
+ Args : none
+
+=cut
+
+has 'to_FTstring' => (
+ is => 'ro',
+ isa => Str,
+ builder => '_build_FTstring',
+ lazy => 1,
+);
+
+
+=head2 valid_Location
+
+ Title : valid_Location
+ Usage : if ($location->valid_location) {...};
+ Function: boolean method to determine whether location is considered valid
+ (has minimum requirements for a specific LocationI implementation)
+ Returns : Boolean value: true if location is valid, false otherwise
+ Args : none
+
+=cut
+
+has 'valid_Location' => (
+ is => 'ro',
+ isa => Bool,
+ builder => '_build_valid_Location',
+ lazy => 1,
+);
+
+
+=head2 coordinate_policy
+
+ Title : coordinate_policy
+ Usage : $policy = $location->coordinate_policy();
+ $location->coordinate_policy($mypolicy); # set may not be possible
+ Function: Get the coordinate computing policy employed by this object.
+
+ See L<Bio::Location::CoordinatePolicyI> for documentation
+ about the policy object and its use.
+
+ The interface *does not* require implementing classes to
+ accept setting of a different policy. The implementation
+ provided here does, however, allow to do so.
+
+ Implementors of this interface are expected to initialize
+ every new instance with a
+ L<Bio::Location::CoordinatePolicyI> object. The
+ implementation provided here will return a default policy
+ object if none has been set yet. To change this default
+ policy object call this method as a class method with an
+ appropriate argument. Note that in this case only
+ subsequently created Location objects will be affected.
+
+ Returns : A L<Bio::Location::CoordinatePolicyI> implementing object.
+ Args : On set, a L<Bio::Location::CoordinatePolicyI> implementing object.
+
+See L<Bio::Location::CoordinatePolicyI> for more information
+
+
+=cut
+
+requires 'coordinate_policy';
+
+
+=head2 is_remote
+
+ Title : is_remote
+ Usage : $is_remote_loc = $loc->is_remote()
+ Function: Whether or not a location is a remote location.
+
+ A location is said to be remote if it is on a different
+ 'object' than the object which 'has' this
+ location. Typically, features on a sequence will sometimes
+ have a remote location, which means that the location of
+ the feature is on a different sequence than the one that is
+ attached to the feature. In such a case, $loc->seq_id will
+ be different from $feat->seq_id (usually they will be the
+ same).
+
+ While this may sound weird, it reflects the location of the
+ kind of AB18375:450-900 which can be found in GenBank/EMBL
+ feature tables.
+
+ Example :
+ Returns : TRUE if the location is a remote location, and FALSE otherwise
+ Args :
+
+
+=cut
+
+has 'is_remote' => (
+ is => 'rw',
+ isa => 'Int',
+);
+
+=head2 flip_strand
+
+ Title : flip_strand
+ Usage : $location->flip_strand();
+ Function: Flip-flop a strand to the opposite
+ Returns : None
+ Args : None
+
+=cut
+
+has 'flip_strand' => (
is => 'ro',
default => sub {
- my ($self) = @_;
- return $self->coordinate_policy->end($self);
- }
+ my ($self) = @_;
+ $self->strand($self->strand * -1);
+ },
);
@@ -138,25 +281,6 @@ requires 'max_start';
requires 'start_pos_type';
-=head2 flip_strand
-
- Title : flip_strand
- Usage : $location->flip_strand();
- Function: Flip-flop a strand to the opposite
- Returns : None
- Args : None
-
-=cut
-
-has 'flip_strand' => (
- is => 'ro',
- default => sub {
- my ($self) = @_;
- $self->strand($self->strand * -1);
- },
-);
-
-
=head2 min_end
Title : min_end
@@ -225,107 +349,6 @@ requires 'end_pos_type';
requires 'seq_id';
-=head2 is_remote
-
- Title : is_remote
- Usage : $is_remote_loc = $loc->is_remote()
- Function: Whether or not a location is a remote location.
-
- A location is said to be remote if it is on a different
- 'object' than the object which 'has' this
- location. Typically, features on a sequence will sometimes
- have a remote location, which means that the location of
- the feature is on a different sequence than the one that is
- attached to the feature. In such a case, $loc->seq_id will
- be different from $feat->seq_id (usually they will be the
- same).
-
- While this may sound weird, it reflects the location of the
- kind of AB18375:450-900 which can be found in GenBank/EMBL
- feature tables.
-
- Example :
- Returns : TRUE if the location is a remote location, and FALSE otherwise
- Args :
-
-
-=cut
-
-requires 'is_remote';
-
-=head2 coordinate_policy
-
- Title : coordinate_policy
- Usage : $policy = $location->coordinate_policy();
- $location->coordinate_policy($mypolicy); # set may not be possible
- Function: Get the coordinate computing policy employed by this object.
-
- See L<Bio::Location::CoordinatePolicyI> for documentation
- about the policy object and its use.
-
- The interface *does not* require implementing classes to
- accept setting of a different policy. The implementation
- provided here does, however, allow to do so.
-
- Implementors of this interface are expected to initialize
- every new instance with a
- L<Bio::Location::CoordinatePolicyI> object. The
- implementation provided here will return a default policy
- object if none has been set yet. To change this default
- policy object call this method as a class method with an
- appropriate argument. Note that in this case only
- subsequently created Location objects will be affected.
-
- Returns : A L<Bio::Location::CoordinatePolicyI> implementing object.
- Args : On set, a L<Bio::Location::CoordinatePolicyI> implementing object.
-
-See L<Bio::Location::CoordinatePolicyI> for more information
-
-
-=cut
-
-requires 'coordinate_policy';
-
-=head2 to_FTstring
-
- Title : to_FTstring
- Usage : my $locstr = $location->to_FTstring()
- Function: returns the FeatureTable string of this location
- Returns : string
- Args : none
-
-=cut
-
-requires 'to_FTstring';
-
-=head2 each_Location
-
- Title : each_Location
- Usage : @locations = $locObject->each_Location($order);
- Function: Conserved function call across Location:: modules - will
- return an array containing the component Location(s) in
- that object, regardless if the calling object is itself a
- single location or one containing sublocations.
- Returns : an array of Bio::LocationI implementing objects
- Args : Optional sort order to be passed to sub_Location() for Splits
-
-=cut
-
-requires 'each_Location';
-
-
-=head2 valid_Location
-
- Title : valid_Location
- Usage : if ($location->valid_location) {...};
- Function: boolean method to determine whether location is considered valid
- (has minimum requirements for a specific LocationI implementation)
- Returns : Boolean value: true if location is valid, false otherwise
- Args : none
-
-=cut
-
-requires 'valid_Location';
--
1.5.3.7
Oops, something went wrong.

0 comments on commit b8039fa

Please sign in to comment.