Module: BEL::Gen::Nanopub

Includes:
Annotation, Citation, DocumentHeader, Namespace, Parameter, Statement, Term
Defined in:
lib/bel/gen/nanopub.rb

Overview

The Nanopub module defines methods that generate random nanopubs.

Constant Summary

Constants included from Term

Term::FUNCTIONS

Constants included from Namespace

BEL::Gen::Namespace::NAMESPACES

Constants included from Statement

Statement::RELATIONSHIPS

Constants included from Annotation

Annotation::ANNOTATIONS

Instance Method Summary collapse

Methods included from Term

#bel_term, #function

Methods included from Parameter

#bel_parameter, #bel_parameter_with_namespace, #bel_parameter_without_namespace

Methods included from Namespace

#namespace, #referenced_namespaces

Methods included from Statement

#bel_statement, #relationship

Methods included from Citation

#citation, #citation_authors, #citation_comment, #citation_date, #citation_id, #citation_name, #citation_type

Methods included from Annotation

#annotation, #referenced_annotations

Methods included from DocumentHeader

#document_authors, #document_contact_info, #document_copyright, #document_description, #document_header, #document_licenses, #document_name, #document_version

Instance Method Details

#nanopubBEL::Nanopub::Nanopub

Returns a random Nanopub::Nanopub.

Returns:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/bel/gen/nanopub.rb', line 32

def nanopub
  nanopub = BEL::Nanopub::Nanopub.new

  nanopub.bel_statement      = bel_statement
  nanopub.citation           = citation
  nanopub.support            = BEL::Nanopub::Support.new(
    Rantly { sized(120) {string(:alpha)} }
  )
  nanopub.experiment_context = BEL::Nanopub::ExperimentContext.new(
    (1..5).to_a.sample.times.map { annotation }
  )
  nanopub.references         = BEL::Nanopub::References.new({
    :namespaces  => referenced_namespaces.map { |prefix, ns_def|
      {
        :keyword => prefix,
        :uri     => ns_def.url
      }
    }.sort_by { |ns| ns[:keyword] },
    :annotations => referenced_annotations.map { |keyword, anno_def|
      {
        :keyword => keyword,
        :type    => :uri,
        :domain  => anno_def.url
      }
    }
  })
  nanopub.           = BEL::Nanopub::Metadata.new({
    :document_header => document_header
  })

  nanopub
end