Class: Bio::Bam::Alignment
- Inherits:
-
Object
- Object
- Bio::Bam::Alignment
- Defined in:
- lib/bio-sambamba/alignment.rb
Overview
Class representing an alignment record
Instance Attribute Summary collapse
-
#cigar_string ⇒ Object
readonly
CIGAR string.
-
#flag ⇒ Object
readonly
Bitwise flag.
-
#mapping_quality ⇒ Object
readonly
Mapping quality.
-
#mate_position ⇒ Object
readonly
1-based leftmost position of the mate/next segment.
-
#mate_reference ⇒ Object
readonly
Reference sequence name of the mate/next segment.
-
#position ⇒ Object
readonly
1-based leftmost mapping position.
-
#quality ⇒ Object
readonly
Phred-scaled base quality, an integer array of the same length as the sequence.
-
#read_name ⇒ Object
readonly
Query template name.
-
#reference ⇒ Object
readonly
Name of reference sequence.
-
#sequence ⇒ Object
readonly
Segment sequence.
-
#tags ⇒ Object
readonly
Hash of record tags.
-
#template_length ⇒ Object
readonly
Observed template length.
Instance Method Summary collapse
-
#[](tag) ⇒ Object
Access a record tag.
-
#failed_quality_control ⇒ Object
Not passing quality controls.
-
#initialize(json) ⇒ Alignment
constructor
Creates a new object from JSON output of sambamba tool.
-
#is_duplicate ⇒ Object
PCR or optical duplicate.
-
#is_first_of_pair ⇒ Object
The first segment in the template.
-
#is_paired ⇒ Object
Template having multiple segments in sequencing.
-
#is_reverse_strand ⇒ Object
Sequence being reverse complemented.
-
#is_second_of_pair ⇒ Object
The last segment in the template.
-
#is_secondary_alignment ⇒ Object
Secondary alignment.
-
#is_unmapped ⇒ Object
Segment unmapped.
-
#mate_is_reverse_strand ⇒ Object
Sequence of the next segment in the template being reversed.
-
#mate_is_unmapped ⇒ Object
Next segment in the template unmapped.
-
#proper_pair ⇒ Object
Each segment properly aligned according to the aligner.
Constructor Details
#initialize(json) ⇒ Alignment
Creates a new object from JSON output of sambamba tool
8 9 10 |
# File 'lib/bio-sambamba/alignment.rb', line 8 def initialize(json) @json = json end |
Instance Attribute Details
#cigar_string ⇒ Object (readonly)
CIGAR string
34 35 36 |
# File 'lib/bio-sambamba/alignment.rb', line 34 def cigar_string @cigar_string end |
#flag ⇒ Object (readonly)
Bitwise flag
40 41 42 |
# File 'lib/bio-sambamba/alignment.rb', line 40 def flag @flag end |
#mapping_quality ⇒ Object (readonly)
Mapping quality
31 32 33 |
# File 'lib/bio-sambamba/alignment.rb', line 31 def mapping_quality @mapping_quality end |
#mate_position ⇒ Object (readonly)
1-based leftmost position of the mate/next segment
53 54 55 |
# File 'lib/bio-sambamba/alignment.rb', line 53 def mate_position @mate_position end |
#mate_reference ⇒ Object (readonly)
Reference sequence name of the mate/next segment
50 51 52 |
# File 'lib/bio-sambamba/alignment.rb', line 50 def mate_reference @mate_reference end |
#position ⇒ Object (readonly)
1-based leftmost mapping position
28 29 30 |
# File 'lib/bio-sambamba/alignment.rb', line 28 def position @position end |
#quality ⇒ Object (readonly)
Phred-scaled base quality, an integer array of the same length as the sequence
44 45 46 |
# File 'lib/bio-sambamba/alignment.rb', line 44 def quality @quality end |
#read_name ⇒ Object (readonly)
Query template name
25 26 27 |
# File 'lib/bio-sambamba/alignment.rb', line 25 def read_name @read_name end |
#reference ⇒ Object (readonly)
Name of reference sequence
22 23 24 |
# File 'lib/bio-sambamba/alignment.rb', line 22 def reference @reference end |
#sequence ⇒ Object (readonly)
Segment sequence
47 48 49 |
# File 'lib/bio-sambamba/alignment.rb', line 47 def sequence @sequence end |
#tags ⇒ Object (readonly)
Hash of record tags
19 20 21 |
# File 'lib/bio-sambamba/alignment.rb', line 19 def @tags end |
#template_length ⇒ Object (readonly)
Observed template length
37 38 39 |
# File 'lib/bio-sambamba/alignment.rb', line 37 def template_length @template_length end |
Instance Method Details
#[](tag) ⇒ Object
Access a record tag
13 14 15 16 |
# File 'lib/bio-sambamba/alignment.rb', line 13 def [](tag) raise 'tag length must be two' unless tag.length == 2 @json['tags'][tag] end |
#failed_quality_control ⇒ Object
Not passing quality controls
120 121 122 |
# File 'lib/bio-sambamba/alignment.rb', line 120 def failed_quality_control (flag & 0x200) != 0 end |
#is_duplicate ⇒ Object
PCR or optical duplicate
125 126 127 |
# File 'lib/bio-sambamba/alignment.rb', line 125 def is_duplicate (flag & 0x400) != 0 end |
#is_first_of_pair ⇒ Object
The first segment in the template
105 106 107 |
# File 'lib/bio-sambamba/alignment.rb', line 105 def is_first_of_pair (flag & 0x40) != 0 end |
#is_paired ⇒ Object
Template having multiple segments in sequencing
75 76 77 |
# File 'lib/bio-sambamba/alignment.rb', line 75 def is_paired (flag & 0x1) != 0 end |
#is_reverse_strand ⇒ Object
Sequence being reverse complemented
95 96 97 |
# File 'lib/bio-sambamba/alignment.rb', line 95 def is_reverse_strand (flag & 0x10) != 0 end |
#is_second_of_pair ⇒ Object
The last segment in the template
110 111 112 |
# File 'lib/bio-sambamba/alignment.rb', line 110 def is_second_of_pair (flag & 0x80) != 0 end |
#is_secondary_alignment ⇒ Object
Secondary alignment
115 116 117 |
# File 'lib/bio-sambamba/alignment.rb', line 115 def is_secondary_alignment (flag & 0x100) != 0 end |
#is_unmapped ⇒ Object
Segment unmapped
85 86 87 |
# File 'lib/bio-sambamba/alignment.rb', line 85 def is_unmapped (flag & 0x4) != 0 end |
#mate_is_reverse_strand ⇒ Object
Sequence of the next segment in the template being reversed
100 101 102 |
# File 'lib/bio-sambamba/alignment.rb', line 100 def mate_is_reverse_strand (flag & 0x20) != 0 end |
#mate_is_unmapped ⇒ Object
Next segment in the template unmapped
90 91 92 |
# File 'lib/bio-sambamba/alignment.rb', line 90 def mate_is_unmapped (flag & 0x8) != 0 end |
#proper_pair ⇒ Object
Each segment properly aligned according to the aligner
80 81 82 |
# File 'lib/bio-sambamba/alignment.rb', line 80 def proper_pair (flag & 0x2) != 0 end |