-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgraphtools.h
More file actions
91 lines (71 loc) · 3.17 KB
/
graphtools.h
File metadata and controls
91 lines (71 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
The MIT License (MIT)
Copyright (c) 2024 Hanfc <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef GRAPHTOOLS_H
#define GRAPHTOOLS_H
#include <stdint.h>
#include "hitseeds.h"
#include "BFSseed.h"
#include "khash.h"
typedef struct {
int pt_nodenum;
int mt_nodenum;
int uniq_pt_nodenum;
int uniq_mt_nodenum;
int* path_node;
int* path_utr;
uint32_t node_num;
uint64_t path_len;
uint64_t uniq_mt_pathlen;
uint32_t inval_num;
int type;
} pathScore;
typedef struct {
BFSlinks* links;
int num_links;
int* node;
int num_nodes;
} BFSstructure;
KHASH_MAP_INIT_INT(Ha_structures, BFSstructure*)
KHASH_MAP_INIT_INT(Ha_nodeseq, char*)
typedef struct {
int ctg;
char *seq;
} fnainfo;
/* addseq: add sequence to the fna */
void addseq(const char* allgraph, const char* all_fna, CtgDepth* ctgdepth);
/* raw gfa && main gfa */
void optgfa(const char* exe_path, int num_dynseeds, int** dynseeds, BFSlinks** bfslinks, int* num_bfslinks,
CtgDepth* ctgdepth, const char* output, const char* all_fna, const char* allgraph,
const char* organelles_type, int* mainseeds_num, int** mainseeds, int interfering_ctg_num,
int* interfering_ctg, int taxo, float filter_depth, char* cutseq);
/* findSpath: find the shortest path between two contigs */
void findSpath(int node1, int node1utr, int node2, int node2utr,
int main_num, BFSlinks* mainlinks, CtgDepth *ctg_depth);
/* BFS_structure: find the BFS structure of the graph */
uint32_t bfs_structure(int node_num, int link_num, BFSlinks* links, int* node_arry, khash_t(Ha_structures)* h_structures);
/* findMpath: find the most likely path between two contigs */
void findMpath(int node1, int node1utr, int node2, int node2utr, int main_num, BFSlinks* mainlinks, CtgDepth *ctg_depth,
int* mt_contigs, int mt_num, int* pt_contigs, int pt_num, int* flag_err, float* mt_ratio, int taxo, pathScore *struc_path);
/* copy BFSlinks */
void copy_BFSlinks(BFSlinks* dest, const BFSlinks* src);
// void free_BFSlinks(BFSlinks *links, int num_links);
/* convert path to fasta */
void path2fa(pathScore *path, int ps_num, khash_t(Ha_nodeseq)* node_seq, const char *output);
#endif