gwaslab 3.4.49__tar.gz → 3.5.1__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.
Potentially problematic release.
This version of gwaslab might be problematic. Click here for more details.
- {gwaslab-3.4.49/src/gwaslab.egg-info → gwaslab-3.5.1}/PKG-INFO +3 -3
- {gwaslab-3.4.49 → gwaslab-3.5.1}/README.md +1 -1
- {gwaslab-3.4.49 → gwaslab-3.5.1}/pyproject.toml +2 -2
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/bd_get_hapmap3.py +3 -1
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_Sumstats.py +22 -10
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_version.py +2 -2
- gwaslab-3.5.1/src/gwaslab/io_process_args.py +23 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/qc_fix_sumstats.py +9 -5
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_get_sig.py +18 -2
- gwaslab-3.5.1/src/gwaslab/vis_plot_credible sets.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_aux_annotate_plot.py +83 -242
- gwaslab-3.5.1/src/gwaslab/viz_aux_property.py +2 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_aux_quickfix.py +9 -2
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_aux_save_figure.py +2 -1
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_compare_effect.py +870 -523
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_mqqplot.py +74 -21
- gwaslab-3.5.1/src/gwaslab/viz_plot_phe_heatmap.py +260 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_stackedregional.py +1 -1
- {gwaslab-3.4.49 → gwaslab-3.5.1/src/gwaslab.egg-info}/PKG-INFO +3 -3
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab.egg-info/SOURCES.txt +4 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab.egg-info/requires.txt +1 -1
- {gwaslab-3.4.49 → gwaslab-3.5.1}/LICENSE +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/LICENSE_before_v3.4.39 +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/setup.cfg +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/__init__.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/bd_common_data.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/bd_config.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/bd_download.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/cache_manager.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/chrx_par/chrx_par_hg19.bed.gz +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/chrx_par/chrx_par_hg38.bed.gz +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/formatbook.json +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db150_hg19.snplist.gz +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/hapmap3_SNPs/hapmap3_db151_hg38.snplist.gz +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/high_ld/high_ld_hla_hg19.bed.gz +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/high_ld/high_ld_hla_hg38.bed.gz +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/data/reference.json +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_Log.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_Phenotypes.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_SumstatsPair.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_SumstatsT.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_Sumstats_summary.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_meta.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/g_vchange_status.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/hm_casting.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/hm_harmonize_sumstats.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/hm_rsid_to_chrpos.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/io_preformat_input.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/io_read_ldsc.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/io_read_tabular.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/io_to_formats.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/io_to_pickle.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/ldsc_irwls.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/ldsc_jackknife.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/ldsc_ldscore.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/ldsc_parse.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/ldsc_regressions.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/ldsc_sumstats.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/qc_check_datatype.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/run_script.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_abf_finemapping.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_calculate_ldmatrix.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_calculate_prs.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_gwascatalog.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_ldproxyfinder.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_ldsc.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_plink_filter.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_process_h5.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_process_ref.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_2samplemr.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_clumping.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_coloc.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_ex_run_susie.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_calculate_gc.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_calculate_power.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_convert_h2.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_correct_winnerscurse.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_fill_data.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_filter_value.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_get_density.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_meta.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/util_in_snphwe.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_aux_chromatin.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_aux_reposition_text.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_compare_af.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_forestplot.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_miamiplot.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_miamiplot2.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_qqplot.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_regional2.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_regionalplot.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_rg_heatmap.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab/viz_plot_trumpetplot.py +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab.egg-info/dependency_links.txt +0 -0
- {gwaslab-3.4.49 → gwaslab-3.5.1}/src/gwaslab.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gwaslab
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.1
|
|
4
4
|
Summary: A collection of handy tools for GWAS SumStats
|
|
5
5
|
Author-email: Yunye <yunye@gwaslab.com>
|
|
6
6
|
Project-URL: Homepage, https://cloufield.github.io/gwaslab/
|
|
@@ -20,7 +20,7 @@ Requires-Dist: scipy>=1.12
|
|
|
20
20
|
Requires-Dist: pySAM==0.22.1
|
|
21
21
|
Requires-Dist: Biopython>=1.79
|
|
22
22
|
Requires-Dist: adjustText<=0.8,>=0.7.3
|
|
23
|
-
Requires-Dist: liftover
|
|
23
|
+
Requires-Dist: liftover<=1.3.1,>=1.1.13
|
|
24
24
|
Requires-Dist: scikit-allel>=1.3.5
|
|
25
25
|
Requires-Dist: pyensembl==2.2.3
|
|
26
26
|
Requires-Dist: gtfparse==1.3.0
|
|
@@ -51,7 +51,7 @@ Warning: Known issues of GWASLab are summarized in [https://cloufield.github.io/
|
|
|
51
51
|
### install via pip
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
pip install gwaslab==3.
|
|
54
|
+
pip install gwaslab==3.5.0
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
```python
|
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "gwaslab"
|
|
10
|
-
version = "3.
|
|
10
|
+
version = "3.5.1"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name="Yunye", email="yunye@gwaslab.com" },
|
|
13
13
|
]
|
|
@@ -24,7 +24,7 @@ dependencies = [
|
|
|
24
24
|
"pySAM==0.22.1",
|
|
25
25
|
"Biopython>=1.79",
|
|
26
26
|
"adjustText>=0.7.3, <=0.8",
|
|
27
|
-
"liftover>=1.1.13",
|
|
27
|
+
"liftover>=1.1.13, <=1.3.1",
|
|
28
28
|
"scikit-allel>=1.3.5",
|
|
29
29
|
"pyensembl==2.2.3",
|
|
30
30
|
"gtfparse==1.3.0",
|
|
@@ -47,8 +47,10 @@ def gethapmap3(sumstats,rsid="rsID",chrom="CHR", pos="POS", ea="EA", nea="NEA",b
|
|
|
47
47
|
#rsid A1 A2 #CHROM POS
|
|
48
48
|
#rs3094315 G A 1 752566
|
|
49
49
|
|
|
50
|
-
if rsid in sumstats.columns
|
|
50
|
+
if rsid in sumstats.columns:
|
|
51
|
+
log.write(" -rsID will be used for matching...", verbose=verbose)
|
|
51
52
|
output = sumstats.loc[sumstats[rsid].isin(hapmap3_ref["rsid"].values),:].copy()
|
|
53
|
+
log.write(" -Raw input contains "+str(len(output))+" Hapmap3 variants based on rsID...", verbose=verbose)
|
|
52
54
|
return output
|
|
53
55
|
|
|
54
56
|
elif chrom in sumstats.columns and pos in sumstats.columns:
|
|
@@ -81,6 +81,7 @@ from gwaslab.bd_get_hapmap3 import gethapmap3
|
|
|
81
81
|
from gwaslab.util_abf_finemapping import abf_finemapping
|
|
82
82
|
from gwaslab.util_abf_finemapping import make_cs
|
|
83
83
|
import gc
|
|
84
|
+
from gwaslab.viz_plot_phe_heatmap import _gwheatmap
|
|
84
85
|
|
|
85
86
|
#20220309
|
|
86
87
|
class Sumstats():
|
|
@@ -602,6 +603,11 @@ class Sumstats():
|
|
|
602
603
|
def plot_daf(self, **kwargs):
|
|
603
604
|
fig,outliers = plotdaf(self.data, **kwargs)
|
|
604
605
|
return fig, outliers
|
|
606
|
+
|
|
607
|
+
def plot_gwheatmap(self, **kwargs):
|
|
608
|
+
fig = _gwheatmap(self.data, **kwargs)
|
|
609
|
+
return fig
|
|
610
|
+
|
|
605
611
|
def plot_mqq(self, build=None, **kwargs):
|
|
606
612
|
|
|
607
613
|
chrom="CHR"
|
|
@@ -705,7 +711,7 @@ class Sumstats():
|
|
|
705
711
|
# return sumstats object
|
|
706
712
|
return output
|
|
707
713
|
|
|
708
|
-
def check_cis(self, **kwargs):
|
|
714
|
+
def check_cis(self, gls=False, **kwargs):
|
|
709
715
|
if "SNPID" in self.data.columns:
|
|
710
716
|
id_to_use = "SNPID"
|
|
711
717
|
else:
|
|
@@ -717,7 +723,13 @@ class Sumstats():
|
|
|
717
723
|
p="P",
|
|
718
724
|
log=self.log,
|
|
719
725
|
**kwargs)
|
|
720
|
-
|
|
726
|
+
|
|
727
|
+
# return sumstats object
|
|
728
|
+
if gls == True:
|
|
729
|
+
new_Sumstats_object = copy.deepcopy(self)
|
|
730
|
+
new_Sumstats_object.data = output
|
|
731
|
+
gc.collect()
|
|
732
|
+
return new_Sumstats_object
|
|
721
733
|
return output
|
|
722
734
|
|
|
723
735
|
def check_novel_set(self, **kwargs):
|
|
@@ -778,28 +790,28 @@ class Sumstats():
|
|
|
778
790
|
|
|
779
791
|
|
|
780
792
|
## LDSC ##############################################################################################
|
|
781
|
-
def estimate_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, **kwargs):
|
|
793
|
+
def estimate_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right", **kwargs):
|
|
782
794
|
if build is None:
|
|
783
795
|
build = self.meta["gwaslab"]["genome_build"]
|
|
784
|
-
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=
|
|
796
|
+
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
|
|
785
797
|
self.ldsc_h2, self.ldsc_h2_results = _estimate_h2_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
|
|
786
798
|
|
|
787
|
-
def estimate_rg_by_ldsc(self, build=None, verbose=True, match_allele=True,
|
|
799
|
+
def estimate_rg_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right",**kwargs):
|
|
788
800
|
if build is None:
|
|
789
801
|
build = self.meta["gwaslab"]["genome_build"]
|
|
790
|
-
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=
|
|
802
|
+
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
|
|
791
803
|
self.ldsc_rg = _estimate_rg_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
|
|
792
804
|
|
|
793
|
-
def estimate_h2_cts_by_ldsc(self, build=None, verbose=True, match_allele=True,
|
|
805
|
+
def estimate_h2_cts_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right",**kwargs):
|
|
794
806
|
if build is None:
|
|
795
807
|
build = self.meta["gwaslab"]["genome_build"]
|
|
796
|
-
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=
|
|
808
|
+
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
|
|
797
809
|
self.ldsc_h2_cts = _estimate_h2_cts_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
|
|
798
810
|
|
|
799
|
-
def estimate_partitioned_h2_by_ldsc(self, build=None, verbose=True, match_allele=True,
|
|
811
|
+
def estimate_partitioned_h2_by_ldsc(self, build=None, verbose=True, match_allele=True, how="right",**kwargs):
|
|
800
812
|
if build is None:
|
|
801
813
|
build = self.meta["gwaslab"]["genome_build"]
|
|
802
|
-
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=
|
|
814
|
+
insumstats = gethapmap3(self.data.copy(), build=build, verbose=verbose , match_allele=match_allele, how=how )
|
|
803
815
|
self.ldsc_partitioned_h2_summary, self.ldsc_partitioned_h2_results = _estimate_partitioned_h2_by_ldsc(insumstats=insumstats, log=self.log, verbose=verbose, **kwargs)
|
|
804
816
|
# external ################################################################################################
|
|
805
817
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
def _merge_and_sync_dic(list_of_dics:list, default:dict) -> dict:
|
|
3
|
+
temp = copy.copy(default)
|
|
4
|
+
for dic in list_of_dics:
|
|
5
|
+
if isinstance(dic, dict):
|
|
6
|
+
temp.update(dic)
|
|
7
|
+
return temp
|
|
8
|
+
|
|
9
|
+
def _list_func_args(func):
|
|
10
|
+
return func.__code__.co_varnames
|
|
11
|
+
|
|
12
|
+
def _extract_kwargs(prefix:str, default:dict, kwargs:dict) -> dict:
|
|
13
|
+
extracted = []
|
|
14
|
+
for key,value in kwargs.items():
|
|
15
|
+
if key=="kwargs" or key=="args":
|
|
16
|
+
for key_nested,value_nested in kwargs[key].items():
|
|
17
|
+
if prefix in key_nested and "arg" in key_nested:
|
|
18
|
+
extracted.append(value_nested)
|
|
19
|
+
else:
|
|
20
|
+
if prefix in key and "arg" in key:
|
|
21
|
+
extracted.append(value)
|
|
22
|
+
merged_arg = _merge_and_sync_dic(extracted, default)
|
|
23
|
+
return merged_arg
|
|
@@ -1579,14 +1579,14 @@ def liftover_variant(sumstats,
|
|
|
1579
1579
|
|
|
1580
1580
|
try:
|
|
1581
1581
|
if chain is None:
|
|
1582
|
-
converter = get_lifter(from_build,to_build,one_based=True)
|
|
1582
|
+
converter = get_lifter("hg{}".format(from_build),"hg{}".format(to_build),one_based=True)
|
|
1583
1583
|
else:
|
|
1584
|
-
converter = ChainFile(chain, one_based=True)
|
|
1584
|
+
converter = ChainFile(chain,target="",query="", one_based=True)
|
|
1585
1585
|
except:
|
|
1586
1586
|
if chain is None:
|
|
1587
|
-
converter = get_lifter(from_build,to_build)
|
|
1587
|
+
converter = get_lifter("hg{}".format(from_build),"hg{}".format(to_build))
|
|
1588
1588
|
else:
|
|
1589
|
-
converter = ChainFile(chain)
|
|
1589
|
+
converter = ChainFile(chain, target="",query="")
|
|
1590
1590
|
|
|
1591
1591
|
dic= get_number_to_chr(in_chr=False,xymt=["X","Y","M"])
|
|
1592
1592
|
dic2= get_chr_to_number(out_chr=False)
|
|
@@ -1627,11 +1627,15 @@ def parallelizeliftovervariant(sumstats,n_cores=1,chrom="CHR", pos="POS", from_b
|
|
|
1627
1627
|
else:
|
|
1628
1628
|
try:
|
|
1629
1629
|
chain = get_chain(from_build=from_build, to_build=to_build)
|
|
1630
|
-
|
|
1630
|
+
if chain is None or chain==False:
|
|
1631
|
+
raise ValueError("")
|
|
1632
|
+
log.write(" -Creating converter using provided ChainFile: {}".format(chain), verbose=verbose)
|
|
1631
1633
|
except:
|
|
1632
1634
|
chain = None
|
|
1633
1635
|
lifter_from_build=from_build
|
|
1634
1636
|
lifter_to_build=to_build
|
|
1637
|
+
log.write(" -Try creating converter using liftover package", verbose=verbose)
|
|
1638
|
+
|
|
1635
1639
|
log.write(" -Creating converter : {} -> {}".format(lifter_from_build, lifter_to_build), verbose=verbose)
|
|
1636
1640
|
# valid chr and pos
|
|
1637
1641
|
pattern = r"\w\w\w0\w\w\w"
|
|
@@ -619,8 +619,10 @@ def _check_cis(insumstats,
|
|
|
619
619
|
except:
|
|
620
620
|
pass
|
|
621
621
|
|
|
622
|
-
allsig["CIS/TRANS"] = allsig.apply(lambda x: determine_if_cis(x, group_key,windowsizekb, reference_dict), axis=1)
|
|
623
|
-
|
|
622
|
+
#allsig["CIS/TRANS"] = allsig.apply(lambda x: determine_if_cis(x, group_key,windowsizekb, reference_dict), axis=1)
|
|
623
|
+
cis_tuples = allsig.apply(lambda x: determine_if_cis2(x, group_key,windowsizekb, reference_dict), axis=1)
|
|
624
|
+
allsig[["CIS/TRANS","REF_CHR","REF_START","REF_END"]] = pd.DataFrame(cis_tuples.tolist(), index=allsig.index)
|
|
625
|
+
|
|
624
626
|
try:
|
|
625
627
|
allsig = allsig.where(~pd.isna(allsig), pd.NA)
|
|
626
628
|
except:
|
|
@@ -689,6 +691,20 @@ def determine_if_cis(x, group_key,windowsizekb, reference_dict):
|
|
|
689
691
|
else:
|
|
690
692
|
return "NoReference"
|
|
691
693
|
|
|
694
|
+
def determine_if_cis2(x, group_key,windowsizekb, reference_dict):
|
|
695
|
+
if x[group_key] in reference_dict.keys():
|
|
696
|
+
is_same_chr = str(reference_dict[x[group_key]][0]) == str(x["CHR"])
|
|
697
|
+
is_large_than_start = int(reference_dict[x[group_key]][1]) - windowsizekb*1000 <= x["POS"]
|
|
698
|
+
is_smaller_than_end = int(reference_dict[x[group_key]][2]) + windowsizekb*1000 >= x["POS"]
|
|
699
|
+
|
|
700
|
+
if is_same_chr and is_large_than_start and is_smaller_than_end:
|
|
701
|
+
return "Cis", int(reference_dict[x[group_key]][0]), int(reference_dict[x[group_key]][1]), int(reference_dict[x[group_key]][2])
|
|
702
|
+
else:
|
|
703
|
+
return "Trans", int(reference_dict[x[group_key]][0]), int(reference_dict[x[group_key]][1]), int(reference_dict[x[group_key]][2])
|
|
704
|
+
else:
|
|
705
|
+
return "NoReference", pd.NA, pd.NA, pd.NA
|
|
706
|
+
|
|
707
|
+
|
|
692
708
|
def determine_distance(allsig, knownsig):
|
|
693
709
|
if len(allsig)==0:
|
|
694
710
|
return allsig
|
|
File without changes
|