Spec AlignmentGraph
Alignment graph type.

Extends Graph
All Extended Graph
All Impl'd AssignableConcept, ContainerConcept, DestructibleConcept
Defined in <seqan/graph_align.h>
Signature template <typename TStringSet[, typename TCargo[, typename TSpec]]> class Graph<Alignment<TStringSet, TCargo, TSpec> >;

Template Parameters

TStringSet The type of the StringSet containing the sequence information. Must be a DependentStringSet.
TCargo The cargo type that can be attached to edges. Default: unsigned.
TSpec The specializing type. Default: Default. Use WithoutEdgeId here to omit edge ids. NB: if edges do not store ids then external property maps do not work.

Member Function Overview

Member Functions Inherited From AssignableConcept

Interface Function Overview

Interface Functions Inherited From Graph

Interface Functions Inherited From AssignableConcept

Interface Functions Inherited From ContainerConcept

Interface Metafunction Overview

Interface Metafunctions Inherited From Graph

Interface Metafunctions Inherited From ContainerConcept

Detailed Description

Example

#include <iostream>

#include <seqan/basic.h>
#include <seqan/file.h>
#include <seqan/align.h>
#include <seqan/graph_align.h>

int main()
{
    using namespace seqan;

    typedef StringSet<DnaString, Dependent<> > TStringSet;
    typedef Graph<Alignment<TStringSet, void> > TAlignmentGraph;

    // Define scorings scheme.
    //
    // In this case, affine gap costs with match = 0, mismatch = -1,
    // gapextend = -1 and gapopen = -2.
    Score<int> scoringScheme(0, -1, -1, -2);

    // Define the two sequence to be allocated.
    DnaString seq1 = "atcgaatgcgga";
    DnaString seq2 = "actcgttgca";

    // Create StringSet with these two sequences and construct an
    // AlignmentGraph for them.
    TStringSet stringSet;
    appendValue(stringSet, seq1);
    appendValue(stringSet, seq2);
    TAlignmentGraph alignmentGraph(stringSet);

    // Compute global alignment of seq1 and seq1 using Gotoh's algorithm and
    // print score and alignment graph.
    int score = globalAlignment(alignmentGraph, scoringScheme, Gotoh());
    std::cout << "Score = " << score << "\n"
              << alignmentGraph << std::endl;
    return 0;
}
Score = -8
Alignment matrix:
      0     .    :   
        ATCGAATGCGGA
        |     |||  |
        ACTCGTTGC--A

Interface Functions Detail

void assignStringSet(g, stringSet);

Assigns a new StringSet to an AlignmentGraph.

Parameters

g An AlignmentGraph.
stringSet The StringSet to assign to.

See Also

bool convertAlignment(g, component, order, compLength); bool convertAlignment(g, matrix);

Converts an alignment graph into an alignment matrix.

Parameters

g AlignmentGraph to convert. An alignment graph.
component Vertex to component mapping.
order The order of the component graph when sorting topologically.
compLength Component sizes.
matrix A string that represents an alignment matrix.

Returns

bool true iff the alignment graph is a valid alignment and false otherwise.

Remarks

The variant with component and order computes a topological sorting of connected components.

TVertexDescriptor findVertex(ag, id, pos);

Finds a vertx given a sequence id and a position.

Parameters

ag The AlignmentGraph to search in.
id The sequence id to search for.
pos The position to search for.

Returns

TVertexDescriptor The vertex covering the given position on the specified sequence, getNil<TVertexDescriptor>() if none could be found.

TPos fragmentBegin(ag, v);

Gets the begin position for this vertex descriptor in the sequence.

Parameters

ag The AlignmentGraph to query.
v The vertex descriptor of the vertex.

Returns

TPos The begin position.

TSize fragmentLength(ag, v);

Gets the length of the fragment for this vertex descriptor in the sequence.

Parameters

ag The AlignmentGraph to query.
v The vertex descriptor of the vertex.

Returns

TPos The fragment size.

void getDistanceMtarix(graph, mat[, tag]); void getDistanceMtarix(graph, mat[, kTup][, alphabet], KmerDistance);

Computes a pairwise distance matrix from an AlignmentGraph.

Parameters

graph An AlignmentGraph containing the sequences and possible alignment edges.
mat Pairwise distance matrix.
kTup For KMerDistance, the length of the k-mers.
alphabet For KMerDistance, the alphabet to use for k-mer counting (e.g. compressed alphabets).
tag See DistanceCalculationTags. Default: KMerDistance.

TPos getFirstCoveredPosition(ag, id);

Finds the first position in a sequence that is not assigned to a nil vertex.

Parameters

ag An AlignmentGraph.
id A sequence id.

Returns

TPos A sequence position.

See Also

TPos getLastCoveredPosition(ag, id);

Finds the last position in a sequence that is not assigned to a nil vertex.

Parameters

ag An AlignmentGraph.
id A sequence id.

Returns

TPos A sequence position.

See Also

getProjectedPosition(ag, seqId, pos, seqId2, pos2);

Projects a position of one sequence taking part in a pairwise match onto the other sequence.

Parameters

ag The AlignmentGraph to query.
seqId The sequenceId.
pos The position to project from.
seqId2 The resulting id of the sequence that was projected onto.
pos2 The reuslting position of the sequence was was projected onto.

THost getStringSet(g);

Gets the StringSet of an AlignmentGraph.

Parameters

g An AlignmentGraph.

Returns

THost A const reference to the StringSet's host.

See Also

TInfix label(ag, v);

Get the label associated with this vertex descriptor or the sequence that is associated with a fragment.

Parameters

ag The AlignmentGraph to query.
v The vertex descriptor to query.

Returns

TInfix An infix representing the sequence label.

TId sequenceId(ag, v);

Gets the sequence id that is associated with this vertex descriptor or with a sequence of a fragment.

Parameters

ag The AlignmentGraph.
v Vertex descriptor of the vertex to retrieve sequence id for.

Returns

TId The sequence id.

THostRef stringSet(g);

Return reference to the StringSet of an AlignmentGraph.

Parameters

g An AlignmentGraph.

Returns

THost A reference to the StringSet's host.

See Also