-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSFtool.py
More file actions
executable file
·109 lines (84 loc) · 3.67 KB
/
SFtool.py
File metadata and controls
executable file
·109 lines (84 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
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
44
45
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Herramienta para el manejo automático de hallazgos secundarios.
Esta herramienta permite a los usuarios analizar archivos VCF para el manejo automático de hallazgos secundarios relacionados con riesgo personal, riesgo reproductivo y farmacogenético.
@Dependencies InterVar and AnnoVar
@Usage python3 SFtool.py input_file.vcf --mode <Option: 'basic' or 'advanced'> --evidence <integer> --assembly <Option: '37' or '38'>
@Arguments:
-vcf (str): Ruta al archivo VCF de entrada.
-outpath (str): Ruta al directorio donde se guardarán los resultados.
-mode (str): Modo de análisis (básico o avanzado).
-evidence (int): Nivel de evidencia de ClinVar para el modo avanzado (1-4).#comprobar que lo he puesto de memoria
-assembly (str): Ensamblaje genómico a utilizar (GRCh37 o GRCh38).
@Author Javier Perez FLorido, Edurne Urrutia Lafuente
@Date 2023/08/01
@email javier.perez.florido.sspa@juntadeandalucia.es, edurlaf@gmail.com
@github https://github.com/babelomics/secondaryfindings
"""
import os
import sys
from modules.misc.errors import (
BootstrapError
)
from modules.misc.arguments import parse_arguments
from modules.bootstrap import bootstrap_execution
from modules.FG.run_fg_module import run_pharmacogenomic_risk_module
from modules.misc.report_utils import generate_report
from steps.catalog_generation import run as run_catalog_generation
from steps.clinvar_setup import run as run_clinvar_setup
from steps.sample_preprocessing import run as run_sample_preprocessing
from steps.variant_evidence_preparation import run as run_variant_evidence_preparation
from steps.variant_collection import run as run_variant_collection
from steps.variant_selection import run as run_variant_selection
def main():
# --------------------------
# Parse CLI arguments
# --------------------------
args = parse_arguments()
outdir = args.outdir
# ----------------------------
# STEP 1: SFtool bootstraping: JSON inputs validation, create execution context object and validate run dependencies
# ----------------------------
try:
ctx = bootstrap_execution(args.samples, args.config, outdir)
except BootstrapError as e:
print(f"[ERROR] {e}")
sys.exit(1)
# ----------------------------
# STEP 2: JSON and BED files catalog generation
# ----------------------------
run_catalog_generation(ctx)
# ----------------------------
# STEP 3: CLINVAR DDBB MANAGEMENT
# Only if profile is advanced and for PR and RR categories
# ----------------------------
profile = ctx.profile
# Get unique list of categories for all samples
categories = sorted({
c for s in ctx.samples for c in s.categories
})
if profile == 'advanced' and ("PR" in categories or "RR" in categories):
run_clinvar_setup(ctx)
# ----------------------------
# STEP 4: SAMPLE PREPROCESSING
#
# ----------------------------
run_sample_preprocessing(ctx)
# ----------------------------
# STEP 5: VARIANT EVIDENCE PREPARATION (GENEBE AND/OR CLINVAR)
#
# ----------------------------
run_variant_evidence_preparation(ctx)
# ----------------------------
# STEP 6: VARIANT COLLECTION (GENEBE AND/OR CLINVAR, STRs and SMN1-copy, pharmCAT)
#
# ----------------------------
run_variant_collection(ctx)
# ----------------------------
# STEP 7: VARIANT SELECTION from the set of VARIANT COLLECTION
#
# ----------------------------
run_variant_selection(ctx)
if __name__ == "__main__":
main()