Crate read_structure
source · [−]Expand description
Read structures is a library for working with strings that describe how the bases in a sequencing run should be allocated into logical reads.
Each read structure is made up of one or more read segments which are in turn a segment type.
For mor details see here
Example
Parsing a complex read structure.
use std::str::FromStr;
use read_structure::ReadStructure;
let rs = ReadStructure::from_str("76T8B8B76T").unwrap();
let templates: String = rs.templates().map(|s| s.to_string()).collect();
assert_eq!(templates, "76T76T");Extracting segments from an actual read based on the read structure:
use std::convert::TryFrom;
use std::str::FromStr;
use read_structure::{
ReadStructure,
SegmentType,
};
let read_sequence = b"\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGGGGGGGGCCCCCCCCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"
.to_vec();
let kind_of_interest = SegmentType::Template;
let rs = ReadStructure::from_str("76T8B8B76T").unwrap();
let mut sections = vec![];
for segment in rs.segments_by_type(kind_of_interest) {
sections.push(segment.extract_bases(read_sequence.as_slice()).unwrap())
}
assert_eq!(sections, vec![
b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
b"TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"
]);Structs
Helper struct for isolating the erroneous portion of a string.
The read segment describing a given kind (SegmentType), optional length, and offset of the
bases within a crate::read_structure::ReadStructure.
The read structure composed of one or more ReadSegments.
An iterator over the variants of Self
Enums
The SegmentType type. See the module level documentation for more.
Constants
A character that can be put in place of a number in a read structure to mean “1 or more bases”.
Defined for efficiency, same as ANY_LENGTH_BYTE.
A string that can be put in place of a number in a read structure to mean “1 or more bases”.