modified: SpatialOmicsCoord.py
[GalaxyCodeBases.git] / BGI / SOAPsnp / tools.h
blob31033c002471a45a24963abb0fc4b071968fcba6
1 /*
2 ******************************************************************************
3 *Copyright 2010
4 * BGI-SHENZHEN
5 *All Rights Reserved
6 *ATHUOR : Bill Tang
7 *CREATE DATE : 2010-7-14
8 *CLASS NAME:
9 *FUNCTION : some useful function to the SOAPsnp
10 *FILE NAME : tool.h
11 *UPDATE DATE : 2010-8-3
12 *UPDATE BY : Bill Tang
13 *UPDATE DATE : 2010-9-6
14 *UPDATE BY :Zhou Guyue
15 *UPDATE: 2010-10-15 change the struct SFS_PARA, add a member qs.
16 *******************************************************************************
18 #ifndef TOOLS_H
19 #define TOOLS_H
21 #include <iostream>
22 #include <strstream>
23 #include <vector>
24 #include <string>
25 #include <sstream>
26 #include <fstream>
27 #include <cassert>
28 using namespace std;
29 typedef ifstream my_ifstream;
31 #define NOUSE_ALIGNMENT "alignment is no use"
32 #define HIT_COUNT_X0 "X0:i:"
33 #define HIT_COUNT_H0 "H0:i:"
34 #define SFS_PARA_ERROR -1 //if sfs para is wrong return SFS_PARA_ERROR
35 #define SFS_PARA_SUCC 1 //if sfs para is right return SFS_PARA_SUCC
38 /* integer to string*/
39 std::string myitoa(int num);
40 // A function to spilt string s into vector vec according to char splitchar
41 void StringSplit(std::string s, char splitchar, std::vector<std::string>& vec);
42 /* count the indel length from the cigar string. return the indel length and the position*/
43 int count_indel_len(const std::string cigar, int &pos);
44 /* format the sam text to the soap text*/
45 std::string alignment_format(const std::string &sam_ali);
47 /*a struct for sfs parament*/
48 typedef struct
50 int doBay; // 0:not Bay£¬1:do Bay£¬default is 0
51 int doJoint; //0:not Joint£¬1:do Joint£¬default is 0
52 int writeFr; // 0:not write Fr, 1: write Fr, default is 0
53 std::string outfiles; //out files path
54 int start_pos; // start position
55 int stop_pos; // stop position
56 int under_FP; // 0: not under Flow Protect £¬1:under Flow Protect£¬default is 0
57 int allow_PathZ; // 0: notallow Phat Zero£¬1:allow Phat ZeroÊÇ£¬default is 0
58 double bias; // default bias is 0.03
59 double pvar; // The probability for beeing variable in the population£¬default is 0.015
60 double eps; //error rate ,default is 0.005
61 double pThres ; //select the out put threshold of snp £¬default is 0.01
62 int sigle_MJ; // 0:not sigle minor joint£¬1:sigle minor joint£¬default is 0
63 int sigle_MB; //0: not sigle minor bay£¬1: sigle minor bay£¬default is 0
64 int alternative; //
65 int jointFold; //
66 int qs; // the quality score threshold.
67 std::string faiPath; // fai file's path.
68 //update 11-29
69 int sfs_first_last; // 0: output h[0]~h[2k] , 1:output h[0] and h[2k]
70 }SFS_PARA ;
72 /*initialize a sfs_para struct*/
73 #define sfs_init()(new SFS_PARA)
74 /*destroy a sfs_para struct*/
75 #define sfs_destroy(b) do {if (b) { delete b; }} while (0)
76 /*sfs help information*/
77 void sfs_info(void);
78 /* initialize sfs parament*/
79 int init_sfs_para(const string sfs_path, SFS_PARA *sfs );
80 /*change string to bool*/
81 int str_bool( const char* str);
82 /* count soft clip number at the beginning*/
83 int count_soft_clip(const std::string cigar, int &last_S);
85 #endif