Spec
Generic CyclicShapeCyclicShape initiated at runtime.
CyclicShape initiated at runtime.
Extends | CyclicShape |
---|---|
All Extended | CyclicShape |
Defined in | <seqan/modifier.h> |
Signature |
template <>
class CyclicShape<GenericShape>;
|
Template Parameters
TSize |
Size type of the CyclicShape |
---|
Member Function Overview
-
CyclicShape();, CyclicShape(shape);
The constructor
Interface Function Overview
-
void stringToCyclicShape(shape, bitmap);
Converts a 0/1 string to a Generic CyclicShape.
Interface Functions Inherited From CyclicShape
Member Variable Overview
-
String<TSize> GenericCyclicShape::diffs
Distances between care positions.
Member Variables Inherited From CyclicShape
Detailed Description
Generic Shapes can be easily created using stringToCyclicShape, but their usage comes with a significant loss in efficiency. For longer sequences, prefer the FixedCyclicShape.
Examples
#include <seqan/file.h> #include <seqan/modifier.h> using namespace seqan; int main(int argc, char const ** argv) { // create a (generic) CyclicShape typedef CyclicShape<GenericShape> TShape; TShape shape; stringToCyclicShape(shape, "1110010"); // print cyclic Shape CharString out; cyclicShapeToString(out, shape); std::cout << "shape: " << out << std::endl; // determine weight and span std::cout << "weight: " << weight(shape) << ", span: " << shape.span << std::endl; // modify a text to leave out characters CharString str = "this is an original string"; ModifiedString<CharString, ModCyclicShape<TShape> > modStr (str, shape); // modStr can be used like a normal String std::cout << str << " => " << modStr << std::endl; std::cout << "length: " << length(str) << " => " << length(modStr) << std::endl; return 0; }
Demo: demos/cyclic_shape.cpp
The output is as follows:
shape: 1110010 weight: 4, span: 7 this is an original string => thii anrgin tri length: 26 => 15
See Also
Member Functions Detail
CyclicShape();
CyclicShape(shape);
The constructor
Parameters
shape
|
A GenericCyclicShape to be copied. |
---|
The default constructor generates the pattern "1". The copy constructor copies the GenericCyclicShape shape.
typedef CyclicShape<GenericShape> TShape; TShape shape; stringToCyclicShape(shape, "00111001010");
Snippet from: demos/cyclic_shape_snippets.cpp
@Remarks
If you want to generate a GenericCyclicShape from a FixedCyclicShape, use cyclicShapeToString and stringToCyclicShape
Interface Functions Detail
void stringToCyclicShape(shape, bitmap);
Converts a 0/1 string to a Generic CyclicShape.
Template Parameters
TString |
A string type, e.g. CharString. |
---|
Parameters
shape
|
Generic CyclicShape |
---|---|
bitmap
|
0/1 string of type TString. CyclicShapes may start and end with zeros, but must contain at least one 1. |
Member Variables Detail
String<TSize> GenericCyclicShape::diffs
Distances between care positions.
diffs has weight many non-zero entries describing the size of the gap after a care-position. The last entry holds the cyclic distance from the last "1" to the first one.