Class: Rafflesia::Annotations

Inherits:
Object
  • Object
show all
Defined in:
lib/rafflesia/annotations.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Annotations

Returns a new instance of Annotations.



9
10
11
# File 'lib/rafflesia/annotations.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#mappingsImport(database:, mapping_family:, release:, auxiliary_input_object_id: nil, auxiliary_path: nil, batch_rows: nil, checkpoint_path: nil, format: nil, input_object_id: nil, output_dir: nil, path: nil, relation: nil, resume: nil, source_doi: nil, source_layout: nil, source_record_id: nil, source_url: nil, timeout_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeRelationImportData

POST /v1/annotations/mappings/import

Parameters:

  • auxiliary_input_object_id (String, nil) (defaults to: nil)

    Content-addressed auxiliary source artifact. Pass either auxiliary_input_object_id or auxiliary_path.

  • auxiliary_path (String, nil) (defaults to: nil)

    Optional second pinned source path required by a composite official layout, currently the OMA-to-UniProt mapping for oma_pairwise.

  • batch_rows (Integer, nil) (defaults to: nil)

    Rows per durable normalization checkpoint part. Defaults to 50000 for raw official layouts.

  • checkpoint_path (String, nil) (defaults to: nil)

    Explicit raw-layout normalization checkpoint path. Defaults below output_dir.

  • database (String)

    Logical database or curated source name.

  • format (Rafflesia::Types::AnnotationMappingImportRequestFormat, nil) (defaults to: nil)

    Input file format; auto infers from extension.

  • input_object_id (String, nil) (defaults to: nil)

    Content-addressed source artifact returned by datasets source-snapshots fetch. Pass either input_object_id or path.

  • mapping_family (String)

    Curated mapping family, for example pdb_chain_uniprot_mapping.

  • output_dir (String, nil) (defaults to: nil)

    Directory for bounded normalization parts, checkpoint, and final relation artifact.

  • path (String, nil) (defaults to: nil)

    Local source path. Pass either path or input_object_id.

  • relation (String, nil) (defaults to: nil)

    Logical relation name; defaults from mapping_family.

  • release (String)

    Immutable database release or curation version.

  • resume (Boolean, nil) (defaults to: nil)

    Resume raw-layout normalization after verifying the immutable source hash and checkpoint parameters.

  • source_doi (String, nil) (defaults to: nil)

    Source paper DOI recorded in provenance.

  • source_layout (Rafflesia::Types::AnnotationMappingImportRequestSourceLayout, nil) (defaults to: nil)

    Physical source layout. Raw official source files are normalized into canonical logical relations.

  • source_record_id (String, nil) (defaults to: nil)

    Source repository or archive record id recorded in provenance.

  • source_url (String, nil) (defaults to: nil)

    Source paper or data URL recorded in provenance.

  • timeout_ms (Integer, nil) (defaults to: nil)

    Optional import timeout in milliseconds.

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rafflesia/annotations.rb', line 34

def mappingsImport(
  database:,
  mapping_family:,
  release:,
  auxiliary_input_object_id: nil,
  auxiliary_path: nil,
  batch_rows: nil,
  checkpoint_path: nil,
  format: nil,
  input_object_id: nil,
  output_dir: nil,
  path: nil,
  relation: nil,
  resume: nil,
  source_doi: nil,
  source_layout: nil,
  source_record_id: nil,
  source_url: nil,
  timeout_ms: nil,
  request_options: {}
)
  body = {
    'auxiliary_input_object_id' => auxiliary_input_object_id,
    'auxiliary_path' => auxiliary_path,
    'batch_rows' => batch_rows,
    'checkpoint_path' => checkpoint_path,
    'database' => database,
    'format' => format,
    'input_object_id' => input_object_id,
    'mapping_family' => mapping_family,
    'output_dir' => output_dir,
    'path' => path,
    'relation' => relation,
    'release' => release,
    'resume' => resume,
    'source_doi' => source_doi,
    'source_layout' => source_layout,
    'source_record_id' => source_record_id,
    'source_url' => source_url,
    'timeout_ms' => timeout_ms
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/annotations/mappings/import',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeRelationImportData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#mappingsMap(from_id:, to_ref:, allow_network: nil, sources: nil, request_options: {}) ⇒ Rafflesia::EnvelopeAnnotationMapData

POST /v1/annotations/mappings/map

Parameters:

  • allow_network (Boolean, nil) (defaults to: nil)

    Allow network fetch of source annotations when not cached.

  • from_id (String)

    Source identifier whose annotations are mapped, e.g. uniprot:P38398.

  • sources (Array<String>, nil) (defaults to: nil)

    Annotation sources to map; empty maps input ids only.

  • to_ref (String)

    Target reference/coordinate system to map onto, e.g. structure:sha256:...

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/rafflesia/annotations.rb', line 94

def mappingsMap(
  from_id:,
  to_ref:,
  allow_network: nil,
  sources: nil,
  request_options: {}
)
  body = {
    'allow_network' => allow_network,
    'from_id' => from_id,
    'sources' => sources,
    'to_ref' => to_ref
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/annotations/mappings/map',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeAnnotationMapData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#sourcesFetch(allow_network: nil, ids: nil, sources: nil, target_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeAnnotationFetchData

POST /v1/annotations/sources/fetch

Parameters:

  • allow_network (Boolean, nil) (defaults to: nil)
  • ids (Array<String>, nil) (defaults to: nil)
  • sources (Array<String>, nil) (defaults to: nil)
  • target_id (String, nil) (defaults to: nil)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/rafflesia/annotations.rb', line 126

def sourcesFetch(
  allow_network: nil,
  ids: nil,
  sources: nil,
  target_id: nil,
  request_options: {}
)
  body = {
    'allow_network' => allow_network,
    'ids' => ids,
    'sources' => sources,
    'target_id' => target_id
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/annotations/sources/fetch',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeAnnotationFetchData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end