Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
gamgee::Interval Class Reference

Utility class to store an genomic location (Interval). More...

#include <interval.h>

Public Types

enum  IntervalType { IntervalType::GATK, IntervalType::PICARD, IntervalType::BED }
 supported output formats for an Interval More...
 

Public Member Functions

 Interval ()
 creates an interval with standard values More...
 
 Interval (const std::string &chr, const uint32_t start, const uint32_t stop, const IntervalType output_type=IntervalType::GATK)
 creates an interval with all parameters More...
 
 Interval (const Interval &)=default
 
 Interval (Interval &&)=default
 
Intervaloperator= (const Interval &)=default
 
Intervaloperator= (Interval &&)=default
 
bool operator== (const Interval &rhs) const
 Checks two Intervals for equality. More...
 
bool operator!= (const Interval &rhs) const
 Checks two intervals for inequality. More...
 
uint32_t size () const
 calculates the number of loci in the Intervals More...
 
std::vector< Intervaltile_left (const uint32_t tile_size, const uint32_t spacing) const
 Tiles an Interval with smaller Intervals anchoring (starting) on the left side (start) of the Interval. More...
 
std::vector< Intervaltile_right (const uint32_t tile_size, const uint32_t spacing) const
 Tiles an Interval with smaller Intervals anchoring (starting) on the right side (stop) of the Interval. More...
 
std::vector< Intervaltsca_tiling (const uint32_t spacing, const uint32_t insert_size, const uint32_t flanking) const
 creates tiling TSCA baits (small intervals with an insert in between) that tile across the entire Interval with overlaps More...
 
std::string str () const
 returns a string representation of the interval More...
 
std::string chr () const
 
uint32_t start () const
 
uint32_t stop () const
 
IntervalType output_type () const
 
void set_chr (const std::string &chr)
 
void set_start (const uint32_t start)
 
void set_stop (const uint32_t stop)
 
void set_output_type (const IntervalType output_type)
 

Detailed Description

Utility class to store an genomic location (Interval).

An Interval can be of one or many consecutive bases in a chromosome (contig). We represent Intervals with chromosome, start and stop. A one base Interval has start == stop. No Interval can go beyond a chromosome boundary.

The Interval can be output to any output stream (e.g. stdout, file, ...) in any of the supported interval formats.

Member Enumeration Documentation

supported output formats for an Interval

Enumerator
GATK 

GATK format – chr:start-stop.

PICARD 

PICARD format – chr [tab] start [tab] stop [tab] strand [tab] comments.

BED 

BED format – chr [tab] start [tab] stop.

Constructor & Destructor Documentation

gamgee::Interval::Interval ( )
inline

creates an interval with standard values

chromosome, start and stop are all set to 0. Output type is IntervalType::GATK.

gamgee::Interval::Interval ( const std::string &  chr,
const uint32_t  start,
const uint32_t  stop,
const IntervalType  output_type = IntervalType::GATK 
)
inlineexplicit

creates an interval with all parameters

Parameters
chrchromosome
startstart location (inclusive)
stopstop location (inclusive)
output_typedesired output format (only used if Interval is sent to output stream)
gamgee::Interval::Interval ( const Interval )
default
gamgee::Interval::Interval ( Interval &&  )
default

Member Function Documentation

std::string gamgee::Interval::chr ( ) const
inline
bool gamgee::Interval::operator!= ( const Interval rhs) const
inline

Checks two intervals for inequality.

Implementation is the negation of operator==

Returns
true if the two intervals don't have the same values in any of their member variables
Interval& gamgee::Interval::operator= ( const Interval )
default
Interval& gamgee::Interval::operator= ( Interval &&  )
default
bool gamgee::Interval::operator== ( const Interval rhs) const

Checks two Intervals for equality.

Parameters
rhsthe other Interval to compare to
Returns
whether or not the two Intervals have the same chromosome, start and stop. Output type is irrelevant.
IntervalType gamgee::Interval::output_type ( ) const
inline
void gamgee::Interval::set_chr ( const std::string &  chr)
inline
void gamgee::Interval::set_output_type ( const IntervalType  output_type)
inline
void gamgee::Interval::set_start ( const uint32_t  start)
inline
void gamgee::Interval::set_stop ( const uint32_t  stop)
inline
uint32_t gamgee::Interval::size ( ) const
inline

calculates the number of loci in the Intervals

Returns
stop() - start() + 1
uint32_t gamgee::Interval::start ( ) const
inline
uint32_t gamgee::Interval::stop ( ) const
inline
std::string gamgee::Interval::str ( ) const

returns a string representation of the interval

vector< Interval > gamgee::Interval::tile_left ( const uint32_t  tile_size,
const uint32_t  spacing 
) const

Tiles an Interval with smaller Intervals anchoring (starting) on the left side (start) of the Interval.

Warning: by design, the Interval may or may not be covered on the right (stop) side depending on the length of the original Interval and the parameters passed.

Returns
a vector of Intervals covering the original Interval spaced by spacing loci in between them
Parameters
tile_sizesize of the tiles (small Intervals) to be generated
spacinghow many loci to leave in between the tiles (small Intervals)
vector< Interval > gamgee::Interval::tile_right ( const uint32_t  tile_size,
const uint32_t  spacing 
) const

Tiles an Interval with smaller Intervals anchoring (starting) on the right side (stop) of the Interval.

Warning: by design, the Interval may or may not be covered on the left (start) side depending on the length of the original Interval and the parameters passed.

Returns
a vector of Intervals covering the original Interval spaced by spacing loci in between them
Parameters
tile_sizesize of the tiles (small Intervals) to be generated
spacinghow many loci to leave in between the tiles (small Intervals)
vector< Interval > gamgee::Interval::tsca_tiling ( const uint32_t  spacing,
const uint32_t  insert_size,
const uint32_t  flanking 
) const

creates tiling TSCA baits (small intervals with an insert in between) that tile across the entire Interval with overlaps

This tiling procedure will guarantee that the entire Interval is covered (tiled) by creating a list of overlapping tiles that can be used as baits if the design of the overlapping baits is split between the forward and reverse strands of the reference genome. The overlapping bait will always be centered in the spacing between the two baits in the opposite strand.

Returns
a vector of baits / tiles / small intervals that fully cover the original Interval with overlaps.
Parameters
spacingnumber of loci in between the tiles
insert_sizeinsert size intended to be used with these baits
flankingregion before and after the target to include in the tiling

The documentation for this class was generated from the following files: