lazy parsing of info #24

Closed
brentp opened this Issue Feb 14, 2012 · 4 comments

Comments

Projects
None yet
2 participants

brentp commented Feb 14, 2012

often times, we'll filter variants on the quality or something.
I think it'd be nice to send the info to _Record as a string and
have .INFO be a property that parses the string on first access.

This could improve the speed.

Owner

jamescasbon commented Feb 15, 2012

+1
I'd thought that the list of sample genotypes could be split as needed
and the parsing of the individual genotype could be done as needed.
I had a quick look around for some kind of python 'promise' library
but didn't find anything obvious.

On Tue, Feb 14, 2012 at 4:37 PM, Brent Pedersen - Bioinformatics
reply@reply.github.com
wrote:

often times, we'll filter variants on the quality or something.
I think it'd be nice to send the info to _Record as a string and
have .INFO be a property that parses the string on first access.

This could improve the speed.


Reply to this email directly or view it on GitHub:
#24

James Casbon

Population Genetics - http://www.populationgenetics.com/
james.casbon@populationgenetics.com
+44 (0)1223 497353

brentp commented Feb 15, 2012

I will look at this when I have time. you don't need promise, you can just use a property

@property
def INFO(self):
    if not self._info: 
        self._info = _parse_info_string(self._info_string)
    return self._info

@brentp brentp referenced this issue Feb 15, 2012

Closed

Cythonize parser #25

Owner

jamescasbon commented Feb 15, 2012

sure, I'm just being lazy and wanted something like:

self.INFO = promise(self._parse_info_string, info_string)

but you're right, it can all be done with properties.

Note, one of the principle optimisations I made originally was to
remove some properties as the access time slowed the parse right down
in the worst case.

On Wed, Feb 15, 2012 at 2:40 PM, Brent Pedersen - Bioinformatics
reply@reply.github.com
wrote:

I will look at this when I have time. you don't need promise, you can just use a property

@property
def INFO(self):
   if not self._info:
       self._info = _parse_info_string(self._info_string)
   return self._info

Reply to this email directly or view it on GitHub:
#24 (comment)

James Casbon

Population Genetics - http://www.populationgenetics.com/
james.casbon@populationgenetics.com
+44 (0)1223 497353

Owner

jamescasbon commented Jun 12, 2012

Closing as my profiling script indicates <0.1 % of time spent in this function. The real action is in #25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment