Skip to content

Commit 9e9afb6

Browse files
committed
feat: removing age and output params from the report_predispositions function, docs: TSOPPI code snipets reporting predispositions
1 parent fdc33cc commit 9e9afb6

2 files changed

Lines changed: 46 additions & 17 deletions

File tree

src/tsoppy/cli.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,11 @@ def placeholder(
4141
def report_predispositions(
4242
cancer_susceptibility_genes: Annotated[str, typer.Option("--cancer-susceptibility-genes", "-g")],
4343
small_variant_calls: Annotated[str, typer.Option("--small-variant-calls", "-c")],
44-
age: Annotated[int, typer.Option("--age", "-a")],
45-
output: Annotated[str, typer.Option("--output", "-o")],
4644
):
4745
"""
4846
This function reports variants called by small variant caller that are present
49-
in the cancer susceptibility genes. Susceptibility of a gene depends on a patient's age,
50-
thus the age input parameter.
47+
in the cancer susceptibility genes.
5148
"""
5249

5350
report_predispositions.report_predispositions(
54-
cancer_susceptibility_genes, small_variant_calls, age, output)
51+
cancer_susceptibility_genes, small_variant_calls)

src/tsoppy/report_predispositions/report_predispositions.py

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66

77
# TODO: no functionality yet, just documentation
8-
# TODO: should the output file content some patient ID/sample ID to make sure that that one knows patient ID from the output file content? if so, where should the ID be obtained?
9-
# TODO: should output file name be (1) an input parameter or (2) should it be generated automatically, if (2) then where and how
10-
# TODO: will patient age be available at tsoppy run?
118

129

1310
def load_data_from_cancer_susceptibility_genes_table(cancer_susceptibility_genes):
@@ -21,29 +18,64 @@ def load_data_from_cancer_susceptibility_genes_table(cancer_susceptibility_genes
2118
return csg
2219

2320

24-
def lookup_predispositions(csg, small_variant_calls, age):
21+
def lookup_predispositions(csg, small_variant_calls):
2522
"""
2623
Look up predispositions and store all the relevant info.
2724
"""
2825
predispositions = dict()
2926
# open small_variant_calls file
30-
# iterate through all the variants, store variants in the genes present from csg in predispositions, pending on the age
27+
# iterate through all the variants, store variants in the genes present from csg in predispositions
3128
return predispositions
3229

3330

34-
def print_predispositions_to_output_file(output, predispositions):
31+
def print_predispositions_to_output_file(predispositions):
3532
"""
3633
Print predispositions into the output file.
3734
"""
35+
# generate output path and file name (DNAsampleID/DNAsampleID_predisposition_gene_variant_table_tumor_RNA.tsv)
3836
# open output file for writing
37+
# print out header of the file (including DNAsampleID and version string)
38+
#
39+
# from TSOPPI (user_scripts/libs/05_PCGR_to_variant)interpretation_table.py)
40+
#
41+
# pot_file.write("# [" + SAMPLE_ID + "] Version string: "
42+
# + arg_dict["pipeline_version"] + "\n")
43+
# pot_file.write("# [" + SAMPLE_ID + "] Variants included in this table"
44+
# " are located within one of the cancer predisposition"
45+
# " genes listed in ESMO paper doi:10.1093/annonc/mdz136\n")
46+
# pot_file.write("# [" + SAMPLE_ID + "] Size of the target coding region"
47+
# " (in millions ot bases): " + arg_dict["target_size"]
48+
# + "\n")
49+
# pot_file.write("# [" + SAMPLE_ID + "] Specified tumor purity"
50+
# " (as a fraction between 0 and 1): " + str(TUMOR_PURITY)
51+
# + "\n")
52+
# for info_line in copy_number_header_lines:
53+
# pot_file.write(info_line.replace("# ", "# [" + SAMPLE_ID + "] ")
54+
# + "\n")
55+
# for info_line in predisposition_gene_header_lines:
56+
# pot_file.write(info_line.replace("### ", "# ").replace("# ", "# ["
57+
# + SAMPLE_ID + "] ") + "\n")
58+
#
59+
# pot_file.write("\t".join(["Sample_ID", "Gene_symbol",
60+
# "Ensembl_transcript_ID", "RefSeq_mRNA",
61+
# "Genomic_location", "DNA_change", "cDNA_change",
62+
# "Protein_change",
63+
# "Depth_tumor_DNA", "AF_tumor_DNA",
64+
# "Depth_normal_DNA", "AF_normal_DNA",
65+
# "Depth_tumor_RNA", "AF_tumor_RNA",
66+
# "TCGA_frequency",
67+
# "ICGC_PCAWG_occurrence", "Gene_predisposition",
68+
# "Gene_CN", "CPSR_ACMG_class",
69+
# "CPSR_ClinVar_class", "CPSR_classification_doc"])
70+
# + "\n")
71+
#
3972
# iterate through the predispositions, write out
4073

4174

42-
def report_predispositions(cancer_susceptibility_genes, small_variant_calls, age, output):
75+
def report_predispositions(cancer_susceptibility_genes, small_variant_calls):
4376
"""
4477
This function reports variants called by small variant caller that are present
45-
in the cancer susceptibility genes. Susceptibility of a gene depends on a patient's age,
46-
thus the age input parameter.
78+
in the cancer susceptibility genes.
4779
"""
4880

4981
predispositions = dict()
@@ -54,7 +86,7 @@ def report_predispositions(cancer_susceptibility_genes, small_variant_calls, age
5486
cancer_susceptibility_genes)
5587

5688
logger.info(f"Open the {small_variant_calls} file and iterate through the variants. Store all the variants present in the {cancer_susceptibility_genes} table together with all the info that should be reported into the {predispositions}.")
57-
predispositions = lookup_predispositions(csg, small_variant_calls, age)
89+
predispositions = lookup_predispositions(csg, small_variant_calls)
5890

59-
logger.info(f"Print the {predispositions} content into the {output} file.")
60-
print_predispositions_to_output_file(output, predispositions)
91+
logger.info(f"Print the {predispositions} content into an output file.")
92+
print_predispositions_to_output_file(predispositions)

0 commit comments

Comments
 (0)