Sha256: 155b00d5e0059d3f48cfa56e8e1bc322ca69d15b1bde2185142a9befb4c7b5eb
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'digest/sha1' module BioInterchange::Genomics class GFF3FeatureSet # Create a new instance of a Generic Feature Format Version 3 (GFF3) feature set. A feature # set can contain multiple GFF3 features. def initialize # Features are stored as the keys of a hash map to increase performance: @set = {} end # Returns the contents of the feature set. def contents @set.keys end # Returns an URI for this particular feature set, which is a SHA1 hash over the content's concatenated properties. def uri clob = '' contents.each { |feature| clob << "#{feature.sequence_id}\t#{feature.source}\t#{feature.type}\t#{feature.start_coordinate}\t#{feature.end_coordinate}\t#{feature.score}\t#{feature.strand}\t#{feature.phase}\t#{feature.attributes.keys.map { |tag| "#{tag}=#{feature.attributes[tag]}" }.join(';')}\n" } "biointerchange://gff3/featureset/self/#{Digest::SHA1.hexdigest(clob)}" end # Adds a feature to the feature set. # # +feature+:: feature instance that is added to the contents of this feature set def add(feature) @set[feature] = true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
biointerchange-0.1.2 | lib/biointerchange/genomics/gff3_feature_set.rb |
biointerchange-0.1.0 | lib/biointerchange/genomics/gff3_feature_set.rb |