# Spec Generic CyclicShape
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

- `carePositions`
- `cyclicShapeToString`
- `cyclicShapeToSuffixLengths`
- `weight`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From CyclicShape

- `Size`

## Member Variable Overview

- `String<TSize> GenericCyclicShape::diffs`
  Distances between care positions.

### Member Variables Inherited From CyclicShape

- `loffset`
- `span`

## 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/modifier.h>
    #include <seqan/stream.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: " << (int)weight(shape);
        std::cout << ", span: " << (int)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/dox/modifier/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

- ModCyclicShapeModifiedIterator
- ModCyclicShapeModifiedString

## 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/dox/modifier/cyclic_shape_snippets.cpp

@Remarks

If you want to generate a GenericCyclicShape from a FixedCyclicShape, use cyclicShapeToString and stringToCyclicShape

#### Data Races

Thread safety unknown!

## 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.

#### Data Races

Thread safety unknown!

## 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.

#### Dox Sources

    /*!
     * @class GenericCyclicShape Generic CyclicShape
     *
     * @extends CyclicShape
     *
     * @headerfile <seqan/modifier.h>
     *
     * @brief CyclicShape initiated at runtime.
     *
     * @signature template <> class CyclicShape<GenericShape>;
     *
     * @tparam TSize Size type of the CyclicShape
     *
     * Generic Shapes can be easily created using <tt>stringToCyclicShape</tt>, but
     * their usage comes with a significant loss in efficiency. For longer
     * sequences, prefer the @link FixedCyclicShape @endlink.
     *
     * @section Examples
     *
     * @include demos/dox/modifier/cyclic_shape.cpp
     *
     * The output is as follows:
     *
     * @include demos/dox/modifier/cyclic_shape.cpp.stdout
     *
     * @see ModCyclicShapeModifiedString
     * @see ModCyclicShapeModifiedIterator
     *
     * @fn GenericCyclicShape::CyclicShape
     *
     * @brief The constructor
     *
     * @signature CyclicShape();
     * @signature CyclicShape(shape);
     *
     * @param[in] shape A GenericCyclicShape to be copied.
     *
     * The default constructor generates the pattern "1". The copy constructor
     * copies the GenericCyclicShape shape.
     *
     * @snippet demos/dox/modifier/cyclic_shape_snippets.cpp Define GenericCyclicShape
     *
     * @Remarks
     *
     * If you want to generate a GenericCyclicShape from a FixedCyclicShape, use
     * @link CyclicShape#cyclicShapeToString @endlink and @link
     * GenericCyclicShape#stringToCyclicShape @endlink
     *
     * @var String<TSize> GenericCyclicShape::diffs;
     *
     * @brief Distances between care positions.
     *
     * <tt>diffs</tt> has <i>weight</i> 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.
     *
     * @fn GenericCyclicShape#stringToCyclicShape
     *
     * @headerfile <seqan/modifier.h>
     *
     * @brief Converts a 0/1 string to a Generic CyclicShape.
     *
     * @signature void stringToCyclicShape(shape, bitmap);
     *
     * @tparam TString A string type, e.g. CharString.
     *
     * @param[out] shape Generic CyclicShape
     * @param[in] bitmap 0/1 string of type TString. CyclicShapes may start and end
     *                   with zeros, but must contain at least one 1.
     */