Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include requirements.txt
include README.md
include LICENSE
include *.txt
recursive-include grim *.py
recursive-include grim *.txt
recursive-include grim *.json
recursive-include grim *.pyx
recursive-include grim *.pyd
2 changes: 1 addition & 1 deletion grim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
"""Top-level package for py-grim."""

__organization__ = "NMDP/CIBMTR Bioinformatics"
__version__ = "0.0.4"
__version__ = "0.0.6"
25 changes: 25 additions & 0 deletions grim/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-

#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
#
# > http://www.fsf.org/licensing/licenses/lgpl.html
# > http://www.opensource.org/licenses/lgpl-license.php
#


__author__ = """Martin Maiers"""
__email__ = 'mmaiers@nmdp.org'
__version__ = '0.0.6'
25 changes: 25 additions & 0 deletions grim/imputation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-

#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
#
# > http://www.fsf.org/licensing/licenses/lgpl.html
# > http://www.opensource.org/licenses/lgpl-license.php
#


__author__ = """Martin Maiers"""
__email__ = 'mmaiers@nmdp.org'
__version__ = '0.0.6'
25 changes: 25 additions & 0 deletions grim/imputation/graph_generation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-

#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
#
# > http://www.fsf.org/licensing/licenses/lgpl.html
# > http://www.opensource.org/licenses/lgpl-license.php
#


__author__ = """Martin Maiers"""
__email__ = 'mmaiers@nmdp.org'
__version__ = '0.0.6'
2 changes: 1 addition & 1 deletion grim/imputation/imputegl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@

__author__ = """Martin Maiers"""
__email__ = 'mmaiers@nmdp.org'
__version__ = '0.0.4'
__version__ = '0.0.6'
65 changes: 65 additions & 0 deletions grim/imputation/imputegl/cutils.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import cython


@cython.boundscheck(False)
@cython.wraparound(False)
cpdef open_ambiguities(list hap, unsigned char loc, tuple split_loc):
cdef unsigned int k, i, p, j #hap_len, haps_len, splits_len
cdef Py_ssize_t hap_len, haps_len, splits_len
cdef list hap_new, hap1
# cdef np.ndarray[STR, ndim=1] hap_new, hap1
p = 0
if len(split_loc) > 1:
# This opens all allele ambiguities
hap_len = len(hap[0])
haps_len = len(hap)
splits_len = len(split_loc)
hap_new = [None] * (haps_len * splits_len)
# hap_new = np.empty(haps_len * splits_len, dtype=np.object) # produces an empty list of haplotypes
hap1 = [None] * hap_len
# hap1 = np.empty(haps_len, dtype=np.object)
for k in range(haps_len): # split a given locus in all haps.

for j in range(hap_len):
hap1[j] = hap[k][j]

for i in range(splits_len):
hap1[loc] = split_loc[i]
hap_new[p] = hap1[:]
p += 1
return hap_new
return hap

@cython.boundscheck(False)
@cython.wraparound(False)
cpdef create_hap_list(list all_haps, dict optionDict, unsigned int N_Loc):
cdef unsigned int i, j, count
cdef list hap_list = []
cdef list all_hap_split

for i in range(len(all_haps)):
all_hap_split = all_haps[i].split('~')
count = 0
for j in range(len(all_hap_split)):
if all_hap_split[j] not in optionDict:
break
else:
count += 1

if count == N_Loc:
hap_list.append(all_hap_split)
return hap_list

@cython.boundscheck(False)
@cython.wraparound(False)
cpdef deepcopy_list(list l):
cdef list copy_l
cdef unsigned int i, length
length = len(l)
copy_l = [None] * length
for i in range(length):
if isinstance(l[i], list):
copy_l[i] = deepcopy_list(l[i])
else:
copy_l[i] = l[i]
return copy_l
Loading