line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
GenOOx::Data::File::SAMstar::Record - Represents a record of a SAM format file generated by STAR |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Object representing a record of a sam file |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# To initialize |
12
|
|
|
|
|
|
|
my $sam_record = GenOOx::Data::File::SAMstar::Record->new( |
13
|
|
|
|
|
|
|
fields => [qname,flag, rname, pos, mapq, cigar, |
14
|
|
|
|
|
|
|
rnext, pnext, tlen, seq, qual, tags] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This object represents a record of a sam file generated by STAR and offers methods for accessing the different |
21
|
|
|
|
|
|
|
attributes. It implements several additional methods that transform original attributes in more manageable |
22
|
|
|
|
|
|
|
attributes. eg. from the FLAG attribute the actual strand is extracted etc. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 EXAMPLES |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Check if the record corresponds to a match |
27
|
|
|
|
|
|
|
my $mapped = $sam_record->is_mapped; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Check if the record corresponds to a non match |
30
|
|
|
|
|
|
|
my $unmapped = $sam_record->is_unmapped; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Parse the FLAG attribute and return 1 or -1 for the strand |
33
|
|
|
|
|
|
|
my $strand = $sam_record->strand; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Let the code begin... |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package GenOOx::Data::File::SAMstar::Record; |
40
|
|
|
|
|
|
|
$GenOOx::Data::File::SAMstar::Record::VERSION = '0.0.3'; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
####################################################################### |
43
|
|
|
|
|
|
|
####################### Load External modules ##################### |
44
|
|
|
|
|
|
|
####################################################################### |
45
|
1
|
|
|
1
|
|
9974
|
use Moose; |
|
1
|
|
|
|
|
403813
|
|
|
1
|
|
|
|
|
9
|
|
46
|
1
|
|
|
1
|
|
7703
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1512
|
|
|
1
|
|
|
|
|
5
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
####################################################################### |
50
|
|
|
|
|
|
|
############################ Inheritance ########################## |
51
|
|
|
|
|
|
|
####################################################################### |
52
|
|
|
|
|
|
|
extends 'GenOO::Data::File::SAM::Record'; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
####################################################################### |
56
|
|
|
|
|
|
|
######################## Interface Methods ######################## |
57
|
|
|
|
|
|
|
####################################################################### |
58
|
|
|
|
|
|
|
sub number_of_mappings { |
59
|
3
|
|
|
3
|
0
|
3882
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
23
|
return $self->tag('NH:i'); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub is_uniquelly_mapped { |
65
|
3
|
|
|
3
|
0
|
1199
|
my ($self) = @_; |
66
|
|
|
|
|
|
|
|
67
|
3
|
50
|
|
|
|
19
|
return 0 if $self->is_unmapped; |
68
|
3
|
100
|
|
|
|
209
|
return 1 if $self->mapq == 255; |
69
|
2
|
|
|
|
|
107
|
return 0; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub is_primary_alignment { |
73
|
3
|
|
|
3
|
0
|
1263
|
my ($self) = @_; |
74
|
|
|
|
|
|
|
|
75
|
3
|
50
|
|
|
|
22
|
return 0 if $self->is_unmapped; |
76
|
3
|
100
|
|
|
|
211
|
return 0 if $self->flag & 256; |
77
|
2
|
|
|
|
|
110
|
return 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub is_secondary_alignment { |
81
|
3
|
|
|
3
|
0
|
1383
|
my ($self) = @_; |
82
|
|
|
|
|
|
|
|
83
|
3
|
50
|
|
|
|
19
|
return 0 if $self->is_unmapped; |
84
|
3
|
100
|
|
|
|
213
|
return 1 if $self->flag & 256; |
85
|
2
|
|
|
|
|
108
|
return 0; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
####################################################################### |
90
|
|
|
|
|
|
|
############################ Finalize ############################# |
91
|
|
|
|
|
|
|
####################################################################### |
92
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |