Skip to content
Snippets Groups Projects
Commit 080ac051 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Merge branch 'master' into fix-urls

parents 628270c9 7075cbdc
No related branches found
No related tags found
1 merge request!102Quick fix the urls
......@@ -14,14 +14,15 @@ test-python:
script:
- apt-get update && apt install -y libblas-dev liblapack-dev python3-dev
- pip install -r requirements.txt
- python setup.py test
- python -m unittest
# - python setup.py test
parallel:
matrix:
- PYTHON_VERSION: [
# '3.7', # EOL
'3.8', # oldest
'3.10', # used in Dockerfile
'3.12', # latest
'3.12',
]
......@@ -127,7 +128,7 @@ build-backend:
-v $(pwd)/.eggs:/code/.eggs
-v $(pwd)/jass.egg-info:/code/jass.egg-info
"$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/${PATH_TAG}:$CI_COMMIT_SHA"
python setup.py test
python -m unittest
build-client-dev:
......
......@@ -8,5 +8,5 @@ spec:
resources:
requests:
storage: 80Gi
storageClassName: isilon
storageClassName: ceph-fs
status: {}
\ No newline at end of file
......@@ -32,8 +32,9 @@ serviceAccount:
podAnnotations: {}
podSecurityContext:
{}
# fsGroup: 1001
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
securityContext:
runAsNonRoot: true
......@@ -85,7 +86,7 @@ backCronTasks:
projects:
size: 19Gi
minSizeToKeepFree: 10240 # size is in MB
storageClassName: isilon
storageClassName: ceph-fs
client:
securityContext:
......
......@@ -17,10 +17,10 @@ from matplotlib import colors
import matplotlib.patches as mpatches
from scipy.stats import norm, chi2
import seaborn as sns
import os
from pandas import DataFrame, read_hdf
import pandas as pd
default_chunk_size=50
def replaceZeroes(df):
"""
......@@ -32,30 +32,34 @@ def replaceZeroes(df):
df.values[df.values == 0] = min_nonzero
return df
def create_global_plot(work_file_path: str, global_plot_path: str):
def get_info_4_global_plot(work_file_path: str):
regions = read_hdf(work_file_path, "Regions",columns=['Region','CHR','MiddlePosition'])
print(regions.dtypes)
N_reg = regions.Region.max() # Keep biggest element in Region column
binf = regions.Region.iloc[0]
chr_considered = regions.CHR.unique()
length_chr = regions.groupby("CHR").MiddlePosition.max() / 10 ** 6
length_chr.loc[0] = 0
return N_reg,binf,chr_considered,length_chr
def create_global_plot(work_file_path: str, global_plot_path: str, chunk_size:int =default_chunk_size):
"""
create_global_plot
generate genome-wide manhattan plot for a given set of phenotypes
"""
regions = read_hdf(work_file_path, "Regions")
chr_length = regions.groupby('CHR').max().position
N_reg= regions.Region.max()
N_reg,binf,chr_considered,length_chr=get_info_4_global_plot(work_file_path)
maxy = 0
fig = plt.figure(figsize=(30, 12))
ax = fig.add_subplot(111)
chunk_size = 50
colors = [
'#4287f5',
'orangered'
]
binf=regions.Region.iloc[0]
bsup= binf+chunk_size
chr_considered= regions.CHR.unique()
length_chr = regions.groupby("CHR").MiddlePosition.max() / 10**6
length_chr.loc[0] = 0
label = "Chr"+length_chr.loc[chr_considered].index.astype("str")
lab_pos = length_chr.loc[chr_considered]/2
......@@ -63,7 +67,7 @@ def create_global_plot(work_file_path: str, global_plot_path: str):
pos_shift.index = pos_shift.index +1
pos_shift.loc[chr_considered[0]] = 0
lab_pos = lab_pos + [pos_shift.loc[i] for i in chr_considered]
bsup = binf + chunk_size
while binf < N_reg:
df = read_hdf(work_file_path, "SumStatTab", columns=["CHR","position", 'JASS_PVAL', "Region"], where = "Region >= {0} and Region < {1}".format(binf, bsup))
binf+= chunk_size
......
jass/test/expected_graphs/expected_global_plot.png

321 KiB

......@@ -3,8 +3,10 @@
from __future__ import absolute_import
import os, shutil, tempfile
from pathlib import Path
import matplotlib as plt
from jass.models import plots
from PIL import Image
import numpy as np
from . import JassTestCase
......@@ -12,10 +14,13 @@ from . import JassTestCase
class TestPlots(JassTestCase):
test_folder = "data_real"
expected_res_folder = "expected_graphs"
#expected_res_folder="baseline_images/test_plot"
def setUp(self):
# Create a temporary directory
self.test_dir = Path(tempfile.mkdtemp())
self.ref_res_dir=Path(os.path.join(os.path.dirname(os.path.abspath(__file__)), self.expected_res_folder))
self.worktable_hdf_path = self.get_file_path_fn("worktable-withnans.hdf5")
def tearDown(self):
......@@ -24,7 +29,15 @@ class TestPlots(JassTestCase):
pass
def test_create_global_plot(self):
#import shutil
#print(plt.rcParams)
plots.create_global_plot(self.worktable_hdf_path, self.test_dir / "global_plot.png")
img_new=Image.open(self.test_dir /"global_plot.png")
img_ref=Image.open(self.ref_res_dir / "expected_global_plot.png")
sum_sq_diff = np.sum((np.asarray(img_new).astype('float') - np.asarray(img_ref).astype('float')) ** 2)
print("sum_sq_diff=",sum_sq_diff)
assert(sum_sq_diff==0.0)
def test_create_qq_plot(self):
plots.create_qq_plot(self.worktable_hdf_path, self.test_dir / "qq_plot.png")
......
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "jass"
authors = [
{name="Hervé Ménager", email='hmenager@pasteur.fr'},
{name="Pierre Lechat", email='pierre.lechat@pasteur.fr'},
{name="Carla Lasry", email='carla.lasry@pasteur.fr'},
{name="Vincent Guillemot", email='vincent.guillemot@pasteur.fr'},
{name="Hugues Aschard", email='hugues.aschard@pasteur.fr'},
{name="Hanna Julienne", email='hanna.julienne@pasteur.fr'}
]
description="JASS allows for single SNP joint analysis of multiple GWAS summary statistics"
readme ="README.md"
dynamic = ["dependencies"]
version = "2.2"
requires-python = ">=3.6"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
[tool.setuptools.packages.find]
include = ["jass*"]
[tool.setuptools.package-data]
jass = ["swagger/swagger.yaml",
"data/*.tsv"]
# include-package-data = true
[project.scripts]
jass="jass.__main__:main"
[project.urls]
Homepage = "https://gitlab.pasteur.fr/statistical-genetics/jass"
[project.license]
text = "MIT"
\ No newline at end of file
......@@ -18,4 +18,4 @@ uvicorn[standard]
typing_extensions; python_version < '3.8'
requests
h5py
wheel
\ No newline at end of file
wheel
[aliases]
test=pytest
......@@ -2,56 +2,22 @@
import os
import pathlib
import pkg_resources
from setuptools import setup, find_packages
NAME = "jass"
VERSION = "2.2"
from setuptools import setup
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, 'README.md')
readme = open(README).read()
with pathlib.Path('requirements.txt').open() as requirements_txt:
REQUIRES = [
str(requirement)
for requirement
in pkg_resources.parse_requirements(requirements_txt)
]
setup(
name=NAME,
version=VERSION,
description="JASS allows for single SNP joint analysis of multiple GWAS summary statistics",
author='Hervé Ménager and Pierre Lechat and Carla Lasry and Vincent Guillemot and Hugues Aschard and Hanna Julienne',
author_email="hmenager@pasteur.fr, pierre.lechat@pasteur.fr, carla.lasry@pasteur.fr, vincent.guillemot@pasteur.fr, hugues.aschard@pasteur.fr, hanna.julienne@pasteur.fr",
url="https://gitlab.pasteur.fr/statistical-genetics/jass",
packages=find_packages(),
install_requires=REQUIRES,
license="MIT",
keywords=["GWAS", "Data analysis", "summary statistics"],
package_data={'jass': ['swagger/swagger.yaml', "data/*.tsv"]},
include_package_data=True,
long_description=readme,
long_description_content_type="text/markdown",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
setup_requires=[
'pytest-runner',
'Flask-Testing'
],
tests_require=[
'pytest',
'Flask-Testing'
],
entry_points={
'console_scripts': [
'jass=jass.__main__:main',
]
}
)
# NAME = "jass"
# VERSION = "2.2"
#
# SETUP_DIR = os.path.dirname(__file__)
# README = os.path.join(SETUP_DIR, 'README.md')
# readme = open(README).read()
#
# with pathlib.Path('requirements.txt').open() as requirements_txt:
# REQUIRES = [
# str(requirement)
# for requirement
# in pkg_resources.parse_requirements(requirements_txt)
# ]
if __name__ == "__main__":
setup()
flask_testing==0.6.1
coverage>=4.0.3
nose>=1.3.7
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment