void makeCactusTree_chain(Chain *chain, FILE *fileHandle,
        const char *parentNodeName, const char *parentEdgeColour) {
    //Write the flower nodes.
    char *chainNameString = cactusMisc_nameToString(chain_getName(chain));
    const char *edgeColour = graphViz_getColour();
    addNodeToGraph(chainNameString, fileHandle,
            chain_getAverageInstanceBaseLength(chain) / totalProblemSize,
            "box", chainNameString);
    //Write in the parent edge.
    if (parentNodeName != NULL) {
        graphViz_addEdgeToGraph(parentNodeName, chainNameString, fileHandle,
                "", parentEdgeColour, 10, 1, "forward");
    }
    //Create the linkers to the nested flowers.
    Link *link = chain_getFirst(chain);
    while(link != NULL) {
        Group *group = link_getGroup(link);
        assert(group != NULL);
        assert(!group_isLeaf(group));
        if (!group_isLeaf(group)) {
            makeCactusTree_flower(group_getNestedFlower(group), fileHandle,
                    chainNameString, edgeColour);
        }
        link = link_getNextLink(link);
    }
    free(chainNameString);
}
Exemple #2
0
static int flower_constructChainsP(const void *o1, const void *o2) {
    return cactusMisc_nameCompare(chain_getName((Chain *) o1), chain_getName((Chain *) o2));
}
void mapBlockToExon(Cap *cap, int level, FILE *fileHandle){
   fprintf(fileHandle, "\t\t\t<block>\n");
   Block *block = end_getBlock(cap_getEnd(cap));
   Chain *chain = block_getChain(block);
   int start = cap_getCoordinate(cap);
   int end = cap_getCoordinate(cap_getOtherSegmentCap(cap)) +1;
   fprintf(fileHandle, "\t\t\t\t<blockName>%s</blockName>\n", cactusMisc_nameToString(block_getName(block)));
   if(chain != NULL){
      fprintf(fileHandle, "\t\t\t\t<chainName>%s</chainName>\n", cactusMisc_nameToString(chain_getName(chain)));
   }else{
      fprintf(fileHandle, "\t\t\t\t<chainName>NA</chainName>\n");
   }
   fprintf(fileHandle, "\t\t\t\t<level>%d</level>\n", level);
   fprintf(fileHandle, "\t\t\t\t<start>%d</start>\n", start);
   fprintf(fileHandle, "\t\t\t\t<end>%d</end>\n", end);
   fprintf(fileHandle, "\t\t\t</block>\n");
   st_logInfo("mapBlockToExon: start: %d, end: %d\n", start, end);
}