A library for working with phylogenetic data.
v0.25.0
functions/genome_region.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_POPULATION_FUNCTIONS_GENOME_REGION_H_
2 #define GENESIS_POPULATION_FUNCTIONS_GENOME_REGION_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2021 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lczech@carnegiescience.edu>
23  Department of Plant Biology, Carnegie Institution For Science
24  260 Panama Street, Stanford, CA 94305, USA
25 */
26 
35 
36 #ifdef GENESIS_HTSLIB
37 
39 
40 #endif // htslib guard
41 
42 #include <iosfwd>
43 #include <string>
44 #include <vector>
45 
46 namespace genesis {
47 namespace population {
48 
49 // =================================================================================================
50 // Genome Region Helper Functions
51 // =================================================================================================
52 
53 std::ostream& operator<<( std::ostream& os, GenomeRegion const& region );
54 std::string to_string( GenomeRegion const& region );
55 
56 bool operator ==( GenomeRegion const& a, GenomeRegion const& b );
57 
64 GenomeRegion parse_genome_region( std::string const& region );
65 
72 GenomeRegionList parse_genome_regions( std::string const& regions );
73 
77 bool is_covered( GenomeRegion const& region, std::string const& chromosome, size_t position );
78 
85 template<class T>
86 bool is_covered( GenomeRegion const& region, T const& variant )
87 {
88  return is_covered( region, variant.chromosome, variant.position );
89 }
90 
91 #ifdef GENESIS_HTSLIB
92 
93 bool is_covered( GenomeRegion const& region, VcfRecord const& variant );
94 
95 #endif // htslib guard
96 
97 } // namespace population
98 } // namespace genesis
99 
100 #endif // include guard
genesis::population::is_covered
bool is_covered(GenomeRegion const &region, std::string const &chromosome, size_t position)
Test whether the chromosome/position is within a given genomic region.
Definition: functions/genome_region.cpp:144
genesis::population::GenomeRegion::chromosome
std::string chromosome
Definition: genome_region.hpp:56
genesis::population::operator<<
std::ostream & operator<<(std::ostream &os, BaseCounts const &bs)
Output stream operator for BaseCounts instances.
Definition: base_counts.cpp:345
genesis::population::parse_genome_region
GenomeRegion parse_genome_region(std::string const &region)
Parse a genomic region.
Definition: functions/genome_region.cpp:75
genome_region.hpp
genesis::population::parse_genome_regions
GenomeRegionList parse_genome_regions(std::string const &regions)
Parse a set/list of genomic regions.
Definition: functions/genome_region.cpp:132
genesis::population::operator==
bool operator==(GenomeRegion const &a, GenomeRegion const &b)
Definition: functions/genome_region.cpp:70
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::population::GenomeRegion
A region (between two positions) on a chromosome.
Definition: genome_region.hpp:51
genesis::population::to_string
std::string to_string(GenomeRegion const &region)
Definition: functions/genome_region.cpp:55
vcf_record.hpp