class Bio::FastQC::Semantics
Public Class Methods
new(fastqc_object, id: nil, runid: nil, tiny: true)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 8 def initialize(fastqc_object, id: nil, runid: nil, tiny: true) @id = id @runid = runid @tiny = tiny @fastqc_object = fastqc_object end
Public Instance Methods
adapter_content()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 497 def adapter_content {} end
base_stat_class(base)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 136 def base_stat_class(base) case base when /-/ # when the base position is range like "50-100" "BaseRangeStatistics" else "ExactBaseStatistics" end end
encoding()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 163 def encoding { "encoding" => @fastqc_object[:encoding], } end
fastqc_version()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 145 def fastqc_version { "fastqcVersion" => @fastqc_object[:fastqc_version], } end
file_type()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 157 def file_type { "fileType" => @fastqc_object[:file_type], } end
filename()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 151 def filename { "filename" => @fastqc_object[:filename], } end
filtered_sequences()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 180 def filtered_sequences { "@type" => "filteredSequences", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:filtered_sequences], "@type" => "xsd:integer", } } end
identifier_literal()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 58 def identifier_literal @id ? @id : "QNT_" + @fastqc_object[:filename].split(".")[0] end
identifier_uri()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 62 def identifier_uri "quanto:" + identifier_literal end
json_ld_object()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 42 def json_ld_object object = [object_core, static_value_modules, object_modules].flatten.inject(&:merge) if !@tiny object["hasMatrix"] = matrix_modules end object end
jsonld_context()
click to toggle source
Generate JSON-LD context object
# File lib/bio/fastqc/semantics.rb, line 620 def jsonld_context # definition of imported terms in @context object = turtle_prefixes # definition of local ontology terms pfx = "sos:" # definition of class in @context sos_class.each do |term| object[term] = {} object[term]["@id"] = pfx + term object[term]["@type"] = "@id" end # definition of object properties in @context sos_object_properties.each do |term| object[term] = {} object[term]["@id"] = pfx + term object[term]["@type"] = "@id" end sos_data_properties_string.each do |term| object[term] = {} object[term]["@id"] = pfx + term object[term]["@type"] = "http://www.w3.org/2001/XMLSchema#string" end sos_data_properties_integer.each do |term| object[term] = {} object[term]["@id"] = pfx + term object[term]["@type"] = "http://www.w3.org/2001/XMLSchema#integer" end sos_data_properties_float.each do |term| object[term] = {} object[term]["@id"] = pfx + term object[term]["@type"] = "http://www.w3.org/2001/XMLSchema#float" end object end
kmer_content()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 501 def kmer_content { "@type" => "KmerContent", "hasRow" => kmer_content_rows(@fastqc_object[:kmer_content]), } end
kmer_content_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 508 def kmer_content_rows(matrix) matrix.map.with_index do |row, i| sequence = row[0] count = row[1] ratio_overall = row[2] ratio_max = row[3] ratio_max_position = row[4] { "@type" => "Row", "rowIndex" => i, "kmerSequence" => sequence, "sequenceReadCount" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => count, }, "observedPerExpectedOverall" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:Ratio" }, "sio:SIO_000300" => ratio_overall, }, "observedPerExpectedMax" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:Ratio" }, "sio:SIO_000300" => ratio_max, }, "observedPerExpectedMaxPosition" => ratio_max_position, } end end
matrix_modules()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 120 def matrix_modules [ per_base_sequence_quality, per_tile_sequence_quality, per_sequence_quality_scores, per_base_sequence_content, per_sequence_gc_content, per_base_n_content, sequence_length_distribution, sequence_duplication_levels, overrepresented_sequences, adapter_content, kmer_content, ] end
max_length()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 550 def max_length { "@type" => "maxSequenceLength", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:max_length], "@type" => "xsd:integer", }, } end
mean_sequence_length()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 561 def mean_sequence_length { "@type" => "meanSequenceLength", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:mean_sequence_length], "@type" => "xsd:decimal", }, } end
median_sequence_length()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 572 def median_sequence_length { "@type" => "medianSequenceLength", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:median_sequence_length], "@type" => "xsd:decimal", }, } end
min_length()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 539 def min_length { "@type" => "minimumSequenceLength", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:min_length], "@type" => "xsd:integer", }, } end
object_core()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 66 def object_core { "@context" => jsonld_context, "@id" => identifier_uri, "@type" => "SequenceStatisticsReport", "dcterms:identifier" => identifier_literal, "dcterms:contributor" => ["Tazro Ohta", "Shuichi Kawashima"], "dcterms:created" => { "@value" => Time.now.strftime("%Y-%m-%d"), "@type" => "xsd:date" }, "dcterms:license" => { "@id" => "http://creativecommons.org/licenses/by-sa/4.0/", }, "dcterms:publisher" => { "@id" => "http://dbcls.rois.ac.jp/", }, "pav:version" => rdf_version, "foaf:page" => { "@id" => "http://quanto.dbcls.jp", }, "rdfs:seeAlso" => { "@id" => "http://identifiers.org/insdc.sra/" + sra_identifier, }, } end
object_modules()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 102 def object_modules { "sio:SIO_000216" => [ total_sequences, filtered_sequences, percent_gc, #total_duplicate_percentage, min_length, max_length, overall_mean_quality_score, overall_median_quality_score, overall_n_content, mean_sequence_length, median_sequence_length, ] } end
overall_mean_quality_score()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 583 def overall_mean_quality_score { "@type" => "meanBaseCallQuality", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:overall_mean_quality_score], "@type" => "xsd:decimal", }, } end
overall_median_quality_score()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 594 def overall_median_quality_score { "@type" => "medianBaseCallQuality", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:overall_median_quality_score], "@type" => "xsd:decimal", }, } end
overall_n_content()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 605 def overall_n_content { "@type" => "nContent", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:overall_n_content], "@type" => "xsd:decimal", }, } end
overrepresented_sequences()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 465 def overrepresented_sequences { "@type" => "OverrepresentedSequences", "hasRow" => overrepresented_sequences_rows(@fastqc_object[:overrepresented_sequences]), } end
overrepresented_sequences_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 472 def overrepresented_sequences_rows(matrix) matrix.map.with_index do |row, i| sequence = row[0] count = row[1] percentage = row[2] possible_source = row[3] { "@type" => "Row", "rowIndex" => i, "overrepresentedSequence" => sequence, "sequenceReadCount" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => count, }, "sequenceReadPercentage" => { "@type" => "SequenceReadRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => percentage, }, "possibleSourceOfSequence" => possible_source, } end end
per_base_n_content()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 376 def per_base_n_content { "@type" => "PerBaseNContent", "hasRow" => per_base_n_content_rows(@fastqc_object[:per_base_n_content]), } end
per_base_n_content_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 383 def per_base_n_content_rows(matrix) matrix.map.with_index do |row, i| base = row[0] n_count = row[1] { "@type" => [ "Row", base_stat_class(base), ], "rowIndex" => i, "basePosition" => base, "nCount" => { "@type" => "BaseRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => n_count, }, } end end
per_base_sequence_content()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 303 def per_base_sequence_content { "@type" => "PerBaseSequenceContent", "hasRow" => per_base_sequence_content_rows(@fastqc_object[:per_base_sequence_content]), } end
per_base_sequence_content_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 310 def per_base_sequence_content_rows(matrix) matrix.map.with_index do |row, i| base = row[0] guanine = row[1] adenine = row[2] thymine = row[3] chytosine = row[4] { "@type" => [ "Row", base_stat_class(base), ], "rowIndex" => i, "basePosition" => base, "percentGuanine" => { "@type" => "BaseRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => guanine, }, "percentAdenine" => { "@type" => "BaseRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => adenine, }, "percentThymine" => { "@type" => "BaseRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => thymine, }, "percentCytosine" => { "@type" => "BaseRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => chytosine, }, } end end
per_base_sequence_quality()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 213 def per_base_sequence_quality { "@type" => "PerBaseSequenceQuality", "hasRow" => per_base_sequence_quality_rows(@fastqc_object[:per_base_sequence_quality]), } end
per_base_sequence_quality_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 220 def per_base_sequence_quality_rows(matrix) matrix.map.with_index do |row, i| base = row[0] mean = row[1] median = row[2] lower_quartile = row[3] upper_quartile = row[4] tenth_percentile = row[5] ninetieth_percentile = row[6] { "@type" => [ "Row", base_stat_class(base), ], "rowIndex" => i, "basePosition" => base, "meanBaseCallQuality" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => mean, }, "medianBaseCallQuality" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => median, }, "baseCallQualityLowerQuartile" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => lower_quartile, }, "baseCallQualityUpperQuartile" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => upper_quartile, }, "baseCallQuality10thPercentile" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => tenth_percentile, }, "baseCallQuality90thPercentile" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => ninetieth_percentile, }, } end end
per_sequence_gc_content()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 348 def per_sequence_gc_content { "@type" => "PerSequenceGCContent", "hasRow" => per_sequence_gc_content_rows(@fastqc_object[:per_sequence_gc_content]), } end
per_sequence_gc_content_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 355 def per_sequence_gc_content_rows(matrix) matrix.map.with_index do |row, i| gc_content = row[0] count = row[1] { "@type" => "Row", "rowIndex" => i, "percentGC" => { "@type" => "BaseRatio", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => gc_content, }, "sequenceReadCount" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => count, }, } end end
per_sequence_quality_scores()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 275 def per_sequence_quality_scores { "@type" => "PerSequnceQualityScores", "hasRow" => per_sequence_quality_scores_rows(@fastqc_object[:per_sequence_quality_scores]), } end
per_sequence_quality_scores_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 282 def per_sequence_quality_scores_rows(matrix) matrix.map.with_index do |row, i| quality = row[0] count = row[1] { "@type" => "Row", "rowIndex" => i, "baseCallQuality" => { "@type" => "PhredQualityScore", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => quality, }, "sequenceReadCount" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => count, }, } end end
per_tile_sequence_quality()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 271 def per_tile_sequence_quality {} end
percent_gc()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 202 def percent_gc { "@type" => "percentGC", "sio:SIO_000221" => { "@id" => "obo:UO_0000187" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:percent_gc], "@type" => "xsd:decimal", } } end
rdf_version()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 15 def rdf_version "0.2.0" end
sequence_duplication_levels()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 436 def sequence_duplication_levels { "@type" => "SequenceDuplicationLevels", "hasRow" => sequence_duplication_levels_rows(@fastqc_object[:sequence_duplication_levels]), } end
sequence_duplication_levels_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 443 def sequence_duplication_levels_rows(matrix) matrix.map.with_index do |row, i| duplication_level = row[0] relative_count = row[1] { "@type" => "Row", "rowIndex" => i, "sequenceDuplicationLevel" => { "@type" => "SequenceDuplicationLevel", "sio:SIO_000221" => { "@id" => "obo:UO_0000189" }, "sio:SIO_000300" => duplication_level, }, "sequenceReadRelativeCount" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => relative_count, }, } end end
sequence_length()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 191 def sequence_length { "@type" => "SequenceReadLength", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:sequence_length], "@type" => "xsd:string", } } end
sequence_length_distribution()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 403 def sequence_length_distribution { "@type" => "SequenceLengthDistribution", "hasRow" => sequence_length_distribution_rows(@fastqc_object[:sequence_length_distribution]), } end
sequence_length_distribution_rows(matrix)
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 410 def sequence_length_distribution_rows(matrix) matrix.map.with_index do |row, i| length = row[0] count = row[1] { "@type" => "Row", "rowIndex" => i, "sequenceReadLength" => { "@type" => "SequenceReadLength", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => length, }, "sequenceReadCount" => { "@type" => "SequenceReadAmount", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => count, }, } end end
sos_class()
click to toggle source
definition of classes
# File lib/bio/fastqc/semantics.rb, line 666 def sos_class [ sos_class_general, sos_class_fastqc_modules, sos_class_for_values, ].flatten end
sos_class_fastqc_modules()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 684 def sos_class_fastqc_modules [ "PerBaseSequenceQuality", "PerTileSequenceQuality", "PerSequnceQualityScores", "PerBaseSequenceContent", "PerSequenceGCContent", "PerBaseNContent", "SequenceLengthDistribution", "SequenceDuplicationLevels", "OverrepresentedSequences", "KmerContent", ] end
sos_class_for_values()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 699 def sos_class_for_values [ "PhredQualityScore", "BaseRatio", "SequenceReadAmount", "SequenceReadRatio", "SequenceReadLength", "SequenceDuplicationLevel", "nContent", "percentGC", "medianBaseCallQuality", "meanBaseCallQuality", "totalSequences", "filteredSequences", "minimumSequenceLength", "maxSequenceLength", "meanSequenceLength", "medianSequenceLength", ] end
sos_class_general()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 674 def sos_class_general [ "SequenceStatisticsReport", "SequenceStatisticsMatrix", "Row", "ExactBaseStatistics", "BaseRangeStatistics", ] end
sos_data_properties_float()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 773 def sos_data_properties_float [ "baseCallQuality", "baseCallQuality10thPercentile", "baseCallQuality90thPercentile", "baseCallQualityLowerQuartile", "baseCallQualityUpperQuartile", "minSequenceLength", "maxSequenceLength", "meanSequenceLength", "medianSequenceLength", ] end
sos_data_properties_integer()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 767 def sos_data_properties_integer [ "rowIndex", ] end
sos_data_properties_string()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 756 def sos_data_properties_string [ "fastqcVersion", "filename", "fileType", "encoding", "possibleSourceOfSequence", "overrepresentedSequence", ] end
sos_object_properties()
click to toggle source
definition of predicates
# File lib/bio/fastqc/semantics.rb, line 724 def sos_object_properties [ "hasMatrix", "totalSequences", "filteredSequences", "sequenceLength", "percentGC", "hasRow", "basePosition", "kmerSequence", "meanBaseCallQuality", "medianBaseCallQuality", "nCount", "observedPerExpectedMax", "observedPerExpectedMaxPosition", "observedPerExpectedOverall", "percentAdenine", "percentCytosine", "percentGC", "percentGuanine", "percentThymine", "sequenceDuplicationLevel", "sequenceReadCount", "sequenceReadLength", "sequenceReadPercentage", "sequenceReadRelativeCount", "overallMeanBaseCallQuality", "overallMedianBaseCallQuality", "overallNContent", ] end
sra_identifier()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 54 def sra_identifier @runid ? @runid : @fastqc_object[:filename].split(".")[0].split("_")[0] end
static_value_modules()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 93 def static_value_modules [ fastqc_version, filename, file_type, encoding, ] end
total_duplicate_percentage()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 432 def total_duplicate_percentage {} end
total_sequences()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 169 def total_sequences { "@type" => "totalSequences", "sio:SIO_000221" => { "@id" => "obo:UO_0000244" }, "sio:SIO_000300" => { "@value" => @fastqc_object[:total_sequences], "@type" => "xsd:integer", }, } end
turtle()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 19 def turtle turtle_graph.dump(:ttl, prefixes: turtle_prefixes) end
turtle_graph()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 23 def turtle_graph RDF::Graph.new << JSON::LD::API.toRdf(json_ld_object) end
turtle_prefixes()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 27 def turtle_prefixes { "obo" => "http://purl.obolibrary.org/obo/", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs" => "http://www.w3.org/2000/01/rdf-schema#", "dcterms" => "http://purl.org/dc/terms/", "pav" => "http://purl.org/pav/", "foaf" => "http://xmlns.com/foaf/0.1/", "sos" => "http://purl.jp/bio/10/quanto/ontology/sos#", "quanto" => "http://purl.jp/bio/10/quanto/resource/", "sio" => "http://semanticscience.org/resource/", "xsd" => "http://www.w3.org/2001/XMLSchema#", } end
uri_base()
click to toggle source
# File lib/bio/fastqc/semantics.rb, line 50 def uri_base "http://purl.jp/bio/01/quanto" end