cpgtools 2.0.3__tar.gz → 2.0.4__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 cpgtools might be problematic. Click here for more details.
- {cpgtools-2.0.3 → cpgtools-2.0.4}/PKG-INFO +6 -24
- {cpgtools-2.0.3 → cpgtools-2.0.4}/pyproject.toml +3 -3
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_PCA.py +4 -1
- cpgtools-2.0.4/scripts/beta_remove_batch_effects.py +138 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/setup.py +1 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgtools.egg-info/PKG-INFO +6 -24
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgtools.egg-info/SOURCES.txt +2 -1
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgtools.egg-info/requires.txt +1 -0
- /cpgtools-2.0.3/LICENSE → /cpgtools-2.0.4/LICENSE.txt +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/MANIFEST.in +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/README.md +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/distribute_setup.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/.DS_Store +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_aggregation.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_anno_position.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_anno_probe.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_density_gene_centered.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_distrb_chrom.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_distrb_gene_centered.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_distrb_region.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_logo.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/CpG_to_gene.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_UMAP.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_jitter_plot.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_m_conversion.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_profile_gene_centered.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_profile_region.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_selectNBest.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_stacked_barplot.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_stats.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_tSNE.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_topN.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/beta_trichotmize.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_Bayes.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_bb.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_fisher.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_glm.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_logit.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_nonparametric.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/dmc_ttest.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/predict_missing.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/scripts/predict_sex.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/setup.cfg +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/BED.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/MI.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/_version.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/cgID.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/AltumAge_cpg.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/AltumAge_multi_platform_cpgs.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/AltumAge_scaler.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Bohlin.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Haftorn.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Knight.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Lee_CPC.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Lee_RPC.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Lee_refined_RPC.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/GA_Mayne.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Hannum.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Horvath_2013.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Horvath_2018.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Levine.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Lu_DNAmTL.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Ped_McEwen.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Ped_Wu.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Zhang_BLUP.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/Zhang_EN.pkl +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/data/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/extend_bed.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/imotif.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/ireader.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/methylClock.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/padjust.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/region2gene.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgmodule/utils.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgtools.egg-info/dependency_links.txt +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/cpgtools.egg-info/top_level.txt +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/contrib/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/contrib/compare.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/contrib/count_missing.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/contrib/describe.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/cs/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/cs/buck_iterative.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/cs/central_tendency.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/cs/em.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/cs/fast_knn.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/cs/random.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/dataset/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/dataset/base.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/dataset/corrupt.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/deletion/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/deletion/complete_case.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/error.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/inverse_distance_weighting.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/matrix.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/testing.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/util.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ops/wrapper.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ts/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ts/locf.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/impyute/ts/moving_window.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/knnimpute.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/missforest.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/pairwise_external.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/tests/__init__.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/tests/test_knnimpute.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/tests/test_missforest.py +0 -0
- {cpgtools-2.0.3 → cpgtools-2.0.4}/src/missingpy/utils.py +0 -0
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cpgtools
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Tools to analyze and visualize DNA methylation data
|
|
5
5
|
Author-email: Liguo Wang <wangliguo78@gmail.com>
|
|
6
6
|
Maintainer-email: Liguo Wang <wangliguo78@gmail.com>
|
|
7
|
-
License:
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
26
|
-
|
|
7
|
+
License-Expression: MIT
|
|
27
8
|
Project-URL: Documentation, https://cpgtools.readthedocs.io/en/latest/index.html
|
|
28
9
|
Project-URL: Repository, https://github.com/liguowang/cpgtools.git
|
|
29
10
|
Keywords: DNA methylation,EPIC,450K,850K,935K,RRBS,WGBS
|
|
30
11
|
Classifier: Programming Language :: Python :: 3
|
|
31
12
|
Classifier: Development Status :: 4 - Beta
|
|
32
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
33
13
|
Classifier: Environment :: Console
|
|
34
14
|
Classifier: Intended Audience :: Science/Research
|
|
35
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
@@ -37,7 +17,7 @@ Classifier: Operating System :: POSIX
|
|
|
37
17
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
38
18
|
Requires-Python: >=3.5
|
|
39
19
|
Description-Content-Type: text/markdown
|
|
40
|
-
License-File: LICENSE
|
|
20
|
+
License-File: LICENSE.txt
|
|
41
21
|
Requires-Dist: numpy
|
|
42
22
|
Requires-Dist: scipy
|
|
43
23
|
Requires-Dist: scikit-learn
|
|
@@ -46,6 +26,8 @@ Requires-Dist: bx-python
|
|
|
46
26
|
Requires-Dist: pandas
|
|
47
27
|
Requires-Dist: umap-learn
|
|
48
28
|
Requires-Dist: fancyimpute
|
|
29
|
+
Requires-Dist: pycombat
|
|
30
|
+
Dynamic: license-file
|
|
49
31
|
|
|
50
32
|
## Install CpGtools using [pip](https://pip.pypa.io/en/stable/)
|
|
51
33
|
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
#Project's meta data
|
|
7
7
|
[project]
|
|
8
|
-
version = "2.0.
|
|
8
|
+
version = "2.0.4"
|
|
9
9
|
name = "cpgtools"
|
|
10
10
|
authors = [
|
|
11
11
|
{name="Liguo Wang", email="wangliguo78@gmail.com"},
|
|
@@ -15,7 +15,7 @@ maintainers = [
|
|
|
15
15
|
]
|
|
16
16
|
description = "Tools to analyze and visualize DNA methylation data"
|
|
17
17
|
readme = "README.md"
|
|
18
|
-
license =
|
|
18
|
+
license = "MIT"
|
|
19
19
|
requires-python = ">=3.5"
|
|
20
20
|
|
|
21
21
|
dependencies = [
|
|
@@ -27,12 +27,12 @@ dependencies = [
|
|
|
27
27
|
"pandas",
|
|
28
28
|
"umap-learn",
|
|
29
29
|
"fancyimpute",
|
|
30
|
+
"pycombat",
|
|
30
31
|
]
|
|
31
32
|
|
|
32
33
|
classifiers=[
|
|
33
34
|
"Programming Language :: Python :: 3",
|
|
34
35
|
'Development Status :: 4 - Beta',
|
|
35
|
-
"License :: OSI Approved :: MIT License",
|
|
36
36
|
'Environment :: Console',
|
|
37
37
|
'Intended Audience :: Science/Research',
|
|
38
38
|
'Operating System :: MacOS :: MacOS X',
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Description
|
|
5
|
+
-----------
|
|
6
|
+
This program corrects batch effect.
|
|
7
|
+
|
|
8
|
+
Example of input data file
|
|
9
|
+
---------------------------
|
|
10
|
+
CpG_ID Sample_01 Sample_02 Sample_03 Sample_04
|
|
11
|
+
cg_001 0.831035 0.878022 0.794427 0.880911
|
|
12
|
+
cg_002 0.249544 0.209949 0.234294 0.236680
|
|
13
|
+
cg_003 0.845065 0.843957 0.840184 0.824286
|
|
14
|
+
...
|
|
15
|
+
|
|
16
|
+
Example of batch file
|
|
17
|
+
-------------------------------
|
|
18
|
+
Sample,Group
|
|
19
|
+
Sample_01,plate_1
|
|
20
|
+
Sample_02,plate_1
|
|
21
|
+
Sample_03,plate_2
|
|
22
|
+
Sample_04,plate_2
|
|
23
|
+
...
|
|
24
|
+
|
|
25
|
+
Notes
|
|
26
|
+
-----
|
|
27
|
+
* Rows with missing values will be removed
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
import sys
|
|
33
|
+
import subprocess
|
|
34
|
+
from optparse import OptionParser
|
|
35
|
+
from cpgmodule.utils import *
|
|
36
|
+
from cpgmodule._version import __version__
|
|
37
|
+
import pandas as pd
|
|
38
|
+
#from sklearn.preprocessing import StandardScaler
|
|
39
|
+
#from sklearn.decomposition import PCA
|
|
40
|
+
from collections import Counter
|
|
41
|
+
from combat.pycombat import pycombat
|
|
42
|
+
import matplotlib.pyplot as plt
|
|
43
|
+
import matplotlib.colors as mcolors
|
|
44
|
+
|
|
45
|
+
__author__ = "Liguo Wang"
|
|
46
|
+
__copyright__ = "Copyleft"
|
|
47
|
+
__credits__ = []
|
|
48
|
+
__license__ = "GPL"
|
|
49
|
+
__maintainer__ = "Liguo Wang"
|
|
50
|
+
__email__ = "wang.liguo@mayo.edu"
|
|
51
|
+
__status__ = "Development"
|
|
52
|
+
|
|
53
|
+
def pick_colors(n):
|
|
54
|
+
my_colors = list(mcolors.CSS4_COLORS.keys())
|
|
55
|
+
if n > len(my_colors):
|
|
56
|
+
print ("Too many colors requested", file = sys.stderr)
|
|
57
|
+
sys.exit()
|
|
58
|
+
return my_colors[0:n]
|
|
59
|
+
|
|
60
|
+
def box_plot(df, s_colors, out_png, ylab="Beta values", title=""):
|
|
61
|
+
s_names = df.columns
|
|
62
|
+
fig, ax = plt.subplots()
|
|
63
|
+
bplot = ax.boxplot(df, patch_artist=True, tick_labels = s_names)
|
|
64
|
+
for patch, color in zip(bplot['boxes'], s_colors):
|
|
65
|
+
patch.set_facecolor(color)
|
|
66
|
+
ax.set_xticklabels(s_names, rotation='vertical')
|
|
67
|
+
plt.ylabel(ylab)
|
|
68
|
+
plt.title(title)
|
|
69
|
+
plt.savefig(out_png)
|
|
70
|
+
|
|
71
|
+
def main():
|
|
72
|
+
|
|
73
|
+
usage="%prog [options]" + "\n"
|
|
74
|
+
parser = OptionParser(usage,version="%prog " + __version__)
|
|
75
|
+
parser.add_option("-i","--input_file",action="store",type="string",dest="input_file",help="Tab-separated data frame file containing beta values with the 1st row containing sample IDs and the 1st column containing CpG IDs.")
|
|
76
|
+
parser.add_option("-g","--group",action="store",type="string",dest="group_file",help="Comma-separated group file defining the batch groups of each sample.")
|
|
77
|
+
parser.add_option("-o","--output",action="store",type='string', dest="out_file",help="The prefix of the output file.")
|
|
78
|
+
(options,args)=parser.parse_args()
|
|
79
|
+
|
|
80
|
+
print ()
|
|
81
|
+
if not (options.input_file):
|
|
82
|
+
print (__doc__)
|
|
83
|
+
parser.print_help()
|
|
84
|
+
sys.exit(101)
|
|
85
|
+
if not (options.group_file):
|
|
86
|
+
print (__doc__)
|
|
87
|
+
parser.print_help()
|
|
88
|
+
sys.exit(101)
|
|
89
|
+
if not (options.out_file):
|
|
90
|
+
print (__doc__)
|
|
91
|
+
parser.print_help()
|
|
92
|
+
sys.exit(103)
|
|
93
|
+
|
|
94
|
+
beta_out = options.out_file + '.combat.tsv'
|
|
95
|
+
beta_boxplot_before = options.out_file + '.boxplot.png'
|
|
96
|
+
beta_boxplot_after = options.out_file + '.boxplot_combat.png'
|
|
97
|
+
|
|
98
|
+
printlog("Reading input file: \"%s\" ..." % (options.input_file))
|
|
99
|
+
df1 = pd.read_csv(options.input_file, index_col = 0, sep="\t")
|
|
100
|
+
|
|
101
|
+
#remove NA and transpose
|
|
102
|
+
df2 = df1.dropna(axis=0, how='any')
|
|
103
|
+
printlog("%d rows with missing values were removed." % (len(df1.index) - len(df2.index)))
|
|
104
|
+
|
|
105
|
+
printlog("Reading group file: \"%s\" ..." % (options.group_file))
|
|
106
|
+
group = pd.read_csv(options.group_file, index_col=0, names=['Sample_ID', 'Group_ID'])
|
|
107
|
+
#check if sample IDs are unique
|
|
108
|
+
if len(group.index) != len(group.index.unique()):
|
|
109
|
+
print ("Sample IDs are not unique", file = sys.stderr)
|
|
110
|
+
sys.exit()
|
|
111
|
+
group.index = group.index.map(str)
|
|
112
|
+
printlog("Group/batch \"%s\" contains %d samples" % (options.group_file, len(group.index)))
|
|
113
|
+
|
|
114
|
+
# a list of unique group names, and their frequencies
|
|
115
|
+
group_info = Counter(group['Group_ID'])
|
|
116
|
+
print(list(group['Group_ID']))
|
|
117
|
+
# a list of unique colors
|
|
118
|
+
color_names = pick_colors(len(group_info))
|
|
119
|
+
color_list = []
|
|
120
|
+
for name,count in zip(color_names, list(group_info.values())):
|
|
121
|
+
color_list.extend([name]*count)
|
|
122
|
+
|
|
123
|
+
printlog("Generate boxplot before correction. Save to '%s'" % beta_boxplot_before)
|
|
124
|
+
box_plot(df2, s_colors=color_list, out_png=beta_boxplot_before, title="Before batch effects correction")
|
|
125
|
+
|
|
126
|
+
# remove batch effect
|
|
127
|
+
printlog("Removing batch effect ...")
|
|
128
|
+
df_corrected = pycombat(df2, list(group['Group_ID']))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
df_corrected.to_csv(beta_out,sep="\t")
|
|
132
|
+
|
|
133
|
+
printlog("Generate boxplot after correction. Save to '%s'" % beta_boxplot_after)
|
|
134
|
+
box_plot(df_corrected, s_colors=color_list, out_png=beta_boxplot_after, title="After batch effects correction")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
if __name__=='__main__':
|
|
138
|
+
main()
|
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cpgtools
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Tools to analyze and visualize DNA methylation data
|
|
5
5
|
Author-email: Liguo Wang <wangliguo78@gmail.com>
|
|
6
6
|
Maintainer-email: Liguo Wang <wangliguo78@gmail.com>
|
|
7
|
-
License:
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
26
|
-
|
|
7
|
+
License-Expression: MIT
|
|
27
8
|
Project-URL: Documentation, https://cpgtools.readthedocs.io/en/latest/index.html
|
|
28
9
|
Project-URL: Repository, https://github.com/liguowang/cpgtools.git
|
|
29
10
|
Keywords: DNA methylation,EPIC,450K,850K,935K,RRBS,WGBS
|
|
30
11
|
Classifier: Programming Language :: Python :: 3
|
|
31
12
|
Classifier: Development Status :: 4 - Beta
|
|
32
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
33
13
|
Classifier: Environment :: Console
|
|
34
14
|
Classifier: Intended Audience :: Science/Research
|
|
35
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
@@ -37,7 +17,7 @@ Classifier: Operating System :: POSIX
|
|
|
37
17
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
38
18
|
Requires-Python: >=3.5
|
|
39
19
|
Description-Content-Type: text/markdown
|
|
40
|
-
License-File: LICENSE
|
|
20
|
+
License-File: LICENSE.txt
|
|
41
21
|
Requires-Dist: numpy
|
|
42
22
|
Requires-Dist: scipy
|
|
43
23
|
Requires-Dist: scikit-learn
|
|
@@ -46,6 +26,8 @@ Requires-Dist: bx-python
|
|
|
46
26
|
Requires-Dist: pandas
|
|
47
27
|
Requires-Dist: umap-learn
|
|
48
28
|
Requires-Dist: fancyimpute
|
|
29
|
+
Requires-Dist: pycombat
|
|
30
|
+
Dynamic: license-file
|
|
49
31
|
|
|
50
32
|
## Install CpGtools using [pip](https://pip.pypa.io/en/stable/)
|
|
51
33
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LICENSE
|
|
1
|
+
LICENSE.txt
|
|
2
2
|
MANIFEST.in
|
|
3
3
|
README.md
|
|
4
4
|
distribute_setup.py
|
|
@@ -20,6 +20,7 @@ scripts/beta_jitter_plot.py
|
|
|
20
20
|
scripts/beta_m_conversion.py
|
|
21
21
|
scripts/beta_profile_gene_centered.py
|
|
22
22
|
scripts/beta_profile_region.py
|
|
23
|
+
scripts/beta_remove_batch_effects.py
|
|
23
24
|
scripts/beta_selectNBest.py
|
|
24
25
|
scripts/beta_stacked_barplot.py
|
|
25
26
|
scripts/beta_stats.py
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|