Skip to content

Commit 12fb1e1

Browse files
add read pair orientation (#25)
* add read pair orientation * fixes * fix serde derive * add missing use * fmt
1 parent 8b71a8b commit 12fb1e1

File tree

5 files changed

+53
-2
lines changed

5 files changed

+53
-2
lines changed

Cargo.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ quick-error = "1.2"
1818
regex = "1.0"
1919
lazy_static = "1.1"
2020
derive-new = "0.5"
21+
strum_macros = "0.20"

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ pub mod alignment;
1313
pub mod annot;
1414
pub mod genome;
1515
pub mod sequence;
16+
pub mod sequencing;
1617
pub mod strand;
1718
pub mod variant;

src/sequencing/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright 2021 Johannes Köster.
2+
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
3+
// This file may not be copied, modified, or distributed
4+
// except according to those terms.
5+
6+
//! This module provides types useful for investigating sequencing data.
7+
8+
pub mod read_pair_orientation;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2021 Johannes Köster.
2+
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
3+
// This file may not be copied, modified, or distributed
4+
// except according to those terms.
5+
6+
//! This module provides a representation for read pair orientation, which is
7+
//! a readout of read mapping.
8+
9+
#[cfg(feature = "serde")]
10+
use serde::{Deserialize, Serialize};
11+
use strum_macros::{AsRefStr, Display};
12+
13+
/// Representation of read pair orientation
14+
/// (e.g. F1R2 means that the forward read comes first on the reference contig,
15+
/// followed by the reverse read, on the same contig).
16+
///
17+
/// This enum can be pretty-printed into a readable string repesentation:
18+
///
19+
/// ```rust
20+
/// use bio_types::sequencing::read_pair_orientation::ReadPairOrientation;
21+
///
22+
/// // format into string
23+
/// println!("{}", ReadPairOrientation::F1R2);
24+
/// // obtain string via `AsRef<&'static str>`
25+
/// assert_eq!(ReadPairOrientation::R1F2.as_ref(), "R1F2");
26+
/// ```
27+
#[derive(Debug, Clone, Copy, PartialEq, Eq, AsRefStr, Display)]
28+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
29+
pub enum ReadPairOrientation {
30+
F1R2,
31+
F2R1,
32+
R1F2,
33+
R2F1,
34+
F1F2,
35+
R1R2,
36+
F2F1,
37+
R2R1,
38+
None,
39+
}

0 commit comments

Comments
 (0)