lenarother / moderna

A program for comparative RNA modeling.
GNU General Public License v3.0
10 stars 2 forks source link

Decide on interface for Renumerator #40

Open krother opened 10 years ago

cosi1 commented 10 years ago

Maybe something like that would do the job?

__init__(structure, alignment = False)

When alignment is given, the constructor automatically inserts required gaps, basing on that alignment. If not, it is assumed that nothing will be inserted unless the user invokes _insertgap() manually.

insert_gap(position, length)

Inserts a gap at a given position.

renumber()

Applies all the insertions to the structure passed to the constructor.

krother commented 10 years ago

Would the structure be the template or the model? Can I use it for both (e.g. when modeling multiple templates or fragments?

I would like to have a method that renumbers a small section:

def renumber_section(index_start, index_end)

E.g. for renumbering a fragment at a specific location. If no alignment is given, the indices can be interpreted as residue numbers directly.

cosi1 commented 10 years ago

Would the structure be the template or the model? Can I use it for both (e.g. when modeling multiple templates or fragments?

I think that it would be best to operate on both template and model (since they are both descendants of ModernaStructure).

def renumber_section(index_start, index_end)

Could you explain that?

krother commented 10 years ago

The idea was to use Renumerator to renumber a fragment before inserting it. For that, Renumerator needs to know which part of the model it belongs to. Or would we create a proxy alignment for each fragment?

I agree that Renumerator could operate on both templates and models.

cosi1 commented 10 years ago

The idea was to use Renumerator to renumber a fragment before inserting it. For that, Renumerator needs to know which part of the model it belongs to. Or would we create a proxy alignment for each fragment?

Hmm... I didn't think of it that way... I always thought of the renumerator as a tool to insert gaps into structures (templates and models). Maybe we might need to rethink the idea of the renumerator to be more versatile.

krother commented 10 years ago

OK now I understand better. For that the interface you propose is very sound. I think this part is ready to be implemented. No need to mix responsibilities.

We also need to figure out where to put the renumeration code from Fragments. Could be a separate place.

cosi1 commented 10 years ago

Ok, so let's wait for Lena's opinion. When we reach consensus, I'll start implementing the logic (basically copypasting from renumber_template()).

lenarother commented 10 years ago

OK, I agree that there can be one class for renumbering Template and Model and separate for renumbering Fragment.

lenarother commented 10 years ago

Some comments on renumeration from Asia in #30.