FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

Re: [Seqan-dev] changing intervals within IntervalTree

<-- thread -->
<-- date -->
  • From: "Emde, Anne-Katrin" <Anne-Katrin.Emde@fu-berlin.de>
  • To: "k.okonechnikov@gmail.com" <k.okonechnikov@gmail.com>, SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • Date: Wed, 22 Aug 2012 12:26:44 +0000
  • Reply-to: SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • Subject: Re: [Seqan-dev] changing intervals within IntervalTree

Hi Konstantin,

unfortunately there is no simple way of changing intervals in the IntervalTree. When intervals change, they may have to be assigned to a different node in the interval tree, so you cannot simply change the start/end coordinates of the interval within a node. 
The most straight-forward way to achieve your goal will be to remove the intervals returned by findIntervals, and then add the new merged intervals with the addInterval function. 
For removing intervals: I just checked in a "removeInterval" function. It simply wasn't there before, because we never needed it.. but I think it is a generally valuable feature. You can now remove intervals one by one with removeInterval(IntervalTree<TValue,TCargo> & tree, TValue i_begin, TValue i_end, TCargo i_id).

You can find an example in the demo program interval_tree.cpp. 

Best,
Anne-Katrin


-----------------------------------------------
 Anne-Katrin Emde
 +49 30 83875240
 emde@inf.fu-berlin.de

 Algorithmic Bioinformatics
 Department of Computer Science
 Freie Universität Berlin
----------------------------------------------
________________________________________
Von: Konstantin Okonechnikov [k.okonechnikov@gmail.com]
Gesendet: Dienstag, 21. August 2012 12:03
An: seqan-dev@lists.fu-berlin.de
Betreff: [Seqan-dev] changing intervals within IntervalTree

Hi everyone,

I am using an interval tree structure to work with genomic regions.
However, I am not sure what is the correct way to change or remove an
existing interval in the tree.
Here is the code example:

IntervalTree<int,long> intervals;

for (int i = 0, sz = candidates.size(); i < sz; ++i ) {
        const BreakpointCandidate& c = candidates.at(i);
        int queryStart = c.pos1;
        int queryEnd = c.pos1 + c.length1 - 1;

        String<long> res;
        findIntervals(intervals, queryStart, queryEnd, res);
        if (length(res) > 0) {

             // TODO:
             // replace the found interval with its union with query interval

        } else {
            addInterval(intervals, queryStart, queryEnd);
        }

    }

Should I directly modify the underlying graph structure in order to
implement the TODO comment? If yes, how can I access the corresponding
interval?

Or would it be better to change the behavior of addInterval() function?

 Thanks in advance,
   Konstantin

_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev



<-- thread -->
<-- date -->
  • References:
    • [Seqan-dev] changing intervals within IntervalTree
      • From: Konstantin Okonechnikov <k.okonechnikov@gmail.com>
  • seqan-dev - August 2012 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the seqan-dev mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal