Chromosome.cpp
#include <cassert>
#include "Chromosome.h"
Chromosome::Chromosome(GenomeSequence* gs, unsigned int chromosomeIndex)
{
assert(gs);
assert(chromosomeIndex < (unsigned int)gs->getChromosomeCount());
this->gs = gs;
this->chromosomeIndex = chromosomeIndex;
this->offset = gs->getChromosomeStart((int)chromosomeIndex);
this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
}
Chromosome::Chromosome(GenomeSequence* gs, const char* chromosomeName)
{
assert(gs);
this->gs = gs;
this->chromosomeIndex = gs->getChromosome(chromosomeName);
assert(chromosomeIndex != INVALID_CHROMOSOME_INDEX);
this->offset = gs->getChromosomeStart((int)chromosomeIndex);
this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
}
Chromosome::Chromosome(const char* genomseSequenceFileName, unsigned int chromosomeIndex, bool isColorSpace)
{
std::string s(genomseSequenceFileName);
gs = new GenomeSequence;
assert(gs);
gs->setReferenceName(s);
assert(!gs->open(isColorSpace));
this->chromosomeIndex = chromosomeIndex;
this->offset = gs->getChromosomeStart((int)chromosomeIndex);
this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
}
Chromosome::Chromosome(const std::string& genomseSequenceFileName, unsigned int chromosomeIndex, bool isColorSpace)
{
gs = new GenomeSequence;
assert(gs);
gs->setReferenceName(genomseSequenceFileName);
assert(!gs->open(isColorSpace));
this->chromosomeIndex = chromosomeIndex;
this->offset = gs->getChromosomeStart((int)chromosomeIndex);
this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
}
GenomeSequence
Create/Access/Modify/Load Genome Sequences stored as binary mapped files.
Definition: GenomeSequence.h:100
GenomeSequence::getChromosomeCount
int getChromosomeCount() const
Return the number of chromosomes in the genome.
Definition: GenomeSequence.cpp:731
GenomeSequence::getChromosomeStart
genomeIndex_t getChromosomeStart(int chromosomeIndex) const
given a chromosome, return the genome base it starts in
Definition: GenomeSequence.h:246
GenomeSequence::getChromosome
int getChromosome(genomeIndex_t position) const
given a whole genome index, get the chromosome it is located in
Definition: GenomeSequence.cpp:737
GenomeSequence::setReferenceName
bool setReferenceName(std::string referenceFilename)
set the reference name that will be used in open()
Definition: GenomeSequence.cpp:254
GenomeSequence::getChromosomeSize
genomeIndex_t getChromosomeSize(int chromosomeIndex) const
given a chromosome, return its size in bases
Definition: GenomeSequence.h:256
GenomeSequence::open
bool open(bool isColorSpace=false, int flags=O_RDONLY)
open the reference specified using GenomeSequence::setReferenceName
Definition: GenomeSequence.cpp:182