diff --git a/src/bed_handler/select_regulated_near_ctcf_exons.py b/src/bed_handler/select_regulated_near_ctcf_exons.py index a5a1e88b97021bec8c09da7975d1d9df752d3478..a9c2fdb3a452f10d9f33cdff775ce4808912230f 100644 --- a/src/bed_handler/select_regulated_near_ctcf_exons.py +++ b/src/bed_handler/select_regulated_near_ctcf_exons.py @@ -12,6 +12,7 @@ import pandas as pd from doctest import testmod from .filter_gene import filter_bed import warnings +from .get_other_exon_in_same_gene import create_gene_bed4norm def filter_ctcf_distance_table(df: pd.DataFrame, reg: str, threshold: int, @@ -137,8 +138,7 @@ def create_bed_ctcf_exon(reg: str, threshold: int, :param near_ctcf: True to recover exons near CTCF False to recover \ those far from CTCF """ - if threshold < 0: - threshold = 0 + threshold = max(threshold, 0) if threshold == 0: location = "both" if not include0 and threshold == 0: @@ -177,6 +177,13 @@ def create_bed_ctcf_exon(reg: str, threshold: int, f"{reg}_{i0}_gene.bed", sep="\t", index=False) + df_gene = create_gene_bed4norm(BedConfig.gene_bed, df_exon) + df_gene.to_csv(BedConfig.bed.output / + f"{name_near}CTCF_{threshold}_{location}_ddx_" + f"{reg}_{i0}_gene-dup.bed", + sep="\t", + index=False) + if __name__ == "__main__":