Class: Bio::Bam::SamHeader
- Inherits:
-
Object
- Object
- Bio::Bam::SamHeader
- Includes:
- SambambaStderrParser
- 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
10 11 12 13 |
# File 'lib/bio-sambamba/samheader.rb', line 10 def initialize(filename, opts=[]) @filename = filename @opts = opts end |
Instance Method Details
#pg_lines ⇒ Object
An array of PGLine objects
48 49 50 |
# File 'lib/bio-sambamba/samheader.rb', line 48 def pg_lines @pg_lines ||= obj[4].map{|rec| PGLine.new(rec)} end |
#raw_contents ⇒ Object
Raw text of SAM header
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bio-sambamba/samheader.rb', line 16 def raw_contents if @raw_contents.nil? then cmd = ['sambamba', 'view', '-H', @filename] + @opts Bio::Command.call_command_open3(cmd) do |pin, pout, perr| @raw_contents = pout.read raise_exception_if_stderr_is_not_empty(perr) end end @raw_contents end |
#rg_lines ⇒ Object
An array of RGLine objects
43 44 45 |
# File 'lib/bio-sambamba/samheader.rb', line 43 def rg_lines @rg_lines ||= obj[3].map{|rec| RGLine.new(rec)} end |
#sorting_order ⇒ Object
Sorting order
33 34 35 |
# File 'lib/bio-sambamba/samheader.rb', line 33 def sorting_order obj[1] end |
#sq_lines ⇒ Object
An array of SQLine objects
38 39 40 |
# File 'lib/bio-sambamba/samheader.rb', line 38 def sq_lines @sq_lines ||= obj[2].map{|rec| SQLine.new(rec)} end |
#version ⇒ Object
Format version
28 29 30 |
# File 'lib/bio-sambamba/samheader.rb', line 28 def version obj[0] end |