perbase_lib/position/
range_positions.rs1use crate::position::Position;
5use serde::Serialize;
6use smartstring::alias::String;
7use std::default;
8
9#[derive(Debug, Serialize, Default)]
11#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
12pub struct RangePositions {
13 #[serde(rename = "REF")]
15 pub ref_seq: String,
16 pub pos: u32,
18 pub end: u32,
20 pub depth: u32,
22}
23
24impl Position for RangePositions {
25 fn new(ref_seq: String, pos: u32) -> Self {
27 RangePositions {
28 ref_seq,
29 pos,
30 ..default::Default::default()
31 }
32 }
33}
34
35#[derive(Debug, Serialize, Default)]
37#[serde(rename_all = "camelCase")]
38pub struct BedFormatRangePositions {
39 pub chrom: String,
41 pub chrom_start: u32,
43 pub chrom_end: u32,
45 pub name: String,
47 pub score: u32,
49}
50
51impl From<RangePositions> for BedFormatRangePositions {
52 fn from(orig: RangePositions) -> Self {
53 BedFormatRangePositions {
54 chrom: orig.ref_seq,
55 chrom_start: orig.pos,
56 chrom_end: orig.end,
57 name: String::from(""),
58 score: orig.depth,
59 }
60 }
61}