Class: Bio::Bam::SamHeader
- Inherits:
-
Object
- Object
- Bio::Bam::SamHeader
- Defined in:
- lib/bio-sambamba/samheader.rb
Overview
Represents SAM header
Instance Method Summary collapse
-
#initialize(filename, opts = []) ⇒ SamHeader
constructor
Creates a new SamHeader object for a specified file, specifying additional options to pass to sambamba tool.
-
#pg_lines ⇒ Object
An array of PGLine objects.
-
#raw_contents ⇒ Object
Raw text of SAM header.
-
#rg_lines ⇒ Object
An array of RGLine objects.
-
#sorting_order ⇒ Object
Sorting order.
-
#sq_lines ⇒ Object
An array of SQLine objects.
-
#version ⇒ Object
Format version.
Constructor Details
#initialize(filename, opts = []) ⇒ SamHeader
Creates a new SamHeader object for a specified file, specifying additional options to pass to sambamba tool
9 10 11 12 |
# File 'lib/bio-sambamba/samheader.rb', line 9 def initialize(filename, opts=[]) @filename = filename @opts = opts end |
Instance Method Details
#pg_lines ⇒ Object
An array of PGLine objects
50 51 52 53 |
# File 'lib/bio-sambamba/samheader.rb', line 50 def pg_lines @json ||= get_json @sq_lines ||= @json['pg_lines'].map{|json| PGLine.new(json)} end |
#raw_contents ⇒ Object
Raw text of SAM header
15 16 17 18 19 20 21 22 23 |
# File 'lib/bio-sambamba/samheader.rb', line 15 def raw_contents if @raw_contents.nil? then @raw_contents = Bio::Command.query_command(['sambamba', '-H', @filename] + @opts) if @raw_contents.start_with? "sambamba" then raise @raw_contents end end @raw_contents end |
#rg_lines ⇒ Object
An array of RGLine objects
44 45 46 47 |
# File 'lib/bio-sambamba/samheader.rb', line 44 def rg_lines @json ||= get_json @sq_lines ||= @json['rg_lines'].map{|json| RGLine.new(json)} end |
#sorting_order ⇒ Object
Sorting order
32 33 34 35 |
# File 'lib/bio-sambamba/samheader.rb', line 32 def sorting_order @json ||= get_json @json['sorting_order'] end |
#sq_lines ⇒ Object
An array of SQLine objects
38 39 40 41 |
# File 'lib/bio-sambamba/samheader.rb', line 38 def sq_lines @json ||= get_json @sq_lines ||= @json['sq_lines'].map{|json| SQLine.new(json)} end |
#version ⇒ Object
Format version
26 27 28 29 |
# File 'lib/bio-sambamba/samheader.rb', line 26 def version @json ||= get_json @json['format_version'] end |