Class: Bio::FastQC::IO
- Inherits:
-
Object
- Object
- Bio::FastQC::IO
- Defined in:
- lib/bio/fastqc/io.rb
Instance Method Summary collapse
-
#initialize(fastqc_object, id: nil) ⇒ IO
constructor
A new instance of IO.
- #write(output_file, format) ⇒ Object
- #write_json(output_file) ⇒ Object
- #write_jsonld(output_file) ⇒ Object
- #write_tsv(output_file) ⇒ Object
- #write_ttl(output_file) ⇒ Object
Constructor Details
#initialize(fastqc_object, id: nil) ⇒ IO
Returns a new instance of IO.
8 9 10 11 |
# File 'lib/bio/fastqc/io.rb', line 8 def initialize(fastqc_object, id: nil) @fastqc_object = fastqc_object @id = id end |
Instance Method Details
#write(output_file, format) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bio/fastqc/io.rb', line 13 def write(output_file, format) case format when "json" write_json(output_file) when "json-ld", "jsonld" write_jsonld(output_file) when "turtle", "ttl" write_ttl(output_file) when "tsv" write_tsv(output_file) end end |
#write_json(output_file) ⇒ Object
26 27 28 29 |
# File 'lib/bio/fastqc/io.rb', line 26 def write_json(output_file) json = Converter.new(@fastqc_object, id: @id).to_json open(output_file, 'w'){|file| file.puts(json) } end |
#write_jsonld(output_file) ⇒ Object
31 32 33 34 |
# File 'lib/bio/fastqc/io.rb', line 31 def write_jsonld(output_file) jsonld = Converter.new(@fastqc_object, id: @id).to_jsonld open(output_file, 'w'){|file| file.puts(jsonld) } end |
#write_tsv(output_file) ⇒ Object
45 46 47 48 |
# File 'lib/bio/fastqc/io.rb', line 45 def write_tsv(output_file) tsv = Converter.new(@fastqc_object, id: @id).to_tsv open(output_file, 'w'){|file| file.puts(tsv) } end |
#write_ttl(output_file) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/bio/fastqc/io.rb', line 36 def write_ttl(output_file) semantics = Semantics.new(@fastqc_object, id: @id) graph = semantics.turtle_graph prefixes = semantics.turtle_prefixes RDF::Turtle::Writer.open(output_file, prefixes: prefixes) do |writer| writer << graph end end |