File Coverage

blib/lib/GenOO/Data/DB/DBIC/Species/Schema/SampleResultBase/v2.pm
Criterion Covered Total %
statement 12 15 80.0
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 23 69.5


line stmt bran cond sub pod time code
1             # POD documentation - main docs before the code
2              
3             =head1 NAME
4              
5             GenOO::Data::DB::DBIC::Species::Schema::SampleResultBase::v2 - DBIC Result class for sequenced reads
6              
7             =head1 SYNOPSIS
8              
9             # This class is not designed to be directly used in a DBIC schema because a
10             # table name is not defined. Rather it serves as a base class to be inherited
11             # by an actual result class to provide a common column structure.
12            
13             # Offers more columns than GenOO::Data::DB::DBIC::Species::Schema::SampleResultBase::v1
14            
15             =head1 DESCRIPTION
16              
17             In High Troughput Sequencing analysis we usually have many db tables with similar
18             structure and columns. DBIx::Class requires each Result class to specify the table name
19             explicitly. This means that we would have to explicitly create a Result class for
20             every db table. For this we created this class (does not specify a table name) which can
21             be inherited by other Result classes and provide a common table structure.
22            
23             The class contains the basic common functionality for database tables that contain
24             sequenced reads. It offers accessor methods for table columns compatible with the
25             rest of the GenOO framework.
26            
27             It consumes the GenOO::Region role.
28            
29             As mentioned above this class should be used through inheritance. The reason for this
30             is that it does not have a specific database table on which it maps. The table used
31             within this class is defined as "Unknown" and should be specified by derived classes.
32            
33             =cut
34              
35             # Let the code begin...
36              
37             package GenOO::Data::DB::DBIC::Species::Schema::SampleResultBase::v2;
38             $GenOO::Data::DB::DBIC::Species::Schema::SampleResultBase::v2::VERSION = '1.5.1';
39              
40             #######################################################################
41             ####################### Load External modules #####################
42             #######################################################################
43 1     1   7 use Modern::Perl;
  1         3  
  1         10  
44 1     1   181 use Moose;
  1         3  
  1         10  
45 1     1   5181 use namespace::autoclean;
  1         2  
  1         8  
46 1     1   62 use MooseX::MarkAsMethods autoclean => 1;
  1         1  
  1         7  
47              
48              
49             #######################################################################
50             ############################ Inheritance ##########################
51             #######################################################################
52             extends 'DBIx::Class::Core';
53              
54              
55             #######################################################################
56             ####################### Interface attributes ######################
57             #######################################################################
58             # The interface attributes section provides Moose like accessors for
59             # the table columns. These methods basically overide those created by
60             # DBIx::Class. The column types are defined at the end of the class in
61             # the "Package Methods" section
62              
63             has 'strand' => (
64             is => 'rw',
65             );
66              
67             has 'rname' => (
68             is => 'rw',
69             );
70              
71             has 'start' => (
72             is => 'rw',
73             );
74              
75             has 'stop' => (
76             is => 'rw',
77             );
78              
79             has 'copy_number' => (
80             is => 'rw',
81             );
82              
83             has 'sequence' => (
84             is => 'rw',
85             );
86              
87             has 'cigar' => (
88             is => 'rw',
89             );
90              
91             has 'mdz' => (
92             is => 'rw',
93             );
94              
95             has 'number_of_mappings' => (
96             is => 'rw',
97             );
98              
99             has 'query_length' => (
100             is => 'rw',
101             );
102              
103             has 'alignment_length' => (
104             is => 'rw',
105             );
106              
107             has 'extra' => (
108             is => 'rw'
109             );
110              
111              
112             #######################################################################
113             ########################## Consumed roles #########################
114             #######################################################################
115             with
116             'GenOO::Region' => {
117             -alias => { mid_position => 'region_mid_position' },
118             -excludes => 'mid_position',
119             },
120             'GenOO::Data::File::SAM::CigarAndMDZ' => {
121             };
122              
123              
124             #######################################################################
125             ######################## Interface Methods ########################
126             #######################################################################
127             sub sequence_length {
128 0     0 0   my ($self) = @_;
129            
130 0 0         return $self->query_length if defined $self->query_length;
131 0           return CORE::length($self->sequence);
132             }
133              
134              
135             #######################################################################
136             ######################### Package Methods #########################
137             #######################################################################
138             __PACKAGE__->table('Unknown');
139              
140             __PACKAGE__->add_columns(
141             'strand', {
142             data_type => 'integer',
143             is_nullable => 0,
144             size => 1
145             },
146             'rname', {
147             data_type => 'varchar',
148             is_nullable => 0,
149             size => 250
150             },
151             'start', {
152             data_type => 'integer',
153             extra => { unsigned => 1 },
154             is_nullable => 0
155             },
156             'stop', {
157             data_type => 'integer',
158             extra => { unsigned => 1 },
159             is_nullable => 0
160             },
161             'copy_number', {
162             data_type => 'integer',
163             default_value => 1,
164             extra => { unsigned => 1 },
165             is_nullable => 0,
166             },
167             'sequence', {
168             data_type => 'varchar',
169             is_nullable => 0,
170             size => 250
171             },
172             'cigar', {
173             data_type => 'varchar',
174             is_nullable => 0,
175             size => 250
176             },
177             'mdz', {
178             data_type => 'varchar',
179             is_nullable => 1,
180             size => 250
181             },
182             'number_of_mappings', {
183             data_type => 'integer',
184             extra => { unsigned => 1 },
185             is_nullable => 1
186             },
187             'query_length', {
188             data_type => 'integer',
189             extra => { unsigned => 1 },
190             is_nullable => 0
191             },
192             'alignment_length', {
193             data_type => 'integer',
194             extra => { unsigned => 1 },
195             is_nullable => 0
196             },
197             );
198              
199              
200             #######################################################################
201             ############################ Finalize #############################
202             #######################################################################
203             __PACKAGE__->meta->make_immutable(inline_constructor => 0);
204              
205             1;