43 #include <Bpp/Seq/SequenceWalker.h> 55 while (blockBuffer_.size() == 0) {
57 auto_ptr<MafBlock> block;
59 block.reset(iterator_->nextBlock());
60 if (!block.get())
return 0;
69 std::map<std::string, RangeSet<size_t> >::iterator mr = ranges_.find(refSeq.
getChromosome());
70 if (mr == ranges_.end())
73 RangeSet<size_t> ranges = mr->second;
75 ranges.filterWithin(refSeq.
getRange(
true));
77 ranges.restrictTo(refSeq.
getRange(
true));
83 RangeSet<size_t> cRanges;
84 for (
set<Range<size_t>*>::iterator it = ranges.getSet().begin();
85 it != ranges.getSet().end();
88 cRanges.addRange(Range<size_t>(refSeq.
getSrcSize() - (**it).end(), refSeq.
getSrcSize() - (**it).begin()));
94 SequenceWalker walker(refSeq);
98 ApplicationTools::message->endLine();
99 ApplicationTools::displayTask(
"Extracting annotations",
true);
102 (*logstream_ <<
"FEATURE EXTRACTOR: extracting " << ranges.getSet().size() <<
" features from block " << block->
getDescription() <<
".").endLine();
106 for (
set<Range<size_t>*>::iterator it = ranges.getSet().begin();
107 it != ranges.getSet().end();
111 ApplicationTools::displayGauge(i++, ranges.getSet().size() - 1,
'=');
117 auto_ptr<MafSequence> subseq;
118 size_t a = walker.getAlignmentPosition((**it).begin() - refSeq.
start());
119 size_t b = walker.getAlignmentPosition((**it).end() - refSeq.
start() - 1);
121 if (!ignoreStrand_) {
122 if (dynamic_cast<SeqRange*>(*it)->isNegativeStrand()) {
123 SequenceTools::invertComplement(*subseq);
128 blockBuffer_.push_back(newBlock);
132 ApplicationTools::displayTaskDone();
136 MafBlock* nxtBlock = blockBuffer_.front();
137 blockBuffer_.pop_front();
const MafSequence & getSequenceForSpecies(const std::string &species) const
void setScore(double score)
unsigned int getPass() const
MafSequence * subSequence(size_t startAt, size_t length) const
Extract a sub-sequence.
bool hasSequenceForSpecies(const std::string &species) const
A synteny block data structure, the basic unit of a MAF alignement file.
size_t getSrcSize() const
void addSequence(const MafSequence &sequence)
const std::string & getChromosome() const
Range< size_t > getRange(bool origin=true) const
void setPass(unsigned int pass)
size_t getNumberOfSequences() const
std::string getDescription() const
const MafSequence & getSequence(const std::string &name) const
A sequence class which is used to store data from MAF files.