use crate::transformations::{RegionAnchor, prelude::*};
#[derive(Clone, JsonSchema)]
#[tpd]
#[derive(Debug)]
pub struct Region {
pub start: isize,
#[tpd(alias = "length")]
pub len: usize,
#[schemars(with = "String")]
#[tpd(adapt_in_verify(String))]
#[tpd(alias = "segment")]
pub source: ResolvedSourceNoAll,
pub anchor: RegionAnchor,
pub out_label: TagLabel,
}
impl VerifyIn<PartialConfig> for PartialRegion {
fn verify(
&mut self,
parent: &PartialConfig,
_options: &VerifyOptions,
) -> std::result::Result<(), ValidationFailure>
where
Self: Sized + toml_pretty_deser::Visitor,
{
self.source.validate_segment(parent);
Ok(())
}
}
impl TagUser for PartialTaggedVariant<PartialRegion> {
fn get_tag_usage(
&mut self,
_tags_available: &IndexMap<TagLabel, TagMetadata>,
_segment_order: &[String],
) -> Option<TagUsageInfo<'_>> {
Some(TagUsageInfo::default())
}
}
impl Step for Region {
fn apply(
&self,
_block: FastQBlocksCombined,
_input_info: &InputInfo,
_demultiplex_info: &OptDemultiplex,
) -> anyhow::Result<(FastQBlocksCombined, bool)> {
unreachable!(
"ExtractRegion is only a configuration step. It is supposed to be replaced by ExtractRegions when the Transformations are expandend"
);
}
}