Skip to main content

refget_model/
sequence.rs

1//! Sequence metadata types for the refget Sequences API.
2
3use serde::{Deserialize, Serialize};
4
5/// A naming authority alias for a sequence.
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct Alias {
8    /// The naming authority (e.g. "insdc", "ensembl").
9    pub naming_authority: String,
10    /// The identifier value within that authority.
11    pub value: String,
12}
13
14/// Metadata for a single sequence, as returned by the `/sequence/{digest}/metadata` endpoint.
15#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
16pub struct SequenceMetadata {
17    /// MD5 hex digest of the sequence.
18    pub md5: String,
19    /// GA4GH sha512t24u digest of the sequence.
20    #[serde(rename = "ga4gh")]
21    pub sha512t24u: String,
22    /// Length of the sequence in bases.
23    pub length: u64,
24    /// Known aliases for this sequence.
25    pub aliases: Vec<Alias>,
26    /// Whether this sequence is circular (e.g. mitochondrial genome, bacterial chromosome).
27    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
28    pub circular: bool,
29}