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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
/*
Ray -- Parallel genome assemblies for parallel DNA sequencing
Copyright (C) 2010, 2011, 2012, 2013 Sébastien Boisvert
http://DeNovoAssembler.SourceForge.Net/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You have received a copy of the GNU General Public License
along with this program (gpl-3.0.txt).
see <http://www.gnu.org/licenses/>
*/
#ifndef _GraphPath_h
#define _GraphPath_h
#include <code/Mock/constants.h>
#include <code/KmerAcademyBuilder/Kmer.h>
#include <RayPlatform/store/CarriageableItem.h>
#include <vector>
using namespace std;
#ifdef CONFIG_PATH_STORAGE_BLOCK
/*
* The number of symbols per block.
*/
#define CONFIG_PATH_BLOCK_SIZE 4096
/*
* Each block has 128 uint64_t objects, which can store 4096 nucleotides.
* 4096*2 = 8192 bits
* 128 * 8 * 8 = 8192 bits
*/
#define NUMBER_OF_64_BIT_INTEGERS ( CONFIG_PATH_BLOCK_SIZE * BITS_PER_NUCLEOTIDE / sizeof(uint64_t) / BITS_PER_BYTE )
class GraphPathBlock {
public:
uint64_t m_content[NUMBER_OF_64_BIT_INTEGERS];
};
#endif
/**
* This class describes objects representing assembly seeds.
* An assembly seed is a path in the de Bruijn graph.
* It is likely unique in the target genome (hopefully !)
*
* \author pro-grammer: Sébastien Boisvert (good with grammar)
* \author co-designer: The Ray committee of wise people (E. God.)
* \date updated 2012-06-21 for the release of v2.0.0
*
* the PathHandle should be here directly instead of being a separate instance.
* \date 2013-07-31 PathHandle is now a class on its own.
*
* \author Sébastien Boisvert
*/
class GraphPath : public CarriageableItem {
bool m_deleted;
bool m_errorRaised;
int m_kmerLength;
#ifdef CONFIG_PATH_STORAGE_DEFAULT
vector<Kmer> m_vertices;
#elif defined(CONFIG_PATH_STORAGE_BLOCK)
vector<GraphPathBlock> m_blocks;
int m_size;
#endif
vector<CoverageDepth> m_coverageValues;
CoverageDepth m_peakCoverage;
/** computes locality with a weighted mean (locality object is peak coverage) **/
void computePeakCoverageUsingMean();
/** computes locality with a mode (locality object is peak coverage) **/
void computePeakCoverageUsingMode();
void computePeakCoverageUsingStaggeredMean();
bool m_hasPeakCoverage;
#ifdef CONFIG_PATH_STORAGE_BLOCK
void readObjectInBlock(int position,Kmer*object)const;
void writeObjectInBlock(const Kmer*a);
#endif
bool canBeAdded(const Kmer*value)const;
int getBlockSize()const;
char readSymbolInBlock(int position)const;
void writeSymbolInBlock(int position,char symbol);
void addBlock();
public:
GraphPath();
int size()const;
void at(int i,Kmer*value)const;
CoverageDepth getCoverageAt(int i)const;
void push_back(const Kmer*a);
void getVertices(vector<Kmer>*value)const;
void clear();
void addCoverageValue(CoverageDepth value);
void setCoverageValueAt(int position, CoverageDepth value);
void reserveSpaceForCoverage();
CoverageDepth getPeakCoverage()const;
void resetCoverageValues();
void computePeakCoverage();
void reserve(int size);
void setKmerLength(int kmerLength);
bool isDeleted();
void markAsDeleted();
int load(const char * buffer);
int dump(char * buffer) const;
int getRequiredNumberOfBytes() const;
int getKmerLength() const;
/**
* Put the reversed content
* in another object.
*/
void reverseContent(GraphPath & newPath) const;
void appendPath(const GraphPath & path);
};
bool comparePaths(const GraphPath & a,const GraphPath & b);
#endif
|