mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-10-08 03:58:12 +08:00
clean code
This commit is contained in:
@@ -4,27 +4,6 @@
|
||||
#include "Hash_Table.h"
|
||||
#include "Process_Read.h"
|
||||
|
||||
/**
|
||||
1. 单个节点信息
|
||||
(1) ID
|
||||
(2) base
|
||||
(3) 入边信息
|
||||
(4) 出边信息
|
||||
(5) 比对到什么节点
|
||||
2. 各个节点信息,用数组下标组织,数组下标就是节点ID; 还要存拓扑排序后的下标和节点ID的对应关系
|
||||
3. 边
|
||||
(1) 边的起始
|
||||
(2) 边的结束节点
|
||||
(3) 过这条边的序列的label,也就是名称
|
||||
4. 各个序列信息
|
||||
(1) 这个序列本身
|
||||
(2) 这个序列的name或者ID
|
||||
(3) 这个序列的在图中对应的起始和结束节点ID
|
||||
5. 有两个回溯矩阵,一个是graph的,一个是seq的
|
||||
**/
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long long beg;
|
||||
@@ -141,10 +120,9 @@ typedef struct
|
||||
{
|
||||
uint64_t in_node;
|
||||
uint64_t out_node;
|
||||
///0是match,1是mismatch,2是x缺字符(y多字符),而3是y缺字符(x多字符)
|
||||
///0 is match,1 is mismatch,2 means y has more bases, 3 means x has more bases
|
||||
uint64_t weight;
|
||||
uint64_t num_insertions;
|
||||
///这条路径上到backbone节点之前总共有多少节点
|
||||
uint64_t length;
|
||||
uint64_t self_edge_ID;
|
||||
uint64_t reverse_edge_ID;
|
||||
@@ -180,7 +158,7 @@ typedef struct
|
||||
{
|
||||
uint64_t ID;
|
||||
uint64_t weight;
|
||||
///记录的是以当前节点为尾的deletion个数
|
||||
///number of deletion end with current node
|
||||
uint64_t num_insertions;
|
||||
char base;
|
||||
Edge_alloc mismatch_edges;
|
||||
@@ -245,18 +223,20 @@ inline int Pop_Node(Graph* DAGCon, Node** node)
|
||||
inline int Push_Node(Graph* DAGCon, Node** node)
|
||||
{
|
||||
push_to_Queue(&(DAGCon->node_q), (**node).ID);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int getInputNodes(RSet* set, Graph* graph, Node* node, Node** get_Node)
|
||||
{
|
||||
if(set->index >= Input_Edges(*node).length)
|
||||
if(set->index >= (long long)Input_Edges(*node).length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
///skip all deleted edges
|
||||
while (
|
||||
set->index < Input_Edges(*node).length
|
||||
set->index < (long long)Input_Edges(*node).length
|
||||
&&
|
||||
!(If_Edge_Exist(Input_Edges(*node).list[set->index]))
|
||||
)
|
||||
@@ -266,7 +246,7 @@ inline int getInputNodes(RSet* set, Graph* graph, Node* node, Node** get_Node)
|
||||
|
||||
|
||||
if(
|
||||
set->index < Input_Edges(*node).length
|
||||
set->index < (long long)Input_Edges(*node).length
|
||||
&&
|
||||
If_Edge_Exist(Input_Edges(*node).list[set->index])
|
||||
)
|
||||
@@ -285,14 +265,14 @@ inline int getInputNodes(RSet* set, Graph* graph, Node* node, Node** get_Node)
|
||||
|
||||
inline int getInputEdges(RSet* set, Graph* graph, Node* node, Edge** get_Edge)
|
||||
{
|
||||
if(set->index >= Input_Edges(*node).length)
|
||||
if(set->index >= (long long)Input_Edges(*node).length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
///skip all deleted edges
|
||||
while (
|
||||
set->index < Input_Edges(*node).length
|
||||
set->index < (long long)Input_Edges(*node).length
|
||||
&&
|
||||
!(If_Edge_Exist(Input_Edges(*node).list[set->index]))
|
||||
)
|
||||
@@ -302,7 +282,7 @@ inline int getInputEdges(RSet* set, Graph* graph, Node* node, Edge** get_Edge)
|
||||
|
||||
|
||||
if(
|
||||
set->index < Input_Edges(*node).length
|
||||
set->index < (long long)Input_Edges(*node).length
|
||||
&&
|
||||
If_Edge_Exist(Input_Edges(*node).list[set->index])
|
||||
)
|
||||
@@ -320,14 +300,14 @@ inline int getInputEdges(RSet* set, Graph* graph, Node* node, Edge** get_Edge)
|
||||
|
||||
inline int getOutputNodes(RSet* set, Graph* graph, Node* node, Node** get_Node)
|
||||
{
|
||||
if(set->index >= Output_Edges(*node).length)
|
||||
if(set->index >= (long long)Output_Edges(*node).length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
///skip all deleted edges
|
||||
while (
|
||||
set->index < Output_Edges(*node).length
|
||||
set->index < (long long)Output_Edges(*node).length
|
||||
&&
|
||||
!(If_Edge_Exist(Output_Edges(*node).list[set->index]))
|
||||
)
|
||||
@@ -335,7 +315,7 @@ inline int getOutputNodes(RSet* set, Graph* graph, Node* node, Node** get_Node)
|
||||
set->index++;
|
||||
}
|
||||
|
||||
if(set->index < Output_Edges(*node).length &&
|
||||
if(set->index < (long long)Output_Edges(*node).length &&
|
||||
If_Edge_Exist(Output_Edges(*node).list[set->index]))
|
||||
{
|
||||
(*get_Node) = &(G_Node((*graph), Output_Edges(*node).list[set->index].out_node));
|
||||
@@ -352,14 +332,14 @@ inline int getOutputNodes(RSet* set, Graph* graph, Node* node, Node** get_Node)
|
||||
|
||||
inline int getOutputEdges(RSet* set, Graph* graph, Node* node, Edge** get_Edge)
|
||||
{
|
||||
if(set->index >= Output_Edges(*node).length)
|
||||
if(set->index >= (long long)Output_Edges(*node).length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
///skip all deleted edges
|
||||
while (
|
||||
set->index < Output_Edges(*node).length
|
||||
set->index < (long long)Output_Edges(*node).length
|
||||
&&
|
||||
!(If_Edge_Exist(Output_Edges(*node).list[set->index]))
|
||||
)
|
||||
@@ -367,7 +347,7 @@ inline int getOutputEdges(RSet* set, Graph* graph, Node* node, Edge** get_Edge)
|
||||
set->index++;
|
||||
}
|
||||
|
||||
if(set->index < Output_Edges(*node).length &&
|
||||
if(set->index < (long long)Output_Edges(*node).length &&
|
||||
If_Edge_Exist(Output_Edges(*node).list[set->index]))
|
||||
{
|
||||
(*get_Edge) = &(Output_Edges(*node).list[set->index]);
|
||||
@@ -389,9 +369,9 @@ inline void get_bi_direction_edges(Graph* DAGCon, Edge* edge, Edge** e_forward,
|
||||
if(
|
||||
edge->self_edge_ID < Output_Edges(G_Node(*DAGCon, in_node)).length
|
||||
&&
|
||||
Output_Edges(G_Node(*DAGCon, in_node)).list[edge->self_edge_ID].in_node == in_node
|
||||
(long long)Output_Edges(G_Node(*DAGCon, in_node)).list[edge->self_edge_ID].in_node == in_node
|
||||
&&
|
||||
Output_Edges(G_Node(*DAGCon, in_node)).list[edge->self_edge_ID].out_node == out_node
|
||||
(long long)Output_Edges(G_Node(*DAGCon, in_node)).list[edge->self_edge_ID].out_node == out_node
|
||||
)
|
||||
{
|
||||
(*e_forward) = &(Output_Edges(G_Node(*DAGCon, in_node)).list[edge->self_edge_ID]);
|
||||
@@ -456,10 +436,7 @@ void destory_Graph(Graph* g);
|
||||
void clear_Graph(Graph* g);
|
||||
void Perform_POA(Graph* g, overlap_region_alloc* overlap_list, All_reads* R_INF, UC_Read* g_read);
|
||||
|
||||
void Graph_debug(Graph* backbone, long long currentNodeID, char* x_string, long long x_length,
|
||||
char* y_string, long long y_length, CIGAR* cigar, long long backbone_start, long long backbone_end);
|
||||
|
||||
void debug_graph(Graph* g, long long backbone_length);
|
||||
|
||||
uint64_t inline add_Node_Graph(Graph* g, char base)
|
||||
{
|
||||
@@ -503,26 +480,28 @@ uint64_t inline delete_Node_DAGCon(Graph* g, Node* node)
|
||||
clear_Edge_alloc(&(g->g_nodes.list[(*node).ID].insertion_edges));
|
||||
clear_Edge_alloc(&(g->g_nodes.list[(*node).ID].mismatch_edges));
|
||||
clear_Edge_alloc(&(g->g_nodes.list[(*node).ID].deletion_edges));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///仅仅用于误配边
|
||||
///just for mimatch edges
|
||||
inline void add_mismatchEdge_weight(Graph* g, uint64_t in_node, char base, int last_operation)
|
||||
{
|
||||
long long i = 0;
|
||||
long long nodeID;
|
||||
Edge_alloc* edge = &(g->g_nodes.list[in_node].mismatch_edges);
|
||||
|
||||
for (i = 0; i < edge->length; i++)
|
||||
for (i = 0; i < (long long)edge->length; i++)
|
||||
{
|
||||
nodeID = edge->list[i].out_node;
|
||||
if(g->g_nodes.list[nodeID].base == base)
|
||||
{
|
||||
edge->list[i].weight++;
|
||||
///如果上一个操作是insertion
|
||||
///if last operation is insertion
|
||||
if (last_operation == 2)
|
||||
{
|
||||
edge->list[i].num_insertions++;
|
||||
@@ -532,25 +511,22 @@ inline void add_mismatchEdge_weight(Graph* g, uint64_t in_node, char base, int l
|
||||
}
|
||||
}
|
||||
|
||||
///说明不存在这么一条边
|
||||
if (i == edge->length)
|
||||
///there are no such edge
|
||||
if (i == (long long)edge->length)
|
||||
{
|
||||
nodeID = add_Node_Graph(g, base);
|
||||
|
||||
///只有match边长度是0
|
||||
///mismatch边长度都是1
|
||||
///the length of match edge is 0, while the length of mismatch edge is 1
|
||||
append_Edge_alloc(edge, in_node, nodeID, 1, 1);
|
||||
///如果上一个操作是insertion
|
||||
///if last operation is insertion
|
||||
if (last_operation == 2)
|
||||
{
|
||||
edge->list[edge->length - 1].num_insertions++;
|
||||
}
|
||||
|
||||
///将新节点的mismatch_edges连到backbone上
|
||||
///add the mismatch_edges of new node to the backbone
|
||||
append_Edge_alloc(&(g->g_nodes.list[nodeID].mismatch_edges), nodeID, in_node + 1, 1, 0);
|
||||
}
|
||||
///获得节点的mismatch_edges长度为1,其他均为0
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -561,7 +537,7 @@ inline void add_single_deletionEdge_weight(Graph* g, long long alignNodeID, long
|
||||
long long nodeID;
|
||||
Edge_alloc* edge = &(g->g_nodes.list[alignNodeID].deletion_edges);
|
||||
|
||||
for (i = 0; i < edge->length; i++)
|
||||
for (i = 0; i < (long long)edge->length; i++)
|
||||
{
|
||||
nodeID = edge->list[i].out_node;
|
||||
if(nodeID == nextNodeID)
|
||||
@@ -571,8 +547,8 @@ inline void add_single_deletionEdge_weight(Graph* g, long long alignNodeID, long
|
||||
}
|
||||
}
|
||||
|
||||
///说明不存在这么一条边
|
||||
if (i == edge->length)
|
||||
///there are no such edge
|
||||
if (i == (long long)edge->length)
|
||||
{
|
||||
append_Edge_alloc(edge, alignNodeID, nextNodeID, 1, edge_length);
|
||||
}
|
||||
@@ -580,23 +556,6 @@ inline void add_single_deletionEdge_weight(Graph* g, long long alignNodeID, long
|
||||
|
||||
inline void add_deletionEdge_weight(Graph* g, long long alignNodeID, long long deletion_length)
|
||||
{
|
||||
/**
|
||||
if (deletion_length == 1)
|
||||
{
|
||||
add_single_deletionEdge_weight(g, alignNodeID, alignNodeID + 1, 0);
|
||||
}
|
||||
else if (deletion_length == 2)
|
||||
{
|
||||
add_single_deletionEdge_weight(g, alignNodeID, alignNodeID + 1, 0);
|
||||
add_single_deletionEdge_weight(g, alignNodeID, alignNodeID + 2, 0);
|
||||
add_single_deletionEdge_weight(g, alignNodeID + 1, alignNodeID + 2, 0);
|
||||
}
|
||||
else if (deletion_length > 2)
|
||||
{
|
||||
///fprintf(stderr, "too long deletion!\n");
|
||||
add_single_deletionEdge_weight(g, alignNodeID, alignNodeID + deletion_length, 0);
|
||||
}
|
||||
**/
|
||||
long long i;
|
||||
for (i = 0; i < deletion_length; i++)
|
||||
{
|
||||
@@ -611,7 +570,7 @@ inline int getEdge(Graph* g, Edge_alloc* edge, uint64_t edge_length, char base)
|
||||
long long i = 0;
|
||||
long long nodeID;
|
||||
|
||||
for (i = 0; i < edge->length; i++)
|
||||
for (i = 0; i < (long long)edge->length; i++)
|
||||
{
|
||||
if (edge->list[i].length == edge_length)
|
||||
{
|
||||
@@ -651,7 +610,7 @@ inline int get_insertion_Edges(Graph* g, Edge_alloc* edge, uint64_t edge_length,
|
||||
|
||||
Edge_alloc* new_edge = edge;
|
||||
|
||||
for (i = 1; i < edge_length; i++)
|
||||
for (i = 1; i < (long long)edge_length; i++)
|
||||
{
|
||||
nodeID = new_edge->list[edgeID].out_node;
|
||||
new_edge = &(g->g_nodes.list[nodeID].insertion_edges);
|
||||
@@ -662,7 +621,6 @@ inline int get_insertion_Edges(Graph* g, Edge_alloc* edge, uint64_t edge_length,
|
||||
}
|
||||
}
|
||||
/****************************may have bugs********************************/
|
||||
///return edgeID;
|
||||
return return_edgeID;
|
||||
/****************************may have bugs********************************/
|
||||
}
|
||||
@@ -673,7 +631,7 @@ inline int create_insertion_Edges(Graph* g, long long alignNodeID, uint64_t edge
|
||||
{
|
||||
long long i = 0;
|
||||
long long nodeID;
|
||||
///最后应该连回原节点
|
||||
///should link back to the intial node
|
||||
///long long backboneID = alignNodeID + 1;
|
||||
long long backboneID = alignNodeID;
|
||||
|
||||
@@ -685,28 +643,29 @@ inline int create_insertion_Edges(Graph* g, long long alignNodeID, uint64_t edge
|
||||
|
||||
|
||||
nodeID = add_Node_Graph(g, bases[0]);
|
||||
///将新加入的节点通过insertion_edges接到alignNodeID上
|
||||
///add the new node to alignNodeID by insertion_edges
|
||||
append_Edge_alloc(&(g->g_nodes.list[alignNodeID].insertion_edges), alignNodeID, nodeID, 1, edge_length);
|
||||
|
||||
alignNodeID = nodeID;
|
||||
|
||||
for (i = 1; i < edge_length; i++)
|
||||
for (i = 1; i < (long long)edge_length; i++)
|
||||
{
|
||||
nodeID = add_Node_Graph(g, bases[i]);
|
||||
///将新加入的节点通过insertion_edges接到alignNodeID上
|
||||
///add the new node to alignNodeID by insertion_edges
|
||||
append_Edge_alloc(&(g->g_nodes.list[alignNodeID].insertion_edges), alignNodeID, nodeID, 1, edge_length - i);
|
||||
alignNodeID = nodeID;
|
||||
}
|
||||
|
||||
append_Edge_alloc(&(g->g_nodes.list[alignNodeID].insertion_edges), alignNodeID, backboneID, 1, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
inline void extract_path(Graph* backbone, int debug_node_in_backbone, int path_i, char* pre)
|
||||
{
|
||||
int step = G_Node(*backbone, debug_node_in_backbone).insertion_edges.list[path_i].length;
|
||||
int string_i, preNode, j;
|
||||
int string_i = 0, preNode = 0, j = 0;
|
||||
if(step != 0)
|
||||
{
|
||||
string_i = 0;
|
||||
@@ -723,65 +682,17 @@ inline void extract_path(Graph* backbone, int debug_node_in_backbone, int path_i
|
||||
}
|
||||
|
||||
|
||||
inline void extract_path_debug(Graph* backbone, int debug_node_in_backbone, int path_i, char* pre)
|
||||
{
|
||||
int step = G_Node(*backbone, debug_node_in_backbone).insertion_edges.list[path_i].length;
|
||||
int string_i, preNode, preEdge, j;
|
||||
if(step != 0)
|
||||
{
|
||||
string_i = 0;
|
||||
preNode = G_Node(*backbone, debug_node_in_backbone).insertion_edges.list[path_i].out_node;
|
||||
preEdge = G_Node(*backbone, debug_node_in_backbone).insertion_edges.list[path_i].length;
|
||||
|
||||
for (j = 0; j < step; j++)
|
||||
{
|
||||
///pre[string_i++] = G_Node(*backbone, preNode).base;
|
||||
fprintf(stderr, "j: %d (%c%d), ", j, G_Node(*backbone, preNode).base, preEdge);
|
||||
preEdge = G_Node(*backbone, preNode).insertion_edges.list[0].length;
|
||||
preNode = G_Node(*backbone, preNode).insertion_edges.list[0].out_node;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
///pre[string_i] = '\0';
|
||||
}
|
||||
|
||||
|
||||
inline int getEdge_DEBUG(Graph* g, Edge_alloc* edge, uint64_t edge_length, char base)
|
||||
{
|
||||
long long i = 0;
|
||||
long long nodeID;
|
||||
|
||||
for (i = 0; i < edge->length; i++)
|
||||
{
|
||||
///fprintf(stderr, "************i:%d, edge->list[i].length: %d, edge_length: %d\n",i, edge->list[i].length, edge_length);
|
||||
if (edge->list[i].length == edge_length)
|
||||
{
|
||||
nodeID = edge->list[i].out_node;
|
||||
fprintf(stderr, "########i:%d, edge->list[i].length: %d, edge_length: %d, nodeID: %d, list[nodeID].base: %c, base: %c\n",
|
||||
i, edge->list[i].length, edge_length, nodeID, g->g_nodes.list[nodeID].base, base);
|
||||
|
||||
if(g->g_nodes.list[nodeID].base == base)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
inline int get_insertion_Edges_new(Graph* backbone, int debug_node_in_backbone, uint64_t edge_length, char* bases)
|
||||
{
|
||||
int path_i, j, step, preNode;
|
||||
|
||||
for (path_i = 0; path_i < G_Node(*backbone, debug_node_in_backbone).insertion_edges.length; path_i++)
|
||||
for (path_i = 0; path_i < (long long)G_Node(*backbone, debug_node_in_backbone).insertion_edges.length; path_i++)
|
||||
{
|
||||
step = G_Node(*backbone, debug_node_in_backbone).insertion_edges.list[path_i].length;
|
||||
|
||||
|
||||
if(step != edge_length)
|
||||
if(step != (long long)edge_length)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -793,8 +704,6 @@ inline int get_insertion_Edges_new(Graph* backbone, int debug_node_in_backbone,
|
||||
|
||||
for (j = 0; j < step; j++)
|
||||
{
|
||||
///pre[string_i++] = G_Node(*backbone, preNode).base;
|
||||
///fprintf(stderr, "path_i: %d, ID: %d\n", path_i, G_Node(*backbone, preNode).ID);
|
||||
if(G_Node(*backbone, preNode).base != bases[j])
|
||||
{
|
||||
break;
|
||||
@@ -815,53 +724,7 @@ inline int get_insertion_Edges_new(Graph* backbone, int debug_node_in_backbone,
|
||||
}
|
||||
|
||||
|
||||
inline int get_insertion_Edges_debug(Graph* g, Edge_alloc* edge, uint64_t edge_length, char* bases)
|
||||
{
|
||||
long long i = 0;
|
||||
long long nodeID;
|
||||
long long edgeID;
|
||||
|
||||
if (edge_length < 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
///fprintf(stderr, "edge_length: %d, edge: %.*s\n", edge_length, edge_length, bases);
|
||||
|
||||
|
||||
edgeID = getEdge_DEBUG(g, edge, edge_length, bases[0]);
|
||||
fprintf(stderr, "i: %d, edgeID: %d, edge_length - i: %d\n", i, edgeID, edge_length);
|
||||
|
||||
|
||||
|
||||
|
||||
long long return_edgeID = edgeID;
|
||||
|
||||
if(edgeID == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Edge_alloc* new_edge = edge;
|
||||
|
||||
for (i = 1; i < edge_length; i++)
|
||||
{
|
||||
nodeID = new_edge->list[edgeID].out_node;
|
||||
new_edge = &(g->g_nodes.list[nodeID].insertion_edges);
|
||||
edgeID = getEdge_DEBUG(g, new_edge, edge_length - i, bases[i]);
|
||||
fprintf(stderr, "i: %d, edgeID: %d, edge_length - i: %d\n", i, edgeID, edge_length - i);
|
||||
if(edgeID == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/****************************may have bugs********************************/
|
||||
///return edgeID;
|
||||
return return_edgeID;
|
||||
/****************************may have bugs********************************/
|
||||
}
|
||||
|
||||
inline void add_insertionEdge_weight(Graph* g, long long alignNodeID, char* insert, long long insert_length)
|
||||
{
|
||||
@@ -873,20 +736,16 @@ inline void add_insertionEdge_weight(Graph* g, long long alignNodeID, char* inse
|
||||
if (insert_length == 1)
|
||||
{
|
||||
edgeID = getEdge(g, edge, 1, insert[0]);
|
||||
// if(edgeID != get_insertion_Edges_new(g, alignNodeID, insert_length, insert))
|
||||
// {
|
||||
// fprintf(stderr, "error\n");
|
||||
// }
|
||||
if (edgeID != -1)
|
||||
{
|
||||
edge->list[edgeID].weight++;
|
||||
}
|
||||
else ///不存在这么一条边
|
||||
else ///there is no such edge
|
||||
{
|
||||
nodeID = add_Node_Graph(g, insert[0]);
|
||||
append_Edge_alloc(edge, alignNodeID, nodeID, 1, 1);
|
||||
///将新加入的节点通过insertion_edges接回backbone上
|
||||
///应该连回到原节点,而不是原节点的下一个节点
|
||||
///add the new node to alignNodeID by insertion_edges
|
||||
//should link to the initial node, instead of the next node of the initial node
|
||||
///append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID + 1, 1, 0);
|
||||
append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID, 1, 0);
|
||||
}
|
||||
@@ -897,7 +756,7 @@ inline void add_insertionEdge_weight(Graph* g, long long alignNodeID, char* inse
|
||||
edgeID = get_insertion_Edges_new(g, alignNodeID, insert_length, insert);
|
||||
if (edgeID != -1)
|
||||
{
|
||||
///这条路均只有一个出度
|
||||
///just one outdegree
|
||||
edge->list[edgeID].weight++;
|
||||
}
|
||||
else
|
||||
@@ -905,163 +764,8 @@ inline void add_insertionEdge_weight(Graph* g, long long alignNodeID, char* inse
|
||||
create_insertion_Edges(g, alignNodeID, insert_length, insert);
|
||||
}
|
||||
}
|
||||
|
||||
// /******************************for homopolymer*************************/
|
||||
// long long i = 0;
|
||||
// char hom;
|
||||
// if (insert_length > 0)
|
||||
// {
|
||||
// hom = insert[0];
|
||||
// }
|
||||
|
||||
// for (i = 0; i < insert_length; i++)
|
||||
// {
|
||||
// if(insert[i] != hom)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// ///if it is a homopolymer
|
||||
// if(i == insert_length)
|
||||
// {
|
||||
// ///single base
|
||||
// edgeID = getEdge(g, edge, 1, insert[0]);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else ///不存在这么一条边
|
||||
// {
|
||||
// nodeID = add_Node_Graph(g, insert[0]);
|
||||
// append_Edge_alloc(edge, alignNodeID, nodeID, 1, 1);
|
||||
// ///将新加入的节点通过insertion_edges接回backbone上
|
||||
// ///应该连回到原节点,而不是原节点的下一个节点
|
||||
// ///append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID + 1, 1, 0);
|
||||
// append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID, 1, 0);
|
||||
// }
|
||||
|
||||
// ///multiple bases
|
||||
// for (i = 1; i < insert_length; i++)
|
||||
// {
|
||||
// edgeID = get_insertion_Edges(g, edge, i + 1, insert);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// create_insertion_Edges(g, alignNodeID, i + 1, insert);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
// /******************************for homopolymer*************************/
|
||||
|
||||
|
||||
|
||||
// if (insert_length == 1)
|
||||
// {
|
||||
// edgeID = getEdge(g, edge, 1, insert[0]);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else ///不存在这么一条边
|
||||
// {
|
||||
// nodeID = add_Node_Graph(g, insert[0]);
|
||||
// append_Edge_alloc(edge, alignNodeID, nodeID, 1, 1);
|
||||
// ///将新加入的节点通过insertion_edges接回backbone上
|
||||
// ///应该连回到原节点,而不是原节点的下一个节点
|
||||
// ///append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID + 1, 1, 0);
|
||||
// append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID, 1, 0);
|
||||
// }
|
||||
// }
|
||||
// else if (insert_length == 2)
|
||||
// {
|
||||
// /*******************第0个字符********************* */
|
||||
// edgeID = getEdge(g, edge, 1, insert[0]);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else ///不存在这么一条边
|
||||
// {
|
||||
// nodeID = add_Node_Graph(g, insert[0]);
|
||||
// append_Edge_alloc(edge, alignNodeID, nodeID, 1, 1);
|
||||
// ///将新加入的节点通过insertion_edges接回backbone上
|
||||
// ///应该连回到原节点,而不是原节点的下一个节点
|
||||
// ///append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID + 1, 1, 0);
|
||||
// append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID, 1, 0);
|
||||
// }
|
||||
// /*******************第0个字符********************* */
|
||||
|
||||
// /*******************第1个字符********************* */
|
||||
// if (insert[1] != insert[0])
|
||||
// {
|
||||
// edgeID = getEdge(g, edge, 1, insert[1]);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else ///不存在这么一条边
|
||||
// {
|
||||
// nodeID = add_Node_Graph(g, insert[1]);
|
||||
// append_Edge_alloc(edge, alignNodeID, nodeID, 1, 1);
|
||||
// ///将新加入的节点通过insertion_edges接回backbone上
|
||||
// ///应该连回到原节点,而不是原节点的下一个节点
|
||||
// ///append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID + 1, 1, 0);
|
||||
// append_Edge_alloc(&(g->g_nodes.list[nodeID].insertion_edges), nodeID, alignNodeID, 1, 0);
|
||||
// }
|
||||
// }
|
||||
// /*******************第1个字符********************* */
|
||||
|
||||
// /**********************两个字符******************* */
|
||||
|
||||
// edgeID = get_insertion_Edges(g, edge, 2, insert);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// create_insertion_Edges(g, alignNodeID, insert_length, insert);
|
||||
// }
|
||||
|
||||
// /**********************两个字符******************* */
|
||||
// }
|
||||
// else if (insert_length > 2)
|
||||
// {
|
||||
// ////fprintf(stderr, "too long insertion\n");
|
||||
// /*************************大于2个字符************************** */
|
||||
|
||||
// edgeID = get_insertion_Edges(g, edge, insert_length, insert);
|
||||
// if (edgeID != -1)
|
||||
// {
|
||||
// ///这条路均只有一个出度
|
||||
// edge->list[edgeID].weight++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// create_insertion_Edges(g, alignNodeID, insert_length, insert);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void addmatchedSeqToGraph_print(Graph* backbone, long long currentNodeID, char* x_string, long long x_length,
|
||||
char* y_string, long long y_length, CIGAR* cigar, long long backbone_start, long long backbone_end);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user