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 more 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::str::FromStr;
use read_structure::{ReadStructure, SegmentType, SkipHandling};
let bases = b"\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGGGGGGGGCCCCCCCCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT";
let quals = &[b'I'; 168][..];
let rs = ReadStructure::from_str("76T8B8B76T").unwrap();
let templates: Vec<&[u8]> = rs.extract(bases, quals, SkipHandling::Exclude)
.unwrap()
.filter(|(seg, _, _)| seg.kind == SegmentType::Template)
.map(|(_, bases, _)| bases)
.collect();
assert_eq!(templates, vec![
&b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"[..],
&b"TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"[..],
]);Structs§
- Error
Message Parts - Helper struct for isolating the erroneous portion of a string.
- Extracted
Segments - Iterator returned by
ReadStructure::extract. - Read
Segment - A single segment of a read structure: a segment type and an optional fixed length.
- Read
Structure - A read structure made up of one or more
ReadSegments. - Segment
Type Iter - An iterator over the variants of SegmentType
Enums§
- Read
Structure Error - Segment
Type - The
SegmentTypetype. See the module level documentation for more. - Skip
Handling - Controls whether
SegmentType::Skipsegments are emitted byReadStructure::extract.
Constants§
- ANY_
LENGTH_ BYTE - A character that can be put in place of a number in a read structure to mean “1 or more bases”.
- ANY_
LENGTH_ BYTE_ SLICE - Defined for efficiency, same as
ANY_LENGTH_BYTE. - ANY_
LENGTH_ STR - A string that can be put in place of a number in a read structure to mean “1 or more bases”.