libStatGen Software 1
PileupElement.h
1/*
2 * Copyright (C) 2010 Regents of the University of Michigan
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __PILEUP_ELEMENT_H__
19#define __PILEUP_ELEMENT_H__
20
21#include "SamRecord.h"
22
23/// This is a base class pileup component, representing the information
24/// for one reference position. Child classes will be defined to detail more
25/// information that needs to be saved and how it should be analyzed.
27{
28public:
29 static const int32_t UNSET_POSITION = -1;
30
31 /// Pileup element constructor.
33
34 /// Constructor that resets the pileup element, does not copy, just resets.
36
37 /// Pileup element destructor.
38 virtual ~PileupElement();
39
40
41 /// Add an entry to this pileup element.
42 virtual void addEntry(SamRecord& record);
43
44 /// Perform the analysis associated with this class.
45 virtual void analyze();
46
47 /// Resets the entry, setting the new position associated with this element.
48 virtual void reset(int32_t refPosition);
49
50 /// Get the chromosome name stored in this element.
51 const char* getChromosome() const { return(myChromosome.c_str()); }
52
53 /// Get the reference position stored in this element.
54 int32_t getRefPosition() const { return(myRefPosition); }
55
56 /// Returns the reference base for this pileup element.
57 /// Only works if a reference has been set, otherwise, 'N' is returned.
58 char getRefBase();
59
60 /// Set the reference to use for all pilepElements.
61 static void setReference(GenomeSequence* reference);
62
63protected:
64 /// Get a pointer to the reference.
65 static GenomeSequence* getReference() { return(myRefPtr); }
66
67private:
68 int32_t myRefPosition;
69 std::string myChromosome;
70 static GenomeSequence* myRefPtr;
71};
72
73
74#endif
Create/Access/Modify/Load Genome Sequences stored as binary mapped files.
This is a base class pileup component, representing the information for one reference position.
Definition: PileupElement.h:27
static void setReference(GenomeSequence *reference)
Set the reference to use for all pilepElements.
const char * getChromosome() const
Get the chromosome name stored in this element.
Definition: PileupElement.h:51
int32_t getRefPosition() const
Get the reference position stored in this element.
Definition: PileupElement.h:54
static GenomeSequence * getReference()
Get a pointer to the reference.
Definition: PileupElement.h:65
PileupElement()
Pileup element constructor.
virtual void addEntry(SamRecord &record)
Add an entry to this pileup element.
virtual void analyze()
Perform the analysis associated with this class.
virtual ~PileupElement()
Pileup element destructor.
virtual void reset(int32_t refPosition)
Resets the entry, setting the new position associated with this element.
char getRefBase()
Returns the reference base for this pileup element.
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52