Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
frangiPANe_snake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DIADE
frangiPANe_snake
Commits
4f49cf2f
Commit
4f49cf2f
authored
1 year ago
by
christine.tranchant_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
fix bug plotflagstats
parent
4c4e5ab7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frangiPANe/generate_stats.py
+14
-0
14 additions, 0 deletions
frangiPANe/generate_stats.py
frangiPANe/snakefiles/plot_mapping.smk
+10
-2
10 additions, 2 deletions
frangiPANe/snakefiles/plot_mapping.smk
with
24 additions
and
2 deletions
frangiPANe/generate_stats.py
+
14
−
0
View file @
4f49cf2f
...
...
@@ -275,6 +275,20 @@ def dashboard_fastq(csv, total_size, group_file, output_dir):
plt
.
savefig
(
os
.
path
.
join
(
output_dir
,
f
"
sample_reads_base_ratio.png
"
))
plt
.
close
()
def
plot_flagstat
(
stat_file
,
output_png
):
df_bam_stat
=
pd
.
read_csv
(
stat_file
,
index_col
=
False
,
sep
=
"
,
"
)
df_bam_stat
.
sort_values
(
by
=
[
'
sample
'
],
inplace
=
True
)
plt
.
figure
()
# figsize=(12, 5))
ratio
=
sns
.
scatterplot
(
x
=
'
sample
'
,
y
=
'
value
'
,
hue
=
'
variable
'
,
data
=
pd
.
melt
(
df_bam_stat
,
'
sample
'
))
ratio
.
set
(
xlabel
=
"
sample
"
,
ylabel
=
"
ratio
"
)
ratio
.
set_title
(
"
Read mapped ratio
"
)
plt
.
legend
(
bbox_to_anchor
=
(
1.01
,
1
),
borderaxespad
=
0
);
plt
.
savefig
(
output_png
)
plt
.
close
()
def
dashboard_flagstat
(
stat_file
,
df_group
,
output_png
):
df_bam_stat
=
pd
.
read_csv
(
stat_file
,
index_col
=
False
,
sep
=
"
,
"
)
...
...
This diff is collapsed.
Click to expand it.
frangiPANe/snakefiles/plot_mapping.smk
+
10
−
2
View file @
4f49cf2f
rule plot_mapping:
input:
csv = rules.merge_flagstat.output.stat_file,
group=f"{frangipane_obj.path_group}",
output:
png_mapping=f"{frangipane_obj.path_stat_plot}/mapping_read_ratio-{frangipane_obj.reference_basename}.png",
log:
...
...
@@ -19,4 +18,13 @@ rule plot_mapping:
--------------------
"""
run:
gs.dashboard_flagstat(input.csv,input.group,output.png_mapping)
\ No newline at end of file
df_bam_stat = pd.read_csv(input.csv,index_col=False,sep=",")
df_bam_stat.sort_values(by=['sample'],inplace=True)
plt.figure() # figsize=(12, 5))
ratio = sns.scatterplot(x='sample',y='value',hue='variable',data=pd.melt(df_bam_stat,'sample'))
ratio.set(xlabel="sample",ylabel="ratio")
ratio.set_title("Read mapped ratio ")
plt.legend(bbox_to_anchor=(1.01, 1),borderaxespad=0);
plt.savefig(output.png_mapping)
plt.close()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment