1 // -*-mode:c++; c-style:k&r; c-basic-offset:4;-*-
2 //
3 // Copyright 2010-2018, Julian Catchen <jcatchen@illinois.edu>
4 //
5 // This file is part of Stacks.
6 //
7 // Stacks is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Stacks is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with Stacks.  If not, see <http://www.gnu.org/licenses/>.
19 //
20 
21 #ifndef __CSTACKS_H__
22 #define __CSTACKS_H__
23 
24 #ifdef _OPENMP
25 #include <omp.h>    // OpenMP library
26 #endif
27 
28 #include <cerrno>
29 #include <zlib.h>   // Support for gzipped output files.
30 
31 #include <getopt.h> // Process command-line options
32 #include <cstring>
33 #include <cmath>
34 #include <cstdlib>
35 #include <utility>
36 
37 #include <string>
38 
39 #include <iostream>
40 #include <fstream>
41 #include <sstream>
42 #include <vector>
43 #include <map>
44 #include <set>
45 #include <queue>
46 using std::queue;
47 #include <algorithm>
48 
49 #include "constants.h"
50 #include "stacks.h"
51 #include "kmers.h"
52 #include "locus.h"
53 #include "GappedAln.h"
54 #include "sql_utilities.h"
55 #include "aln_utils.h"
56 #include "utils.h"
57 
58 void help( void );
59 void version( void );
60 int  parse_command_line(int, char**);
61 int  initialize_new_catalog(pair<int, string> &, map<int, CLocus *> &);
62 int  initialize_existing_catalog(string, map<int, CLocus *> &);
63 int  update_catalog_index(map<int, CLocus *> &, map<string, int> &);
64 int  merge_catalog_loci(map<int, CLocus *> &, vector<int> &);
65 int  find_kmer_matches_by_sequence(map<int, CLocus *> &, map<int, QLocus *> &, int);
66 int  search_for_gaps(map<int, CLocus *> &, map<int, QLocus *> &, double, double);
67 int  find_matches_by_sequence(map<int, CLocus *> &, map<int, QLocus *> &);
68 int  find_matches_by_genomic_loc(map<string, int> &, map<int, QLocus *> &);
69 int  characterize_mismatch_snps(CLocus *, QLocus *);
70 int  merge_allele(Locus *, SNP *);
71 int  merge_matches(map<int, CLocus *> &, map<int, QLocus *> &, pair<int, string> &, int, uint &, uint &, uint &, uint &, uint &, uint &);
72 int  add_unique_tag(pair<int, string> &, map<int, CLocus *> &, QLocus *);
73 bool compare_dist(pair<int, int>, pair<int, int>);
74 
75 int  write_catalog(map<int, CLocus *> &);
76 int  write_simple_output(CLocus *, ofstream &, ofstream &, ofstream &);
77 int  write_gzip_output(CLocus *, gzFile &, gzFile &, gzFile &);
78 
79 bool compare_matches(Match *, Match *);
80 
81 int  populate_kmer_hash(map<int, CLocus *> &, CatKmerHashMap &, vector<char *> &, int);
82 
83 #endif // __CSTACKS_H__
84