Module: BEL::Gen::SampleResources
- Includes:
- Annotation
- Defined in:
- lib/bel/gen/sample_resources.rb
Overview
The SampleResources module defines methods that sample data from actual resources.
BEL parameters are sampled from a Namespace::NamespaceDefinition.
Annotations are sampled from a Annotation::AnnotationDefinition.
Constant Summary
Constants included from Annotation
Instance Method Summary collapse
-
#annotation ⇒ Hash
Returns a sampled annotation as a hash of
:name
and:value
. -
#bel_parameter_with_namespace ⇒ BEL::Nanopub::Parameter
Returns a BEL parameter with a value sampled from a random namespace.
Methods included from Annotation
Instance Method Details
#annotation ⇒ Hash
Returns a sampled annotation as a hash of :name
and :value
. These can be added directly to a nanopubs’s Nanopub::ExperimentContext.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bel/gen/sample_resources.rb', line 21 def annotation # pick annotation definition anno = Rantly { choose(*ANNOTATIONS) } # track annotation definitions referenced_annotations[anno.keyword] = anno { :name => anno.keyword, :value => anno.values.keys.sample } end |
#bel_parameter_with_namespace ⇒ BEL::Nanopub::Parameter
Returns a BEL parameter with a value sampled from a random namespace.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bel/gen/sample_resources.rb', line 40 def bel_parameter_with_namespace ns = namespace value = ns.values.keys.sample enc = ns.values[value] BEL::Nanopub::Parameter.new( ns, value, enc ) end |