Ejemplo n.º 1
0
static void sequenceSetup() {
    metaSequence = metaSequence_construct(0, 10, "ACTGACTGAC", ">one",
            event_getName(eventTree_getRootEvent(eventTree)), cactusDisk);
    sequence = sequence_construct(metaSequence, flower);
    metaSequence2 = metaSequence_construct(0, 10, "ACTGACTGAC", ">two",
            event_getName(eventTree_getRootEvent(eventTree)), cactusDisk);
    sequence2 = sequence_construct(metaSequence2, flower);
}
Ejemplo n.º 2
0
static int64_t setCoordinates(Flower *flower, MetaSequence *metaSequence, Cap *cap, int64_t coordinate) {
    /*
     * Sets the coordinates of the reference thread and sets the bases of the actual sequence
     * that of the consensus.
     */
    Sequence *sequence = flower_getSequence(flower, metaSequence_getName(metaSequence));
    if (sequence == NULL) {
        sequence = sequence_construct(metaSequence, flower);
    }
    while (1) {
        assert(cap_getStrand(cap));
        assert(!cap_getSide(cap));
        Cap *adjacentCap = cap_getAdjacency(cap);
        assert(adjacentCap != NULL);
        assert(cap_getStrand(adjacentCap));
        assert(cap_getSide(adjacentCap));
        int64_t adjacencyLength = cap_getCoordinate(cap);
        assert(adjacencyLength == cap_getCoordinate(adjacentCap));
        assert(adjacencyLength != INT64_MAX);
        assert(adjacencyLength >= 0);
        cap_setCoordinates(cap, coordinate, 1, sequence);
        coordinate += adjacencyLength + 1;
        cap_setCoordinates(adjacentCap, coordinate, 1, sequence);
        //Traverse any block..
        if ((cap = cap_getOtherSegmentCap(adjacentCap)) == NULL) {
            break;
        }
        coordinate += segment_getLength(cap_getSegment(adjacentCap)) - 1;
    }
    return coordinate;
}
Ejemplo n.º 3
0
Sequence *sequence_loadFromBinaryRepresentation(void **binaryString, Flower *flower) {
	Sequence *sequence;

	sequence = NULL;
	if(binaryRepresentation_peekNextElementType(*binaryString) == CODE_SEQUENCE) {
		binaryRepresentation_popNextElementType(binaryString);
		sequence = sequence_construct(cactusDisk_getMetaSequence(flower_getCactusDisk(flower), binaryRepresentation_getName(binaryString)), flower);
	}
	return sequence;
}
Ejemplo n.º 4
0
void testEnd_getGroup(CuTest* testCase) {
    cactusEndTestSetup();
    Flower *flower2 = flower_construct(cactusDisk);
    eventTree_copyConstruct(eventTree, flower2, testEnd_copyConstructP);
    sequence_construct(metaSequence, flower2);
    End *end2 = end_copyConstruct(end, flower2);
    CuAssertTrue(testCase, end_getGroup(end) == NULL);
    Group *group = group_construct(flower, flower2);
    CuAssertTrue(testCase, end_getGroup(end) == group);
    CuAssertTrue(testCase, end_getGroup(end2) == NULL);
    cactusEndTestTeardown();
}
Ejemplo n.º 5
0
void testEnd_copyConstruct(CuTest* testCase) {
    cactusEndTestSetup();
    Flower *flower2 = flower_construct(cactusDisk);
    eventTree_copyConstruct(eventTree, flower2, testEnd_copyConstructP);
    sequence_construct(metaSequence, flower2);

    End *end2 = end_copyConstruct(end, flower2);
    CuAssertTrue(testCase, end_getName(end2) != NULL_NAME);
    CuAssertTrue(testCase, end_getName(end2) == end_getName(end));
    CuAssertTrue(testCase, flower_getEnd(flower2, end_getName(end2)) == end2);
    CuAssertTrue(testCase, cap_getName(end_getInstance(end2, cap_getName(rootCap))) == cap_getName(rootCap));
    CuAssertTrue(testCase, cap_getName(end_getInstance(end2, cap_getName(leaf1Cap))) == cap_getName(leaf1Cap));
    CuAssertTrue(testCase, cap_getName(end_getInstance(end2, cap_getName(leaf2Cap))) == cap_getName(leaf2Cap));
    cactusEndTestTeardown();
}
Ejemplo n.º 6
0
void processSequence(const char *fastaHeader, const char *string, int64_t length) {
    /*
     * Processes a sequence by adding it to the flower disk.
     */
    End *end1;
    End *end2;
    Cap *cap1;
    Cap *cap2;
    MetaSequence *metaSequence;
    Sequence *sequence;

    //Now put the details in a flower.
    metaSequence = metaSequence_construct(2, length, string, fastaHeader, event_getName(event), cactusDisk);
    sequence = sequence_construct(metaSequence, flower);

    end1 = end_construct2(0, isComplete, flower);
    end2 = end_construct2(1, isComplete, flower);
    cap1 = cap_construct2(end1, 1, 1, sequence);
    cap2 = cap_construct2(end2, length + 2, 1, sequence);
    cap_makeAdjacent(cap1, cap2);
    totalSequenceNumber++;
}