All right, here's some wacky ideas from my recent alignments tutorial
work.  These are all minor issues that I stumbled over.

After discussion I'll provide patches or enter these into the issue
tracker (or not, based on the discussion).

---

First, NLMSA objects don't support iteration:

Traceback (most recent call last):
  File "foo.py", line 29, in <module>
    for x in al:
  File "cnestedlist.pyx", line 1676, in pygr.cnestedlist.NLMSA.__getitem__
KeyError: 'key must be a sequence interval or python slice object'

...and they don't report a reasonable error, either.  (The above error
is caused by an attempt to use __getitem__ with an integer, part of
Python's automatic sequence protocol.)

I think we should either define an __iter__ function that says "don't do
this!" *or* we should support the full range of dict functions on NLMSA.
I vote for the former for 0.8, and the latter for post-0.8.

Thoughts?

--

Second, NLMSASlice objects don't behave like a full mapping object,
either.  I think that's OK for now but we should fix this, post-0.8.

--

Third, NLMSASlice objects could use a more informative __repr__.  How
about including the sequence ID (slice.seq.id) in there?

--

And, finally, NLMSASlice keys(), values(), and edges() all take a large
(and identical) set of parameters.  It might be nice to set these
parameters *once* for a given NLMSA instance, and then have those
default settings apply for future queries:

  al = cnestedlist.NLMSA(...)
  al.set_default_query_params(mingaps=4)

  slice = al[seq].keys()   # => mingaps=4 automatically used in keys()

I can see this getting confusing, though, as I wouldn't expect them to
be persistent across NLMSA instances.  I'm curious about what people
think.

Hmm, perhaps one way to do this would be to provide an NLMSA wrapper
object:

  al = cnestedlist.NLMSA(...)
  wrap = NLMSAParamWrapper(al, mingaps=4)
  slice = wrap[seq].keys()   # => mingaps=4 automatically used in keys()

Since I want to provide an NLMSA wrapping anyway (so that we can e.g.
wrap several NLMSAs into one container) this might fit well in there.

--

cheers,
--titus
-- 
C. Titus Brown, c...@msu.edu

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pygr-dev" group.
To post to this group, send email to pygr-dev@googlegroups.com
To unsubscribe from this group, send email to 
pygr-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pygr-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to