56 unique_ptr<MafBlock> block(iterator_->nextBlock());
57 if (!block.get())
return 0;
60 if (!block->hasSequenceForSpecies(referenceSpecies_))
61 return block.release();
62 if (!block->hasSequenceForSpecies(targetSpecies_))
63 return block.release();
66 const MafSequence& refSeq = block->getSequenceForSpecies(referenceSpecies_);
67 const MafSequence& targetSeq = block->getSequenceForSpecies(targetSpecies_);
70 std::map<std::string, SequenceFeatureSet*>::iterator mr = inputFeaturesPerChr_.find(refSeq.
getChromosome());
71 if (mr == inputFeaturesPerChr_.end())
72 return block.release();
75 unique_ptr<SequenceFeatureSet> selectedFeatures(mr->second->getSubsetForRange(
SeqRange(refSeq.
getRange(
true)),
true));
78 if (selectedFeatures->isEmpty())
79 return block.release();
83 selectedFeatures->fillRangeCollection(ranges);
89 it != ranges.
getSet().end();
107 (*logstream_ <<
"COORDINATE CONVERTOR: lifting over " << ranges.
getSet().size() <<
" features from block " << block->getDescription() <<
".").endLine();
113 it != ranges.
getSet().end();
121 string targetPos1 =
"NA", targetPos2 =
"NA";
122 if (!alphabet->
isGap(targetSeq[a]) || outputClosestCoordinate_) {
129 if (!alphabet->
isGap(targetSeq[b]) || outputClosestCoordinate_) {
136 output_ << refSeq.
getChromosome() <<
"\t" << refSeq.
getStrand() <<
"\t" << (**it).begin() <<
"\t" << (**it).end() <<
"\t";
137 output_ << targetSeq.
getChromosome() <<
"\t" << targetSeq.
getStrand() <<
"\t" << targetPos1 <<
"\t" << targetPos2 << endl;
144 return block.release();
virtual bool isGap(int state) const=0
MafBlock * analyseCurrentBlock_()
virtual const Alphabet * getAlphabet() const=0
A synteny block data structure, the basic unit of a MAF alignement file.
A sequence class which is used to store data from MAF files.
const std::string & getChromosome() const
size_t getSrcSize() const
Range< size_t > getRange(bool origin=true) const
void addRange(const Range< T > &r)
const std::set< Range< T > *, rangeComp_< T > > & getSet() const
a coordinate range on a sequence. Stores coordinates as a Range<size_t> object, but also keep the str...
virtual char getStrand() const
size_t getSequencePosition(size_t alnPos)
size_t getAlignmentPosition(size_t seqPos)
std::string toString(T t)