1#![allow(clippy::redundant_closure_call)]
2#![allow(clippy::needless_lifetimes)]
3#![allow(clippy::match_single_binding)]
4#![allow(clippy::clone_on_copy)]
5
6#[doc = "A multiple sequence alignment: a list of Sequence records. Conventionally all sequences have the same length once gaps are included, but that is a semantic constraint, not checked structurally by this schema. Accepts either the bare-array shape every current producer (react-bio-viz's AlignedSequences, acacia's MSAData) actually emits, or a wrapped object carrying the wire-format 'type' discriminator for producers that want one."]
7#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
8#[serde(untagged)]
9pub enum Alignment {
10 WrappedAlignment(WrappedAlignment),
11 UnwrappedAlignment(UnwrappedAlignment),
12}
13impl ::std::convert::From<WrappedAlignment> for Alignment {
14 fn from(value: WrappedAlignment) -> Self {
15 Self::WrappedAlignment(value)
16 }
17}
18impl ::std::convert::From<UnwrappedAlignment> for Alignment {
19 fn from(value: UnwrappedAlignment) -> Self {
20 Self::UnwrappedAlignment(value)
21 }
22}
23#[doc = "A GFF3-derived sequence feature (gene model) node. Shared verbatim between picea (SequenceInterval) and react-bio-viz (SequenceInterval). seqid/start/end/strand stay flat rather than nesting under core/Location, to match the real current wire shape exactly."]
24#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
25#[serde(deny_unknown_fields)]
26pub struct Annotation {
27 pub attributes: Metadata,
28 #[doc = "Nested features, e.g. mRNA under gene, exon/CDS under mRNA."]
29 pub children: ::std::vec::Vec<Annotation>,
30 #[doc = "GFF3 column 5: 1-based inclusive end."]
31 pub end: ::std::num::NonZeroU64,
32 #[serde(rename = "ID")]
33 pub id: Identifier,
34 #[doc = "GFF3 column 3 (feature type), e.g. 'gene', 'mRNA', 'exon', 'CDS'."]
35 pub interval_type: AnnotationIntervalType,
36 #[doc = "GFF3 column 8 (CDS reading-frame phase). '.' is the GFF3 convention for 'not applicable'."]
37 pub phase: AnnotationPhase,
38 #[doc = "GFF3 column 6. '.' is the GFF3 convention for 'no score'."]
39 pub score: AnnotationScore,
40 #[doc = "GFF3 column 1: the reference sequence this feature is on."]
41 pub seqid: Identifier,
42 #[doc = "GFF3 column 2."]
43 pub source: ::std::string::String,
44 #[doc = "GFF3 column 4: 1-based inclusive start."]
45 pub start: ::std::num::NonZeroU64,
46 #[doc = "GFF3 column 7."]
47 pub strand: ::betula_schema::Strand,
48 #[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional. Distinct from 'interval_type': 'type' says this is a betula Annotation object, 'interval_type' says which GFF3 feature kind it is."]
49 #[serde(
50 rename = "type",
51 skip_serializing_if = "::std::option::Option::is_none"
52 )]
53 pub type_: ::std::option::Option<AnnotationType>,
54}
55#[doc = "GFF3 column 3 (feature type), e.g. 'gene', 'mRNA', 'exon', 'CDS'."]
56#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57#[serde(transparent)]
58pub struct AnnotationIntervalType(::std::string::String);
59impl ::std::ops::Deref for AnnotationIntervalType {
60 type Target = ::std::string::String;
61 fn deref(&self) -> &::std::string::String {
62 &self.0
63 }
64}
65impl ::std::convert::From<AnnotationIntervalType> for ::std::string::String {
66 fn from(value: AnnotationIntervalType) -> Self {
67 value.0
68 }
69}
70impl ::std::str::FromStr for AnnotationIntervalType {
71 type Err = self::error::ConversionError;
72 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
73 if value.chars().count() < 1usize {
74 return Err("shorter than 1 characters".into());
75 }
76 Ok(Self(value.to_string()))
77 }
78}
79impl ::std::convert::TryFrom<&str> for AnnotationIntervalType {
80 type Error = self::error::ConversionError;
81 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
82 value.parse()
83 }
84}
85impl ::std::convert::TryFrom<::std::string::String> for AnnotationIntervalType {
86 type Error = self::error::ConversionError;
87 fn try_from(
88 value: ::std::string::String,
89 ) -> ::std::result::Result<Self, self::error::ConversionError> {
90 value.parse()
91 }
92}
93impl<'de> ::serde::Deserialize<'de> for AnnotationIntervalType {
94 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
95 where
96 D: ::serde::Deserializer<'de>,
97 {
98 ::std::string::String::deserialize(deserializer)?
99 .parse()
100 .map_err(|e: self::error::ConversionError| {
101 <D::Error as ::serde::de::Error>::custom(e.to_string())
102 })
103 }
104}
105#[doc = "GFF3 column 8 (CDS reading-frame phase). '.' is the GFF3 convention for 'not applicable'."]
106#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
107#[serde(untagged)]
108pub enum AnnotationPhase {
109 Variant0(AnnotationPhaseVariant0),
110 Variant1(AnnotationPhaseVariant1),
111}
112impl ::std::convert::From<AnnotationPhaseVariant0> for AnnotationPhase {
113 fn from(value: AnnotationPhaseVariant0) -> Self {
114 Self::Variant0(value)
115 }
116}
117impl ::std::convert::From<AnnotationPhaseVariant1> for AnnotationPhase {
118 fn from(value: AnnotationPhaseVariant1) -> Self {
119 Self::Variant1(value)
120 }
121}
122#[doc = "`AnnotationPhaseVariant0`"]
123#[derive(:: serde :: Serialize, Clone, Debug, PartialEq)]
124#[serde(transparent)]
125pub struct AnnotationPhaseVariant0(f64);
126impl ::std::ops::Deref for AnnotationPhaseVariant0 {
127 type Target = f64;
128 fn deref(&self) -> &f64 {
129 &self.0
130 }
131}
132impl ::std::convert::From<AnnotationPhaseVariant0> for f64 {
133 fn from(value: AnnotationPhaseVariant0) -> Self {
134 value.0
135 }
136}
137impl ::std::convert::TryFrom<f64> for AnnotationPhaseVariant0 {
138 type Error = self::error::ConversionError;
139 fn try_from(value: f64) -> ::std::result::Result<Self, self::error::ConversionError> {
140 if ![0_f64, 1_f64, 2_f64].contains(&value) {
141 Err("invalid value".into())
142 } else {
143 Ok(Self(value))
144 }
145 }
146}
147impl<'de> ::serde::Deserialize<'de> for AnnotationPhaseVariant0 {
148 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
149 where
150 D: ::serde::Deserializer<'de>,
151 {
152 Self::try_from(<f64>::deserialize(deserializer)?)
153 .map_err(|e| <D::Error as ::serde::de::Error>::custom(e.to_string()))
154 }
155}
156#[doc = "`AnnotationPhaseVariant1`"]
157#[derive(
158 :: serde :: Deserialize,
159 :: serde :: Serialize,
160 Clone,
161 Copy,
162 Debug,
163 Eq,
164 Hash,
165 Ord,
166 PartialEq,
167 PartialOrd,
168)]
169pub enum AnnotationPhaseVariant1 {
170 #[serde(rename = ".")]
171 X,
172}
173impl ::std::fmt::Display for AnnotationPhaseVariant1 {
174 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
175 match *self {
176 Self::X => f.write_str("."),
177 }
178 }
179}
180impl ::std::str::FromStr for AnnotationPhaseVariant1 {
181 type Err = self::error::ConversionError;
182 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
183 match value {
184 "." => Ok(Self::X),
185 _ => Err("invalid value".into()),
186 }
187 }
188}
189impl ::std::convert::TryFrom<&str> for AnnotationPhaseVariant1 {
190 type Error = self::error::ConversionError;
191 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
192 value.parse()
193 }
194}
195impl ::std::convert::TryFrom<::std::string::String> for AnnotationPhaseVariant1 {
196 type Error = self::error::ConversionError;
197 fn try_from(
198 value: ::std::string::String,
199 ) -> ::std::result::Result<Self, self::error::ConversionError> {
200 value.parse()
201 }
202}
203#[doc = "GFF3 column 6. '.' is the GFF3 convention for 'no score'."]
204#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
205#[serde(untagged)]
206pub enum AnnotationScore {
207 Number(f64),
208 String(AnnotationScoreString),
209}
210impl ::std::fmt::Display for AnnotationScore {
211 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
212 match self {
213 Self::Number(x) => x.fmt(f),
214 Self::String(x) => x.fmt(f),
215 }
216 }
217}
218impl ::std::str::FromStr for AnnotationScore {
219 type Err = self::error::ConversionError;
220 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
221 if let Ok(v) = value.parse() {
222 Ok(Self::Number(v))
223 } else if let Ok(v) = value.parse() {
224 Ok(Self::String(v))
225 } else {
226 Err("string conversion failed for all variants".into())
227 }
228 }
229}
230impl ::std::convert::TryFrom<&str> for AnnotationScore {
231 type Error = self::error::ConversionError;
232 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
233 value.parse()
234 }
235}
236impl ::std::convert::TryFrom<::std::string::String> for AnnotationScore {
237 type Error = self::error::ConversionError;
238 fn try_from(
239 value: ::std::string::String,
240 ) -> ::std::result::Result<Self, self::error::ConversionError> {
241 value.parse()
242 }
243}
244impl ::std::convert::From<f64> for AnnotationScore {
245 fn from(value: f64) -> Self {
246 Self::Number(value)
247 }
248}
249impl ::std::convert::From<AnnotationScoreString> for AnnotationScore {
250 fn from(value: AnnotationScoreString) -> Self {
251 Self::String(value)
252 }
253}
254#[doc = "`AnnotationScoreString`"]
255#[derive(
256 :: serde :: Deserialize,
257 :: serde :: Serialize,
258 Clone,
259 Copy,
260 Debug,
261 Eq,
262 Hash,
263 Ord,
264 PartialEq,
265 PartialOrd,
266)]
267pub enum AnnotationScoreString {
268 #[serde(rename = ".")]
269 X,
270}
271impl ::std::fmt::Display for AnnotationScoreString {
272 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
273 match *self {
274 Self::X => f.write_str("."),
275 }
276 }
277}
278impl ::std::str::FromStr for AnnotationScoreString {
279 type Err = self::error::ConversionError;
280 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
281 match value {
282 "." => Ok(Self::X),
283 _ => Err("invalid value".into()),
284 }
285 }
286}
287impl ::std::convert::TryFrom<&str> for AnnotationScoreString {
288 type Error = self::error::ConversionError;
289 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
290 value.parse()
291 }
292}
293impl ::std::convert::TryFrom<::std::string::String> for AnnotationScoreString {
294 type Error = self::error::ConversionError;
295 fn try_from(
296 value: ::std::string::String,
297 ) -> ::std::result::Result<Self, self::error::ConversionError> {
298 value.parse()
299 }
300}
301#[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional. Distinct from 'interval_type': 'type' says this is a betula Annotation object, 'interval_type' says which GFF3 feature kind it is."]
302#[derive(
303 :: serde :: Deserialize,
304 :: serde :: Serialize,
305 Clone,
306 Copy,
307 Debug,
308 Eq,
309 Hash,
310 Ord,
311 PartialEq,
312 PartialOrd,
313)]
314pub enum AnnotationType {
315 #[serde(rename = "annotation")]
316 Annotation,
317}
318impl ::std::fmt::Display for AnnotationType {
319 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
320 match *self {
321 Self::Annotation => f.write_str("annotation"),
322 }
323 }
324}
325impl ::std::str::FromStr for AnnotationType {
326 type Err = self::error::ConversionError;
327 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
328 match value {
329 "annotation" => Ok(Self::Annotation),
330 _ => Err("invalid value".into()),
331 }
332 }
333}
334impl ::std::convert::TryFrom<&str> for AnnotationType {
335 type Error = self::error::ConversionError;
336 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
337 value.parse()
338 }
339}
340impl ::std::convert::TryFrom<::std::string::String> for AnnotationType {
341 type Error = self::error::ConversionError;
342 fn try_from(
343 value: ::std::string::String,
344 ) -> ::std::result::Result<Self, self::error::ConversionError> {
345 value.parse()
346 }
347}
348#[doc = "All betula schemas bundled into one document for code generation. Generated by scripts/bundle_schema.py; do not edit."]
349#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
350#[serde(transparent)]
351pub struct Betula(pub ::serde_json::Value);
352impl ::std::ops::Deref for Betula {
353 type Target = ::serde_json::Value;
354 fn deref(&self) -> &::serde_json::Value {
355 &self.0
356 }
357}
358impl ::std::convert::From<Betula> for ::serde_json::Value {
359 fn from(value: Betula) -> Self {
360 value.0
361 }
362}
363impl ::std::convert::From<::serde_json::Value> for Betula {
364 fn from(value: ::serde_json::Value) -> Self {
365 Self(value)
366 }
367}
368#[doc = "A full BLAST search result, matching blastserver's parsed-XML shape: hit-level, with nested HSPs and taxonomy/cluster enrichment. react-bio-viz's flattened single-row-per-hit visualization shape is a derived view of this, not a separate wire format. Numeric fields here are typed as numbers; blastserver's raw XML parse currently yields numeric strings and must cast before serializing against this schema."]
369#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
370#[serde(deny_unknown_fields)]
371pub struct BlastResult {
372 pub db: ::std::string::String,
373 pub hits: ::std::vec::Vec<Hit>,
374 pub message: ::std::string::String,
375 pub program: ::std::string::String,
376 #[serde(rename = "queryId")]
377 pub query_id: Identifier,
378 #[serde(rename = "queryLen")]
379 pub query_len: ::std::num::NonZeroU64,
380 #[serde(rename = "queryTitle")]
381 pub query_title: ::std::string::String,
382 pub stat: ::std::string::String,
383 #[serde(
384 rename = "taxonomyTrees",
385 default,
386 skip_serializing_if = "::std::vec::Vec::is_empty"
387 )]
388 pub taxonomy_trees: ::std::vec::Vec<TaxonomyNode>,
389 #[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional."]
390 #[serde(
391 rename = "type",
392 skip_serializing_if = "::std::option::Option::is_none"
393 )]
394 pub type_: ::std::option::Option<BlastResultType>,
395 pub version: ::std::string::String,
396}
397#[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional."]
398#[derive(
399 :: serde :: Deserialize,
400 :: serde :: Serialize,
401 Clone,
402 Copy,
403 Debug,
404 Eq,
405 Hash,
406 Ord,
407 PartialEq,
408 PartialOrd,
409)]
410pub enum BlastResultType {
411 #[serde(rename = "blast-result")]
412 BlastResult,
413}
414impl ::std::fmt::Display for BlastResultType {
415 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
416 match *self {
417 Self::BlastResult => f.write_str("blast-result"),
418 }
419 }
420}
421impl ::std::str::FromStr for BlastResultType {
422 type Err = self::error::ConversionError;
423 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
424 match value {
425 "blast-result" => Ok(Self::BlastResult),
426 _ => Err("invalid value".into()),
427 }
428 }
429}
430impl ::std::convert::TryFrom<&str> for BlastResultType {
431 type Error = self::error::ConversionError;
432 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
433 value.parse()
434 }
435}
436impl ::std::convert::TryFrom<::std::string::String> for BlastResultType {
437 type Error = self::error::ConversionError;
438 fn try_from(
439 value: ::std::string::String,
440 ) -> ::std::result::Result<Self, self::error::ConversionError> {
441 value.parse()
442 }
443}
444#[doc = "A pairwise distance matrix, shared by react-bio-viz and acacia (via @holmrenser/nj's DistanceResult). Squareness, symmetry, and a zero diagonal are semantic constraints, not checked structurally by this schema."]
445#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
446#[serde(deny_unknown_fields)]
447pub struct DistanceMatrix {
448 #[doc = "Optional display-name lookup from label to a longer/human-readable name."]
449 #[serde(
450 rename = "labelNames",
451 default,
452 skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
453 )]
454 pub label_names: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
455 pub labels: ::std::vec::Vec<Identifier>,
456 pub matrix: ::std::vec::Vec<::std::vec::Vec<f64>>,
457 #[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional."]
458 #[serde(
459 rename = "type",
460 skip_serializing_if = "::std::option::Option::is_none"
461 )]
462 pub type_: ::std::option::Option<DistanceMatrixType>,
463}
464#[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional."]
465#[derive(
466 :: serde :: Deserialize,
467 :: serde :: Serialize,
468 Clone,
469 Copy,
470 Debug,
471 Eq,
472 Hash,
473 Ord,
474 PartialEq,
475 PartialOrd,
476)]
477pub enum DistanceMatrixType {
478 #[serde(rename = "distance-matrix")]
479 DistanceMatrix,
480}
481impl ::std::fmt::Display for DistanceMatrixType {
482 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
483 match *self {
484 Self::DistanceMatrix => f.write_str("distance-matrix"),
485 }
486 }
487}
488impl ::std::str::FromStr for DistanceMatrixType {
489 type Err = self::error::ConversionError;
490 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
491 match value {
492 "distance-matrix" => Ok(Self::DistanceMatrix),
493 _ => Err("invalid value".into()),
494 }
495 }
496}
497impl ::std::convert::TryFrom<&str> for DistanceMatrixType {
498 type Error = self::error::ConversionError;
499 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
500 value.parse()
501 }
502}
503impl ::std::convert::TryFrom<::std::string::String> for DistanceMatrixType {
504 type Error = self::error::ConversionError;
505 fn try_from(
506 value: ::std::string::String,
507 ) -> ::std::result::Result<Self, self::error::ConversionError> {
508 value.parse()
509 }
510}
511#[doc = "IUPAC nucleotide codes for DNA: A/C/G/T plus the standard ambiguity codes (R,Y,S,W,K,M,B,D,H,V,N). Also allows '-' and '.' as alignment gap/missing-data characters, since a Sequence doubles as an alignment row. Case-insensitive (lowercase is the common convention for soft-masked regions in genome assemblies)."]
512#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
513#[serde(transparent)]
514pub struct DnaAlphabet(::std::string::String);
515impl ::std::ops::Deref for DnaAlphabet {
516 type Target = ::std::string::String;
517 fn deref(&self) -> &::std::string::String {
518 &self.0
519 }
520}
521impl ::std::convert::From<DnaAlphabet> for ::std::string::String {
522 fn from(value: DnaAlphabet) -> Self {
523 value.0
524 }
525}
526impl ::std::str::FromStr for DnaAlphabet {
527 type Err = self::error::ConversionError;
528 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
529 if value.chars().count() < 1usize {
530 return Err("shorter than 1 characters".into());
531 }
532 static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
533 ::std::sync::LazyLock::new(|| {
534 ::regress::Regex::new("^[ACGTRYSWKMBDHVNacgtryswkmbdhvn.-]*$").unwrap()
535 });
536 if PATTERN.find(value).is_none() {
537 return Err("doesn't match pattern \"^[ACGTRYSWKMBDHVNacgtryswkmbdhvn.-]*$\"".into());
538 }
539 Ok(Self(value.to_string()))
540 }
541}
542impl ::std::convert::TryFrom<&str> for DnaAlphabet {
543 type Error = self::error::ConversionError;
544 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
545 value.parse()
546 }
547}
548impl ::std::convert::TryFrom<::std::string::String> for DnaAlphabet {
549 type Error = self::error::ConversionError;
550 fn try_from(
551 value: ::std::string::String,
552 ) -> ::std::result::Result<Self, self::error::ConversionError> {
553 value.parse()
554 }
555}
556impl<'de> ::serde::Deserialize<'de> for DnaAlphabet {
557 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
558 where
559 D: ::serde::Deserializer<'de>,
560 {
561 ::std::string::String::deserialize(deserializer)?
562 .parse()
563 .map_err(|e: self::error::ConversionError| {
564 <D::Error as ::serde::de::Error>::custom(e.to_string())
565 })
566 }
567}
568#[doc = "`DnaSequence`"]
569#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
570#[serde(deny_unknown_fields)]
571pub struct DnaSequence {
572 pub identifier: Identifier,
573 pub sequence: DnaAlphabet,
574 #[serde(rename = "type")]
575 pub type_: DnaSequenceType,
576}
577#[doc = "`DnaSequenceType`"]
578#[derive(
579 :: serde :: Deserialize,
580 :: serde :: Serialize,
581 Clone,
582 Copy,
583 Debug,
584 Eq,
585 Hash,
586 Ord,
587 PartialEq,
588 PartialOrd,
589)]
590pub enum DnaSequenceType {
591 #[serde(rename = "dna-sequence")]
592 DnaSequence,
593}
594impl ::std::fmt::Display for DnaSequenceType {
595 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
596 match *self {
597 Self::DnaSequence => f.write_str("dna-sequence"),
598 }
599 }
600}
601impl ::std::str::FromStr for DnaSequenceType {
602 type Err = self::error::ConversionError;
603 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
604 match value {
605 "dna-sequence" => Ok(Self::DnaSequence),
606 _ => Err("invalid value".into()),
607 }
608 }
609}
610impl ::std::convert::TryFrom<&str> for DnaSequenceType {
611 type Error = self::error::ConversionError;
612 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
613 value.parse()
614 }
615}
616impl ::std::convert::TryFrom<::std::string::String> for DnaSequenceType {
617 type Error = self::error::ConversionError;
618 fn try_from(
619 value: ::std::string::String,
620 ) -> ::std::result::Result<Self, self::error::ConversionError> {
621 value.parse()
622 }
623}
624#[doc = "`Hit`"]
625#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
626#[serde(deny_unknown_fields)]
627pub struct Hit {
628 pub accession: Identifier,
629 #[doc = "Taxonomy lineage taxids."]
630 pub ancestors: ::std::vec::Vec<i64>,
631 #[serde(rename = "clusterSize")]
632 pub cluster_size: ::std::num::NonZeroU64,
633 pub hsps: ::std::vec::Vec<Hsp>,
634 pub len: ::std::num::NonZeroU64,
635 pub members: ::std::vec::Vec<HitMember>,
636 #[doc = "Resolved taxon scientific name."]
637 pub name: ::std::string::String,
638 pub num: i64,
639 #[serde(rename = "percentIdentity")]
640 pub percent_identity: f64,
641 #[serde(rename = "queryCover")]
642 pub query_cover: f64,
643 pub saccver: Identifier,
644 pub taxid: i64,
645 pub title: ::std::string::String,
646}
647#[doc = "One member of a clustered hit (e.g. in a clustered_nr database); a non-clustered hit has exactly one member."]
648#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
649#[serde(deny_unknown_fields)]
650pub struct HitMember {
651 pub accession: Identifier,
652 pub name: ::std::string::String,
653 pub taxid: i64,
654 pub title: ::std::string::String,
655}
656#[doc = "`Hsp`"]
657#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
658#[serde(deny_unknown_fields)]
659pub struct Hsp {
660 #[serde(rename = "alignLen")]
661 pub align_len: ::std::num::NonZeroU64,
662 #[serde(rename = "bitScore")]
663 pub bit_score: f64,
664 pub evalue: f64,
665 #[serde(rename = "hitFrom")]
666 pub hit_from: ::std::num::NonZeroU64,
667 #[serde(rename = "hitTo")]
668 pub hit_to: ::std::num::NonZeroU64,
669 pub hseq: ::std::string::String,
670 pub identity: u64,
671 pub midline: ::std::string::String,
672 pub num: ::std::num::NonZeroU64,
673 pub qseq: ::std::string::String,
674 #[serde(rename = "queryFrom")]
675 pub query_from: ::std::num::NonZeroU64,
676 #[serde(rename = "queryTo")]
677 pub query_to: ::std::num::NonZeroU64,
678 pub score: f64,
679}
680#[doc = "A short, stable identifier/label string: a sequence identifier, a GFF3 feature ID, a BLAST accession, etc."]
681#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
682#[serde(transparent)]
683pub struct Identifier(::std::string::String);
684impl ::std::ops::Deref for Identifier {
685 type Target = ::std::string::String;
686 fn deref(&self) -> &::std::string::String {
687 &self.0
688 }
689}
690impl ::std::convert::From<Identifier> for ::std::string::String {
691 fn from(value: Identifier) -> Self {
692 value.0
693 }
694}
695impl ::std::str::FromStr for Identifier {
696 type Err = self::error::ConversionError;
697 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
698 if value.chars().count() < 1usize {
699 return Err("shorter than 1 characters".into());
700 }
701 Ok(Self(value.to_string()))
702 }
703}
704impl ::std::convert::TryFrom<&str> for Identifier {
705 type Error = self::error::ConversionError;
706 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
707 value.parse()
708 }
709}
710impl ::std::convert::TryFrom<::std::string::String> for Identifier {
711 type Error = self::error::ConversionError;
712 fn try_from(
713 value: ::std::string::String,
714 ) -> ::std::result::Result<Self, self::error::ConversionError> {
715 value.parse()
716 }
717}
718impl<'de> ::serde::Deserialize<'de> for Identifier {
719 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
720 where
721 D: ::serde::Deserializer<'de>,
722 {
723 ::std::string::String::deserialize(deserializer)?
724 .parse()
725 .map_err(|e: self::error::ConversionError| {
726 <D::Error as ::serde::de::Error>::custom(e.to_string())
727 })
728 }
729}
730#[doc = "A 1-based inclusive interval on a named reference sequence (GFF3 convention). Not yet consumed by another betula schema: annotation keeps seqid/start/end/strand flat to match picea's and react-bio-viz's current wire shape rather than nesting them under this. This exists as the reusable primitive for when a genomic-interval-only shape is needed, e.g. a future schema for react-bio-viz's GenomeBrowser feature tracks."]
731#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
732#[serde(deny_unknown_fields)]
733pub struct Location {
734 pub end: ::std::num::NonZeroU64,
735 pub seqid: Identifier,
736 pub start: ::std::num::NonZeroU64,
737 pub strand: ::betula_schema::Strand,
738}
739#[doc = "Free-form key/value metadata, GFF3-attribute-style: each value is a single string, or a list of strings for multi-valued tags."]
740#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
741#[serde(transparent)]
742pub struct Metadata(pub ::std::collections::HashMap<::std::string::String, MetadataValue>);
743impl ::std::ops::Deref for Metadata {
744 type Target = ::std::collections::HashMap<::std::string::String, MetadataValue>;
745 fn deref(&self) -> &::std::collections::HashMap<::std::string::String, MetadataValue> {
746 &self.0
747 }
748}
749impl ::std::convert::From<Metadata>
750 for ::std::collections::HashMap<::std::string::String, MetadataValue>
751{
752 fn from(value: Metadata) -> Self {
753 value.0
754 }
755}
756impl ::std::convert::From<::std::collections::HashMap<::std::string::String, MetadataValue>>
757 for Metadata
758{
759 fn from(value: ::std::collections::HashMap<::std::string::String, MetadataValue>) -> Self {
760 Self(value)
761 }
762}
763#[doc = "`MetadataValue`"]
764#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
765#[serde(untagged)]
766pub enum MetadataValue {
767 String(::std::string::String),
768 Array(::std::vec::Vec<::std::string::String>),
769}
770impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for MetadataValue {
771 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
772 Self::Array(value)
773 }
774}
775#[doc = "IUPAC amino acid codes: the standard 20 (A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y) plus the ambiguity/special codes B (Asx), Z (Glx), X (any), J (Leu/Ile), U (selenocysteine), O (pyrrolysine) -- together these cover all 26 letters, so this pattern is effectively any letter. Also allows '*' for a stop codon, and '-'/'.' as alignment gap/missing-data characters, since a Sequence doubles as an alignment row. Case-insensitive."]
776#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
777#[serde(transparent)]
778pub struct ProteinAlphabet(::std::string::String);
779impl ::std::ops::Deref for ProteinAlphabet {
780 type Target = ::std::string::String;
781 fn deref(&self) -> &::std::string::String {
782 &self.0
783 }
784}
785impl ::std::convert::From<ProteinAlphabet> for ::std::string::String {
786 fn from(value: ProteinAlphabet) -> Self {
787 value.0
788 }
789}
790impl ::std::str::FromStr for ProteinAlphabet {
791 type Err = self::error::ConversionError;
792 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
793 if value.chars().count() < 1usize {
794 return Err("shorter than 1 characters".into());
795 }
796 static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
797 ::std::sync::LazyLock::new(|| ::regress::Regex::new("^[A-Za-z*.-]*$").unwrap());
798 if PATTERN.find(value).is_none() {
799 return Err("doesn't match pattern \"^[A-Za-z*.-]*$\"".into());
800 }
801 Ok(Self(value.to_string()))
802 }
803}
804impl ::std::convert::TryFrom<&str> for ProteinAlphabet {
805 type Error = self::error::ConversionError;
806 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
807 value.parse()
808 }
809}
810impl ::std::convert::TryFrom<::std::string::String> for ProteinAlphabet {
811 type Error = self::error::ConversionError;
812 fn try_from(
813 value: ::std::string::String,
814 ) -> ::std::result::Result<Self, self::error::ConversionError> {
815 value.parse()
816 }
817}
818impl<'de> ::serde::Deserialize<'de> for ProteinAlphabet {
819 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
820 where
821 D: ::serde::Deserializer<'de>,
822 {
823 ::std::string::String::deserialize(deserializer)?
824 .parse()
825 .map_err(|e: self::error::ConversionError| {
826 <D::Error as ::serde::de::Error>::custom(e.to_string())
827 })
828 }
829}
830#[doc = "`ProteinSequence`"]
831#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
832#[serde(deny_unknown_fields)]
833pub struct ProteinSequence {
834 pub identifier: Identifier,
835 pub sequence: ProteinAlphabet,
836 #[serde(rename = "type")]
837 pub type_: ProteinSequenceType,
838}
839#[doc = "`ProteinSequenceType`"]
840#[derive(
841 :: serde :: Deserialize,
842 :: serde :: Serialize,
843 Clone,
844 Copy,
845 Debug,
846 Eq,
847 Hash,
848 Ord,
849 PartialEq,
850 PartialOrd,
851)]
852pub enum ProteinSequenceType {
853 #[serde(rename = "protein-sequence")]
854 ProteinSequence,
855}
856impl ::std::fmt::Display for ProteinSequenceType {
857 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
858 match *self {
859 Self::ProteinSequence => f.write_str("protein-sequence"),
860 }
861 }
862}
863impl ::std::str::FromStr for ProteinSequenceType {
864 type Err = self::error::ConversionError;
865 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
866 match value {
867 "protein-sequence" => Ok(Self::ProteinSequence),
868 _ => Err("invalid value".into()),
869 }
870 }
871}
872impl ::std::convert::TryFrom<&str> for ProteinSequenceType {
873 type Error = self::error::ConversionError;
874 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
875 value.parse()
876 }
877}
878impl ::std::convert::TryFrom<::std::string::String> for ProteinSequenceType {
879 type Error = self::error::ConversionError;
880 fn try_from(
881 value: ::std::string::String,
882 ) -> ::std::result::Result<Self, self::error::ConversionError> {
883 value.parse()
884 }
885}
886#[doc = "IUPAC nucleotide codes for RNA: A/C/G/U plus the standard ambiguity codes (R,Y,S,W,K,M,B,D,H,V,N). 'T' is deliberately excluded (that's DnaAlphabet). Also allows '-' and '.' as alignment gap/missing-data characters, since a Sequence doubles as an alignment row. Case-insensitive."]
887#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
888#[serde(transparent)]
889pub struct RnaAlphabet(::std::string::String);
890impl ::std::ops::Deref for RnaAlphabet {
891 type Target = ::std::string::String;
892 fn deref(&self) -> &::std::string::String {
893 &self.0
894 }
895}
896impl ::std::convert::From<RnaAlphabet> for ::std::string::String {
897 fn from(value: RnaAlphabet) -> Self {
898 value.0
899 }
900}
901impl ::std::str::FromStr for RnaAlphabet {
902 type Err = self::error::ConversionError;
903 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
904 if value.chars().count() < 1usize {
905 return Err("shorter than 1 characters".into());
906 }
907 static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
908 ::std::sync::LazyLock::new(|| {
909 ::regress::Regex::new("^[ACGURYSWKMBDHVNacguryswkmbdhvn.-]*$").unwrap()
910 });
911 if PATTERN.find(value).is_none() {
912 return Err("doesn't match pattern \"^[ACGURYSWKMBDHVNacguryswkmbdhvn.-]*$\"".into());
913 }
914 Ok(Self(value.to_string()))
915 }
916}
917impl ::std::convert::TryFrom<&str> for RnaAlphabet {
918 type Error = self::error::ConversionError;
919 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
920 value.parse()
921 }
922}
923impl ::std::convert::TryFrom<::std::string::String> for RnaAlphabet {
924 type Error = self::error::ConversionError;
925 fn try_from(
926 value: ::std::string::String,
927 ) -> ::std::result::Result<Self, self::error::ConversionError> {
928 value.parse()
929 }
930}
931impl<'de> ::serde::Deserialize<'de> for RnaAlphabet {
932 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
933 where
934 D: ::serde::Deserializer<'de>,
935 {
936 ::std::string::String::deserialize(deserializer)?
937 .parse()
938 .map_err(|e: self::error::ConversionError| {
939 <D::Error as ::serde::de::Error>::custom(e.to_string())
940 })
941 }
942}
943#[doc = "`RnaSequence`"]
944#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
945#[serde(deny_unknown_fields)]
946pub struct RnaSequence {
947 pub identifier: Identifier,
948 pub sequence: RnaAlphabet,
949 #[serde(rename = "type")]
950 pub type_: RnaSequenceType,
951}
952#[doc = "`RnaSequenceType`"]
953#[derive(
954 :: serde :: Deserialize,
955 :: serde :: Serialize,
956 Clone,
957 Copy,
958 Debug,
959 Eq,
960 Hash,
961 Ord,
962 PartialEq,
963 PartialOrd,
964)]
965pub enum RnaSequenceType {
966 #[serde(rename = "rna-sequence")]
967 RnaSequence,
968}
969impl ::std::fmt::Display for RnaSequenceType {
970 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
971 match *self {
972 Self::RnaSequence => f.write_str("rna-sequence"),
973 }
974 }
975}
976impl ::std::str::FromStr for RnaSequenceType {
977 type Err = self::error::ConversionError;
978 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
979 match value {
980 "rna-sequence" => Ok(Self::RnaSequence),
981 _ => Err("invalid value".into()),
982 }
983 }
984}
985impl ::std::convert::TryFrom<&str> for RnaSequenceType {
986 type Error = self::error::ConversionError;
987 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
988 value.parse()
989 }
990}
991impl ::std::convert::TryFrom<::std::string::String> for RnaSequenceType {
992 type Error = self::error::ConversionError;
993 fn try_from(
994 value: ::std::string::String,
995 ) -> ::std::result::Result<Self, self::error::ConversionError> {
996 value.parse()
997 }
998}
999#[doc = "A single biological sequence record, shared by picea, react-bio-viz, and acacia (FASTA-derived). 'type' is an optional alphabet discriminator: every current producer omits it and emits the plain UntypedSequence shape, which remains valid. Set it when the alphabet is known so consumers get both a proper discriminated union and IUPAC alphabet validation on 'sequence' (core/dna-alphabet, core/rna-alphabet, core/protein-alphabet) instead of an unconstrained string."]
1000#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1001#[serde(untagged)]
1002pub enum Sequence {
1003 DnaSequence(DnaSequence),
1004 RnaSequence(RnaSequence),
1005 ProteinSequence(ProteinSequence),
1006 UntypedSequence(UntypedSequence),
1007}
1008impl ::std::convert::From<DnaSequence> for Sequence {
1009 fn from(value: DnaSequence) -> Self {
1010 Self::DnaSequence(value)
1011 }
1012}
1013impl ::std::convert::From<RnaSequence> for Sequence {
1014 fn from(value: RnaSequence) -> Self {
1015 Self::RnaSequence(value)
1016 }
1017}
1018impl ::std::convert::From<ProteinSequence> for Sequence {
1019 fn from(value: ProteinSequence) -> Self {
1020 Self::ProteinSequence(value)
1021 }
1022}
1023impl ::std::convert::From<UntypedSequence> for Sequence {
1024 fn from(value: UntypedSequence) -> Self {
1025 Self::UntypedSequence(value)
1026 }
1027}
1028#[doc = "A pointer to a Sequence by identifier, without embedding the sequence itself. Not yet consumed by another betula schema (every current producer embeds full Sequence objects, e.g. in alignment); this exists as the reusable primitive for when a by-reference link is needed, e.g. a hit record pointing at a locally-known query sequence instead of repeating it."]
1029#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1030#[serde(deny_unknown_fields)]
1031pub struct SequenceReference {
1032 pub identifier: Identifier,
1033}
1034#[doc = "`TaxonomyNode`"]
1035#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1036#[serde(deny_unknown_fields)]
1037pub struct TaxonomyNode {
1038 pub ancestors: ::std::vec::Vec<i64>,
1039 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1040 pub children: ::std::vec::Vec<TaxonomyNode>,
1041 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1042 pub count: ::std::option::Option<u64>,
1043 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1044 pub depth: ::std::option::Option<u64>,
1045 pub id: i64,
1046 pub name: ::std::string::String,
1047}
1048#[doc = "A phylogenetic (or other hierarchical) tree node, shared by picea, react-bio-viz, acacia, and iqtreeserver. The root of a tree is itself a Tree node; a whole tree and a single node use the same shape, so 'type' is optional and conventionally set only on a node transmitted as a standalone document (typically the root), not repeated on every nested child."]
1049#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1050#[serde(deny_unknown_fields)]
1051pub struct Tree {
1052 #[doc = "Child nodes. Empty array for a leaf."]
1053 pub children: ::std::vec::Vec<Tree>,
1054 #[doc = "Optional node identifier. Not every producer assigns one at parse time (acacia/iqtreeserver derive ids separately); consumers must not assume it is present."]
1055 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1056 pub id: ::std::option::Option<TreeId>,
1057 #[doc = "Branch length leading to this node."]
1058 pub length: f64,
1059 #[doc = "Raw node label: a leaf name, or an internal-node label such as a bootstrap value or support string (e.g. picea's \"0.989\", IQ-TREE's \"95.3/88\"). Kept as the original string for round-tripping; parse further only if you know the producer's convention."]
1060 pub name: ::std::string::String,
1061 #[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional; omit on nested children."]
1062 #[serde(
1063 rename = "type",
1064 skip_serializing_if = "::std::option::Option::is_none"
1065 )]
1066 pub type_: ::std::option::Option<TreeType>,
1067}
1068#[doc = "Optional node identifier. Not every producer assigns one at parse time (acacia/iqtreeserver derive ids separately); consumers must not assume it is present."]
1069#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1070#[serde(untagged)]
1071pub enum TreeId {
1072 Integer(i64),
1073 String(::std::string::String),
1074}
1075impl ::std::fmt::Display for TreeId {
1076 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1077 match self {
1078 Self::Integer(x) => x.fmt(f),
1079 Self::String(x) => x.fmt(f),
1080 }
1081 }
1082}
1083impl ::std::convert::From<i64> for TreeId {
1084 fn from(value: i64) -> Self {
1085 Self::Integer(value)
1086 }
1087}
1088#[doc = "Wire-format object-kind discriminator (see betula's versioning policy). Optional; omit on nested children."]
1089#[derive(
1090 :: serde :: Deserialize,
1091 :: serde :: Serialize,
1092 Clone,
1093 Copy,
1094 Debug,
1095 Eq,
1096 Hash,
1097 Ord,
1098 PartialEq,
1099 PartialOrd,
1100)]
1101pub enum TreeType {
1102 #[serde(rename = "tree")]
1103 Tree,
1104}
1105impl ::std::fmt::Display for TreeType {
1106 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1107 match *self {
1108 Self::Tree => f.write_str("tree"),
1109 }
1110 }
1111}
1112impl ::std::str::FromStr for TreeType {
1113 type Err = self::error::ConversionError;
1114 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1115 match value {
1116 "tree" => Ok(Self::Tree),
1117 _ => Err("invalid value".into()),
1118 }
1119 }
1120}
1121impl ::std::convert::TryFrom<&str> for TreeType {
1122 type Error = self::error::ConversionError;
1123 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1124 value.parse()
1125 }
1126}
1127impl ::std::convert::TryFrom<::std::string::String> for TreeType {
1128 type Error = self::error::ConversionError;
1129 fn try_from(
1130 value: ::std::string::String,
1131 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1132 value.parse()
1133 }
1134}
1135#[doc = "The shape every current producer (picea, react-bio-viz, acacia) actually emits: no alphabet discriminator."]
1136#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1137#[serde(deny_unknown_fields)]
1138pub struct UntypedSequence {
1139 pub identifier: Identifier,
1140 pub sequence: UntypedSequenceSequence,
1141}
1142#[doc = "`UntypedSequenceSequence`"]
1143#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1144#[serde(transparent)]
1145pub struct UntypedSequenceSequence(::std::string::String);
1146impl ::std::ops::Deref for UntypedSequenceSequence {
1147 type Target = ::std::string::String;
1148 fn deref(&self) -> &::std::string::String {
1149 &self.0
1150 }
1151}
1152impl ::std::convert::From<UntypedSequenceSequence> for ::std::string::String {
1153 fn from(value: UntypedSequenceSequence) -> Self {
1154 value.0
1155 }
1156}
1157impl ::std::str::FromStr for UntypedSequenceSequence {
1158 type Err = self::error::ConversionError;
1159 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1160 if value.chars().count() < 1usize {
1161 return Err("shorter than 1 characters".into());
1162 }
1163 Ok(Self(value.to_string()))
1164 }
1165}
1166impl ::std::convert::TryFrom<&str> for UntypedSequenceSequence {
1167 type Error = self::error::ConversionError;
1168 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1169 value.parse()
1170 }
1171}
1172impl ::std::convert::TryFrom<::std::string::String> for UntypedSequenceSequence {
1173 type Error = self::error::ConversionError;
1174 fn try_from(
1175 value: ::std::string::String,
1176 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1177 value.parse()
1178 }
1179}
1180impl<'de> ::serde::Deserialize<'de> for UntypedSequenceSequence {
1181 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
1182 where
1183 D: ::serde::Deserializer<'de>,
1184 {
1185 ::std::string::String::deserialize(deserializer)?
1186 .parse()
1187 .map_err(|e: self::error::ConversionError| {
1188 <D::Error as ::serde::de::Error>::custom(e.to_string())
1189 })
1190 }
1191}
1192#[doc = "The shape every current producer (react-bio-viz, acacia) actually emits: no wrapper, no discriminator."]
1193#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1194#[serde(transparent)]
1195pub struct UnwrappedAlignment(pub ::std::vec::Vec<Sequence>);
1196impl ::std::ops::Deref for UnwrappedAlignment {
1197 type Target = ::std::vec::Vec<Sequence>;
1198 fn deref(&self) -> &::std::vec::Vec<Sequence> {
1199 &self.0
1200 }
1201}
1202impl ::std::convert::From<UnwrappedAlignment> for ::std::vec::Vec<Sequence> {
1203 fn from(value: UnwrappedAlignment) -> Self {
1204 value.0
1205 }
1206}
1207impl ::std::convert::From<::std::vec::Vec<Sequence>> for UnwrappedAlignment {
1208 fn from(value: ::std::vec::Vec<Sequence>) -> Self {
1209 Self(value)
1210 }
1211}
1212#[doc = "`WrappedAlignment`"]
1213#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, PartialEq)]
1214#[serde(deny_unknown_fields)]
1215pub struct WrappedAlignment {
1216 pub sequences: ::std::vec::Vec<Sequence>,
1217 #[doc = "Wire-format object-kind discriminator (see betula's versioning policy)."]
1218 #[serde(rename = "type")]
1219 pub type_: WrappedAlignmentType,
1220}
1221#[doc = "Wire-format object-kind discriminator (see betula's versioning policy)."]
1222#[derive(
1223 :: serde :: Deserialize,
1224 :: serde :: Serialize,
1225 Clone,
1226 Copy,
1227 Debug,
1228 Eq,
1229 Hash,
1230 Ord,
1231 PartialEq,
1232 PartialOrd,
1233)]
1234pub enum WrappedAlignmentType {
1235 #[serde(rename = "alignment")]
1236 Alignment,
1237}
1238impl ::std::fmt::Display for WrappedAlignmentType {
1239 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1240 match *self {
1241 Self::Alignment => f.write_str("alignment"),
1242 }
1243 }
1244}
1245impl ::std::str::FromStr for WrappedAlignmentType {
1246 type Err = self::error::ConversionError;
1247 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1248 match value {
1249 "alignment" => Ok(Self::Alignment),
1250 _ => Err("invalid value".into()),
1251 }
1252 }
1253}
1254impl ::std::convert::TryFrom<&str> for WrappedAlignmentType {
1255 type Error = self::error::ConversionError;
1256 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1257 value.parse()
1258 }
1259}
1260impl ::std::convert::TryFrom<::std::string::String> for WrappedAlignmentType {
1261 type Error = self::error::ConversionError;
1262 fn try_from(
1263 value: ::std::string::String,
1264 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1265 value.parse()
1266 }
1267}
1268#[doc = " Error types."]
1269pub mod error {
1270 #[doc = r" Error from a `TryFrom` or `FromStr` implementation."]
1271 pub struct ConversionError(::std::borrow::Cow<'static, str>);
1272 impl ::std::error::Error for ConversionError {}
1273 impl ::std::fmt::Display for ConversionError {
1274 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
1275 ::std::fmt::Display::fmt(&self.0, f)
1276 }
1277 }
1278 impl ::std::fmt::Debug for ConversionError {
1279 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
1280 ::std::fmt::Debug::fmt(&self.0, f)
1281 }
1282 }
1283 impl From<&'static str> for ConversionError {
1284 fn from(value: &'static str) -> Self {
1285 Self(value.into())
1286 }
1287 }
1288 impl From<String> for ConversionError {
1289 fn from(value: String) -> Self {
1290 Self(value.into())
1291 }
1292 }
1293}