Skip to content
Snippets Groups Projects
Commit f9647cba authored by nfontrod's avatar nfontrod
Browse files

src/bed_handler/select_regulated_near_ctcf_exons.py: modification of...

src/bed_handler/select_regulated_near_ctcf_exons.py: modification of create_bed_ctcf_exon function to also create a bed file for genes
parent 2cd7037b
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ from .config import TestConfig, BedConfig ...@@ -10,6 +10,7 @@ from .config import TestConfig, BedConfig
from .get_gene_regulated_by_ddx import load_sipp_vs_ctcf, format_exon_bed from .get_gene_regulated_by_ddx import load_sipp_vs_ctcf, format_exon_bed
import pandas as pd import pandas as pd
from doctest import testmod from doctest import testmod
from .filter_gene import filter_bed
def filter_ctcf_distance_table(df: pd.DataFrame, reg: str, threshold: int, def filter_ctcf_distance_table(df: pd.DataFrame, reg: str, threshold: int,
...@@ -113,9 +114,16 @@ def create_bed_ctcf_exon(reg: str, threshold: int, ...@@ -113,9 +114,16 @@ def create_bed_ctcf_exon(reg: str, threshold: int,
format_exon_bed(BedConfig.exon_bed, format_exon_bed(BedConfig.exon_bed,
BedConfig.gene_bed)) BedConfig.gene_bed))
df = filter_ctcf_distance_table(df, reg, threshold, location) df = filter_ctcf_distance_table(df, reg, threshold, location)
df.to_csv(BedConfig.bed.output / f"CTCF_{threshold}_{location}_" list_exons = df['id'].to_list()
f"ddx_{reg}_exon.bed", sep="\t", list_genes = [int(exon.split('_')[0]) for exon in list_exons]
index=False) df_exon = filter_bed(BedConfig.exon_bed, list_exons)
df_gene = filter_bed(BedConfig.gene_bed, list_genes)
df_exon.to_csv(BedConfig.bed.output /
f"CTCF_{threshold}_{location}_ddx_{reg}_exon.bed", sep="\t",
index=False)
df_gene.to_csv(BedConfig.bed.output /
f"CTCF_{threshold}_{location}_ddx_{reg}_gene.bed", sep="\t",
index=False)
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment