genal-python 1.2.4__tar.gz → 1.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {genal_python-1.2.4 → genal_python-1.2.5}/PKG-INFO +1 -1
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/Geno.py +9 -1
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/__init__.py +1 -1
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/association.py +1 -1
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/extract_prs.py +15 -5
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/lift.py +7 -3
- {genal_python-1.2.4 → genal_python-1.2.5}/pyproject.toml +1 -1
- {genal_python-1.2.4 → genal_python-1.2.5}/.DS_Store +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/.gitignore +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/.readthedocs.yaml +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/Genal_flowchart.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/LICENSE +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/README.md +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/.DS_Store +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/Makefile +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.DS_Store +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.buildinfo +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.doctrees/api.doctree +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.doctrees/environment.pickle +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.doctrees/genal.doctree +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.doctrees/index.doctree +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.doctrees/introduction.doctree +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/.doctrees/modules.doctree +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_images/MR_plot_SBP_AS.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/Geno.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/MR.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/MR_tools.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/MRpresso.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/association.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/clump.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/extract_prs.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/geno_tools.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/lift.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/proxy.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/snp_query.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/genal/tools.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_modules/index.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_sources/api.rst.txt +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_sources/genal.rst.txt +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_sources/index.rst.txt +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_sources/introduction.rst.txt +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_sources/modules.rst.txt +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/basic.css +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/badge_only.css +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.eot +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.svg +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.ttf +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-bold-italic.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-bold-italic.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-bold.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-bold.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-normal-italic.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-normal-italic.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-normal.woff +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-normal.woff2 +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/theme.css +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/doctools.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/documentation_options.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/file.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/js/badge_only.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/js/html5shiv-printshiv.min.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/js/html5shiv.min.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/js/theme.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/language_data.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/minus.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/plus.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/pygments.css +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/searchtools.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/sphinx_highlight.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/api.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/genal.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/genindex.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/index.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/introduction.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/modules.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/objects.inv +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/py-modindex.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/search.html +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/build/searchindex.js +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/make.bat +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/requirements.txt +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/.DS_Store +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/Images/Genal_flowchart.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/Images/MR_plot_SBP_AS.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/Images/genal_logo.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/api.rst +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/conf.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/index.rst +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/introduction.rst +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/docs/source/modules.rst +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/MR.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/MR_tools.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/MRpresso.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/clump.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/constants.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/geno_tools.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/proxy.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/snp_query.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal/tools.py +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/genal_logo.png +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/gitignore +0 -0
- {genal_python-1.2.4 → genal_python-1.2.5}/readthedocs.yaml +0 -0
|
@@ -41,7 +41,8 @@ from .constants import STANDARD_COLUMNS, REF_PANEL_COLUMNS, CHECKS_DICT, MR_METH
|
|
|
41
41
|
# Consider reference panels in build 38
|
|
42
42
|
# Add proxying function (input is df + searchspace (list of SNP or path to .bim, can be separated by chromosomes) and returns proxied df)
|
|
43
43
|
# Get proxies (simply return a list of proxies)
|
|
44
|
-
#
|
|
44
|
+
# Include proxying option to association_test
|
|
45
|
+
# Multi-MR
|
|
45
46
|
# Check stability with variants on sexual chromosomes
|
|
46
47
|
|
|
47
48
|
|
|
@@ -482,6 +483,8 @@ class Geno:
|
|
|
482
483
|
# Extract the SNP list
|
|
483
484
|
snp_list = self.data["SNP"]
|
|
484
485
|
|
|
486
|
+
# Renaming to avoid conflicts with previous extraction
|
|
487
|
+
self.name = str(uuid.uuid4())[:8]
|
|
485
488
|
# Extract SNPs using the provided path and SNP list
|
|
486
489
|
_ = extract_snps_func(snp_list, self.name, path)
|
|
487
490
|
|
|
@@ -638,6 +641,9 @@ class Geno:
|
|
|
638
641
|
if n_del > 0:
|
|
639
642
|
data_prs.drop(index=duplicate_indices, inplace=True)
|
|
640
643
|
print(f"After proxying, {n_del} SNPs had duplicated IDs and were removed.")
|
|
644
|
+
|
|
645
|
+
# Renaming to avoid conflicts with previous extraction
|
|
646
|
+
self.name = str(uuid.uuid4())[:8]
|
|
641
647
|
# Compute PRS
|
|
642
648
|
prs_data = prs_func(data_prs, weighted, path, ram=self.ram, name=self.name)
|
|
643
649
|
|
|
@@ -729,6 +735,8 @@ class Geno:
|
|
|
729
735
|
# Extract the SNP list
|
|
730
736
|
snp_list = data["SNP"]
|
|
731
737
|
|
|
738
|
+
# Renaming to avoid conflicts with previous extraction
|
|
739
|
+
self.name = str(uuid.uuid4())[:8]
|
|
732
740
|
# Extract SNPs using the provided path and SNP list
|
|
733
741
|
path = extract_snps_func(snp_list, self.name, path)
|
|
734
742
|
if path == "FAILED":
|
|
@@ -309,7 +309,7 @@ def _standardize_column_names(data, PHENO, IID, FID):
|
|
|
309
309
|
else:
|
|
310
310
|
data["FID"] = data["IID"]
|
|
311
311
|
print(
|
|
312
|
-
"The FID column was not provided. The
|
|
312
|
+
"The FID column was not provided. The FIDs are assumed to be the same as the IIDs."
|
|
313
313
|
)
|
|
314
314
|
|
|
315
315
|
return data
|
|
@@ -193,17 +193,17 @@ def create_bedlist(bedlist_path, output_name, not_found):
|
|
|
193
193
|
not_found (List[int]): List of chromosome numbers for which no files were found.
|
|
194
194
|
"""
|
|
195
195
|
with open(bedlist_path, "w+") as bedlist_file:
|
|
196
|
-
|
|
196
|
+
found = []
|
|
197
197
|
for i in range(1, 23):
|
|
198
198
|
if i in not_found:
|
|
199
199
|
print(f"bed/bim/fam or pgen/pvar/psam files not found for chr{i}.")
|
|
200
200
|
elif check_pfiles(f"{output_name}_chr{i}"):
|
|
201
201
|
bedlist_file.write(f"{output_name}_chr{i}\n")
|
|
202
|
-
|
|
202
|
+
found.append(i)
|
|
203
203
|
print(f"SNPs extracted for chr{i}.")
|
|
204
204
|
else:
|
|
205
205
|
print(f"No SNPs extracted for chr{i}.")
|
|
206
|
-
return
|
|
206
|
+
return found
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
def extract_snps_from_split_data(name, path, output_path, snp_list_path, filetype):
|
|
@@ -225,11 +225,18 @@ def extract_snps_from_split_data(name, path, output_path, snp_list_path, filetyp
|
|
|
225
225
|
# Merge extracted SNPs from each chromosome
|
|
226
226
|
bedlist_name = f"{name}_bedlist.txt"
|
|
227
227
|
bedlist_path = os.path.join("tmp_GENAL", bedlist_name)
|
|
228
|
-
|
|
228
|
+
found = create_bedlist(
|
|
229
229
|
bedlist_path, os.path.join("tmp_GENAL", f"{name}_extract"), not_found
|
|
230
230
|
)
|
|
231
|
-
if
|
|
231
|
+
if len(found) == 0:
|
|
232
232
|
raise Warning("No SNPs were extracted from any chromosome.")
|
|
233
|
+
|
|
234
|
+
# If only one chromosome was extracted, no need to merge, simply rename the files
|
|
235
|
+
if len(found) == 1:
|
|
236
|
+
chr_path = os.path.join("tmp_GENAL", f"{name}_extract_chr{found[0]}")
|
|
237
|
+
for ext in [".pgen", ".pvar", ".psam", ".log"]:
|
|
238
|
+
os.rename(f"{chr_path}{ext}", f"{output_path}{ext}")
|
|
239
|
+
return None, bedlist_path
|
|
233
240
|
|
|
234
241
|
print("Merging SNPs extracted from each chromosome...")
|
|
235
242
|
merge_command = f"{get_plink_path()} --pmerge-list {bedlist_path} pfile --out {output_path}"
|
|
@@ -286,6 +293,9 @@ def report_snps_not_found(nrow, name):
|
|
|
286
293
|
def handle_multiallelic_variants(name, merge_command, bedlist_path):
|
|
287
294
|
"""Handle multiallelic variants detected during merging."""
|
|
288
295
|
|
|
296
|
+
if merge_command is None:
|
|
297
|
+
return
|
|
298
|
+
|
|
289
299
|
def remove_multiallelic():
|
|
290
300
|
missnp_path = os.path.join(
|
|
291
301
|
"tmp_GENAL", f"{name}_allchr.vmiss"
|
|
@@ -156,9 +156,13 @@ def lift_coordinates_liftover(data, object_id, chain_path, liftover_path):
|
|
|
156
156
|
# Call the liftOver software
|
|
157
157
|
command = f"{liftover_path} {to_lift_filename} \
|
|
158
158
|
{chain_path} {lifted_filename} {unmapped_filename}"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
try:
|
|
160
|
+
output = subprocess.run(
|
|
161
|
+
command, shell=True, capture_output=True, text=True, check=True
|
|
162
|
+
)
|
|
163
|
+
except Exception as e:
|
|
164
|
+
print(f"Error running liftOver: {e}")
|
|
165
|
+
raise ValueError("Error running liftOver. Check error message for more details.")
|
|
162
166
|
|
|
163
167
|
## Read the output, print the number of unlifted SNPs and remove them from the prelift data.
|
|
164
168
|
df_post = pd.read_csv(lifted_filename, sep="\t", header=None)
|
|
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "genal-python" # Updated name for PyPI
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.5"
|
|
8
8
|
authors = [{name = "Cyprien Rivier", email = "riviercyprien@gmail.com"}]
|
|
9
9
|
description = "A python toolkit for polygenic risk scoring and mendelian randomization."
|
|
10
10
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Bold.woff
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Bold.woff2
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Regular.woff
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/Roboto-Slab-Regular.woff2
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.eot
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.svg
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.ttf
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.woff
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/fontawesome-webfont.woff2
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-bold-italic.woff
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-bold-italic.woff2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-normal-italic.woff
RENAMED
|
File without changes
|
{genal_python-1.2.4 → genal_python-1.2.5}/docs/build/_static/css/fonts/lato-normal-italic.woff2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|