From 56acd6e8a9a3dd0d0d0cf21faf2163c40baa8548 Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Fri, 16 Apr 2021 13:49:04 +0200 Subject: [PATCH] src/gc_content/gc_content.py: add an id column in the table returned by build_gc_dataframe, change bar colors in make_gc_barplot function --- src/gc_content/gc_content.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gc_content/gc_content.py b/src/gc_content/gc_content.py index 35e025c..5917249 100644 --- a/src/gc_content/gc_content.py +++ b/src/gc_content/gc_content.py @@ -117,7 +117,7 @@ def build_gc_dataframe(bed_content: List[List], dic_seq: Fasta, :param ft_name: A name corresponding to the feature of interest :return: a table containing the gc content of the intervals """ - dic = {"gc_content": [], "region": [], "location": []} + dic = {"gc_content": [], "region": [], "location": [], "id": []} for bed_line in bed_content: res = get_many_gc_content(bed_line, dic_seq, environment) @@ -125,6 +125,7 @@ def build_gc_dataframe(bed_content: List[List], dic_seq: Fasta, dic["gc_content"].append(res[k]) dic["location"].append(k.replace("interval", ft_name)) dic["region"].append(bed_line[6]) + dic["id"].append(bed_line[3]) return pd.DataFrame(dic) @@ -150,7 +151,9 @@ def make_gc_barplot(df: pd.DataFrame, outfile: Path, environment: int, p_vals = make_stat(df) if environment != 0: g = sns.catplot(x="location", y="gc_content", hue="region", data=df, - aspect=1.77, height=12, kind="violin") + aspect=1.77, height=12, kind="violin", + palette={"readthrough_ctcf": "orange", + "readthrough": "#13791C", "no_readthrough": "#B6B6B6"}) add_stat_annotation(g.ax, data=df, x="location", y="gc_content", hue="region", loc='inside', -- GitLab