Commit 47c5a59f authored by Sander Bollen's avatar Sander Bollen

further speed increases

parent 1750cf57
......@@ -48,20 +48,22 @@ class CovStats(object):
@property
def coverages(self) -> List[int]:
if self.__coverages is None:
self.__coverages = list(
self.__coverages = np.fromiter(
chain.from_iterable(
(coverage_for_gvcf_record(x) for x in self.records)
)
),
dtype=int
)
return self.__coverages
@property
def gq_qualities(self) -> List[int]:
if self.__gq_qualities is None:
self.__gq_qualities = list(
self.__gq_qualities = np.fromiter(
chain.from_iterable(
(gq_for_gvcf_record(x) for x in self.records)
)
),
dtype=int
)
return self.__gq_qualities
......
......@@ -6,9 +6,9 @@ vtools.optimized
:copyright: (c) 2018 Leiden University Medical Center
:license: MIT
"""
cimport numpy as np
cpdef int amount_atleast(values, int atleast):
cpdef int amount_atleast(np.int64_t[::1] values, int atleast):
"""
Return amount of values at least `atleast`
:param values: Iterable of int
......@@ -17,7 +17,9 @@ cpdef int amount_atleast(values, int atleast):
"""
cdef int passed = 0
cdef int val
for val in values:
cdef size_t i
for i in range(values.shape[0]):
val = values[i]
if val >= atleast:
passed += 1
return passed
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment