Chromosome.cpp
00001 #include <cassert>
00002 #include "Chromosome.h"
00003
00004 Chromosome::Chromosome(GenomeSequence* gs, uint chromosomeIndex)
00005 {
00006 assert(gs);
00007 assert(chromosomeIndex < (uint)gs->getChromosomeCount());
00008
00009 this->gs = gs;
00010 this->chromosomeIndex = chromosomeIndex;
00011 this->offset = gs->getChromosomeStart((int)chromosomeIndex);
00012 this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
00013 }
00014
00015 Chromosome::Chromosome(GenomeSequence* gs, const char* chromosomeName)
00016 {
00017 assert(gs);
00018 this->gs = gs;
00019
00020 this->chromosomeIndex = gs->getChromosome(chromosomeName);
00021 assert(chromosomeIndex != INVALID_CHROMOSOME_INDEX);
00022
00023 this->offset = gs->getChromosomeStart((int)chromosomeIndex);
00024 this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
00025 }
00026
00027 Chromosome::Chromosome(const char* genomseSequenceFileName, uint chromosomeIndex, bool isColorSpace)
00028 {
00029 std::string s(genomseSequenceFileName);
00030 if (this->gs) delete gs;
00031 gs = new GenomeSequence;
00032 assert(gs);
00033 gs->setReferenceName(s);
00034 assert(!gs->open(isColorSpace));
00035 this->chromosomeIndex = chromosomeIndex;
00036 this->offset = gs->getChromosomeStart((int)chromosomeIndex);
00037 this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
00038 }
00039
00040 Chromosome::Chromosome(const std::string& genomseSequenceFileName, uint chromosomeIndex, bool isColorSpace)
00041 {
00042 if (this->gs) delete gs;
00043 gs = new GenomeSequence;
00044 assert(gs);
00045 gs->setReferenceName(genomseSequenceFileName);
00046 assert(!gs->open(isColorSpace));
00047 this->chromosomeIndex = chromosomeIndex;
00048 this->offset = gs->getChromosomeStart((int)chromosomeIndex);
00049 this->chromosomeSize = gs->getChromosomeSize((int)chromosomeIndex);
00050 }