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

src/find_interaction_cluster/clip_figures/clip_analyser.py : changes in...

src/find_interaction_cluster/clip_figures/clip_analyser.py : changes in create_figure and in clip_folder_analysis to be able to create figures of exons regulated by a splicing factor
parent ca427865
No related branches found
No related tags found
No related merge requests found
......@@ -406,7 +406,7 @@ def add_regulation_column(df_table: pd.DataFrame, sf_name: str, feature: str,
def create_figure(project: str, weight: int, global_weight: int,
same_gene: bool, inflation: float, cell_line: str,
feature: str, clip_file: Path,
feature: str, clip_file: Union[Path, Tuple],
feature_bed: Path, test_type: str = "permutation",
iteration: int = 10000, display_size: bool = False,
community_file: str = "", sl_reg: bool = False) -> None:
......@@ -443,20 +443,26 @@ def create_figure(project: str, weight: int, global_weight: int,
same_gene, inflation, cell_line,
feature, community_file)
output.mkdir(exist_ok=True, parents=True)
outfile = output / f"{clip_file.name.split('.')[0]}.pdf"
my_name = clip_file.name.split('.')[0] if isinstance(clip_file, Path) \
else "_".join(clip_file)
outfile = output / f"{my_name}.pdf"
final_table = create_table(feature, clip_file, feature_bed, com_file)
my_name = clip_file.name.split("_")[0] if isinstance(clip_file, Path) \
else "_".join(clip_file)
if sl_reg:
final_table = add_regulation_column(final_table,
clip_file.name.split("_")[0],
my_name,
feature)
my_col = "peak_density" \
if "peak_density" in final_table.columns else "regulation"
print(outfile)
create_community_fig(final_table, feature, my_col, outfile,
test_type, iteration=iteration,
display_size=display_size)
def clip_folder_analysis(clip_folder: Path, project: str, weight: int,
def clip_folder_analysis(clip_folder: Union[Path, Tuple], project: str,
weight: int,
global_weight: int, same_gene: bool, inflation: float,
cell_line: str,
feature: str, test_type: str = "permutation",
......@@ -494,8 +500,11 @@ def clip_folder_analysis(clip_folder: Path, project: str, weight: int,
logging_def(ConfigGraph.community_folder, __file__, logging_level)
feature_bed = ConfigClip.bed_gene if feature == "gene" \
else ConfigClip.bed_exon
files = list(clip_folder.glob("*.bed")) + \
list(clip_folder.glob("*.bed.gz"))
if isinstance(clip_folder, Path):
files = list(clip_folder.glob("*.bed")) + \
list(clip_folder.glob("*.bed.gz"))
else:
files = [clip_folder]
pool = mp.Pool(processes=min(len(files), ps))
processes = []
for mfile in files:
......
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