SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
shore::alignment_helper Class Reference

Alignment string utilities. More...

Public Member Functions

size_t extract_ref (const std::string &alignment, std::string &ref)
 Extract the sequence of the reference ([L*]/[F*] bases are ignored!). More...
 
size_t extract_qry (const std::string &alignment, std::string &qry, const bool include_softclipped=false)
 Extract the sequence of the query. More...
 
void extract_seq (const std::string &alignment, std::string &ref, std::string &qry, const bool include_softclipped=false)
 Combines extract_ref() & extract_qry().
 
size_t calc_size_of_qry (const std::string &alignment, const bool include_softclipped=false)
 Calculates the size of the query sequence.
 
size_t calc_size_on_ref (const std::string &alignment)
 Calculates the length of the range on the reference sequence.
 
int calc_editdistance (const std::string &alignment)
 Calculates the edit distance from an alignment string.
 
std::pair< int, int > calc_indels (const std::string &alignment)
 Calculates the number of insertions and deletions from an alignment string.
 
int move_start_by_qrybases (std::string &alignment, int nbases)
 Remove/add a number of query bases at the left side of an alignment string. More...
 
int move_start_by_refbases (std::string &alignment, int nbases)
 Remove/add a number of reference bases at the left side of an alignment string. More...
 
int move_end_by_qrybases (std::string &alignment, int nbases)
 Remove/add a number of query bases at the right side of an alignment string. More...
 
int move_end_by_refbases (std::string &alignment, int nbases)
 Remove/add a number of reference bases at the right side of an alignment string. More...
 
void rebuild (std::string &alignment)
 Rebuild an alignment string in the most compact representation.
 
void invert (std::string &alignment)
 Swap query and reference sequence.
 
void revcomp (std::string &alignment)
 Reverse complement an alignment string.
 
void paste (std::string &alignment, const std::string &other, int distance=0, bool inv=false, bool forcefrag=true, bool nomove=false)
 Join alignment strings adding a given distance. More...
 
void cigar (const std::string &alignment, std::string &cigar, const char sep=0)
 Append CIGAR string for the alignment string somewhere. More...
 
size_t calc_size_on_ref (const shore::alignment &a)
 Calculates the length of the alignment on the reference sequence.
 
long calc_end_excl (const shore::alignment &a)
 Calculates the exclusive end position on the reference.
 
shore::refseq_coor calc_end_coor_excl (const shore::alignment &a)
 Calculates the exclusive end position on the reference.
 
void resize (shore::alignment &f, const size_t newsize)
 Appends or removes bases at the query's 3' end.
 

Static Public Member Functions

static std::string compose (alignment_tokenizer &ref, alignment_tokenizer &qry)
 Put two alignments on top of each other.
 

Detailed Description

Alignment string utilities.

Member Function Documentation

void shore::alignment_helper::cigar ( const std::string &  alignment,
std::string &  cigar,
const char  sep = 0 
)

Append CIGAR string for the alignment string somewhere.

Parameters
[in]alignmentAlignment string.
[out]cigarCIGAR string.
sepOptional separator for cigar items.
size_t shore::alignment_helper::extract_qry ( const std::string &  alignment,
std::string &  qry,
const bool  include_softclipped = false 
)

Extract the sequence of the query.

(never reverse complemented, strand is unknown anyway).

Returns
Same as calc_size_on_ref()
size_t shore::alignment_helper::extract_ref ( const std::string &  alignment,
std::string &  ref 
)

Extract the sequence of the reference ([L*]/[F*] bases are ignored!).

Returns
Same as calc_size_of_qry()
int shore::alignment_helper::move_end_by_qrybases ( std::string &  alignment,
int  nbases 
)

Remove/add a number of query bases at the right side of an alignment string.

Returns
The number of bases the alignment end has moved to the right on the reference sequence.
int shore::alignment_helper::move_end_by_refbases ( std::string &  alignment,
int  nbases 
)

Remove/add a number of reference bases at the right side of an alignment string.

Returns
The number of bases that were added at the end of the query.
int shore::alignment_helper::move_start_by_qrybases ( std::string &  alignment,
int  nbases 
)

Remove/add a number of query bases at the left side of an alignment string.

Returns
The number of bases the alignment has moved to the right on the reference sequence.
int shore::alignment_helper::move_start_by_refbases ( std::string &  alignment,
int  nbases 
)

Remove/add a number of reference bases at the left side of an alignment string.

Returns
The number of bases that were removed at the start of the query.
void shore::alignment_helper::paste ( std::string &  alignment,
const std::string &  other,
int  distance = 0,
bool  inv = false,
bool  forcefrag = true,
bool  nomove = false 
)

Join alignment strings adding a given distance.

Parameters
alignmentString being modified.
otherString to append.
distanceDistance between the alignments (may be negative).
invIndicate the alignments had different directions (use [f.. instead of [F..).
forcefragInsert [F0] token if distance <= 0.
nomoveFor overlapping strings (distance < 0), insert [F-N] instead of truncating the string.

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