utils
Utils for easyfinemap.
get_significant_snps(df, pvalue_threshold=5e-08, use_most_sig_if_no_sig=True)
¶
Get the significant snps from the input file, filter by pvalue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
The input summary statistics. |
required |
pvalue_threshold |
float
|
The pvalue threshold, by default 5e-8 |
5e-08
|
use_most_sig_if_no_sig |
bool
|
Whether to use the most significant SNP if no significant SNP found, by default True |
True
|
Returns:
Type | Description |
---|---|
DataFrame
|
The significant snps, sorted by pvalue. |
Source code in easyfinemap/utils.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
io_in_tempdir(dir='./tmp')
¶
Make tempdir for process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dir |
str
|
The tempdir, by default './tmp' |
'./tmp'
|
Returns:
Type | Description |
---|---|
decorator
|
The decorator of io in tempdir. |
Source code in easyfinemap/utils.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
make_SNPID_unique(sumstat, replace_rsIDcol=False, remove_duplicates=True)
¶
Make the SNPID unique.
The unique SNPID is chr-bp-sorted(EA,NEA)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sumstat |
DataFrame
|
The input summary statistics. |
required |
replace_rsIDcol |
bool
|
Whether to replace the rsID column with the unique SNPID, by default False |
False
|
remove_duplicates |
bool
|
Whether to remove the duplicated SNPs, keep the one with smallest P-value, by default True |
True
|
Returns:
Type | Description |
---|---|
DataFrame
|
The summary statistics with unique SNPID. |
Source code in easyfinemap/utils.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|