|
1 | 1 | use anyhow::{Result, bail}; |
2 | 2 | use bed_utils::bed::{map::GIntervalMap, BEDLike, GenomicRange, ParseError, Strand}; |
3 | | -use bincode_next::{Decode, Encode}; |
4 | 3 | use ndarray::Array2; |
| 4 | +use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize}; |
5 | 5 | use rayon::iter::{IntoParallelIterator, ParallelIterator}; |
6 | 6 | use smallvec::{SmallVec, smallvec}; |
7 | 7 | use std::{ |
@@ -202,7 +202,7 @@ pub trait QualityControl: SnapData { |
202 | 202 | impl<T: SnapData> QualityControl for T {} |
203 | 203 |
|
204 | 204 |
|
205 | | -#[derive(Encode, Decode, Debug, Clone)] |
| 205 | +#[derive(Archive, RkyvSerialize, RkyvDeserialize, Debug, Clone)] |
206 | 206 | pub enum Fragment { |
207 | 207 | Single(SingleRead), |
208 | 208 | Paired(PairRead), |
@@ -361,7 +361,7 @@ impl BEDLike for Fragment { |
361 | 361 |
|
362 | 362 | /// Fragments from single-cell ATAC-seq experiment. Each fragment is represented |
363 | 363 | /// by a genomic coordinate, cell barcode and a integer value. |
364 | | -#[derive(Encode, Decode, Debug, Clone)] |
| 364 | +#[derive(Archive, RkyvSerialize, RkyvDeserialize, Debug, Clone)] |
365 | 365 | pub struct PairRead { |
366 | 366 | pub chrom: String, |
367 | 367 | pub start: u64, |
@@ -489,7 +489,7 @@ impl std::str::FromStr for PairRead { |
489 | 489 | } |
490 | 490 |
|
491 | 491 | /// Single-ended reads from single-cell ATAC-seq experiment. |
492 | | -#[derive(Encode, Decode, Debug, Clone)] |
| 492 | +#[derive(Archive, RkyvSerialize, RkyvDeserialize, Debug, Clone)] |
493 | 493 | pub struct SingleRead { |
494 | 494 | pub chrom: String, |
495 | 495 | pub start: u64, |
@@ -578,7 +578,7 @@ impl std::str::FromStr for SingleRead { |
578 | 578 | } |
579 | 579 |
|
580 | 580 | /// Chromatin interactions from single-cell Hi-C experiment. |
581 | | -#[derive(Encode, Decode, Debug)] |
| 581 | +#[derive(Archive, RkyvSerialize, RkyvDeserialize, Debug)] |
582 | 582 | pub struct Contact { |
583 | 583 | pub chrom1: String, |
584 | 584 | pub start1: u64, |
|
0 commit comments