Commit 0458f11d authored by nfontrod's avatar nfontrod
Browse files

src/gc_content/ change graphic style of the figure

parent ee75d560
......@@ -19,6 +19,7 @@ from pathlib import Path
import seaborn as sns
from .gc_stats import make_stat
from .stat_annot import add_stat_annotation
import matplotlib.font_manager
def get_gc_content(bed_line: List[Any], dic_seq: Fasta) -> float:
......@@ -139,7 +140,11 @@ def make_gc_barplot(df: pd.DataFrame, outfile: Path, environment: int,
:param region_names: The name of the regions analysed
:param ft_name: The name of the feature analyzed
font_files = matplotlib.font_manager.findSystemFonts(fontpaths=None,
font_list = matplotlib.font_manager.createFontList(font_files)
sns.set(context="poster", style="white", font="Arial", font_scale=1.4)
rgn = ", ".join(region_names[:-1]) + " and " + region_names[-1]
title = f"GC content of {rgn} {ft_name}"
p_vals = make_stat(df)
......@@ -164,6 +169,7 @@ def make_gc_barplot(df: pd.DataFrame, outfile: Path, environment: int,
g.set_ylabels("GC content")
g.fig.subplots_adjust(top=0.9), bottom=True)
g.fig.suptitle(title + " and their surrounding regions "
f"of {environment} nucleotides")
......@@ -187,6 +193,7 @@ def create_barplot(beds: List[Path], bed_names: List[str],
df = build_gc_dataframe(bed_content, dic_seq, environment, ft_name)
outfile = ConfigGC.output / \
df.to_csv(str(outfile).replace(".pdf", ".txt"), index=False, sep="\t")
outfile.parent.mkdir(exist_ok=True, parents=True)
make_gc_barplot(df, outfile, environment, bed_names, ft_name)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment