From f9586e0fcdf2222b10ad36811f12782aeaba2b40 Mon Sep 17 00:00:00 2001
From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr>
Date: Mon, 15 Mar 2021 18:20:52 +0100
Subject: [PATCH] src/commands.sh: add creation of meatagene and gc content
 figure for readthrough, readthrough_ctcf and no_readthrough exon list

---
 src/commands.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/src/commands.sh b/src/commands.sh
index 07fdcb8..e38aac4 100644
--- a/src/commands.sh
+++ b/src/commands.sh
@@ -775,3 +775,63 @@ python3 -m src.visu \
     --norm "None"
 
 mv results/figures/metagene_all_gene_100bin_0_nt-around-0-bin.pdf results/figures/metagene_5y_rnaseq_TSS-2kb_all_gene.pdf
+
+
+#####################################################
+# Metagene figure of last exons in readthrough genes near (<=2000 nt) or far (> 2000nt) from a CTCF file and last exons from non readthrough genes
+#####################################################
+
+# Bed file containing the last exons of expressed gene with readthrough
+python3 -m src.bed_handler.get_last_exons -g results/bed_file/readthrough_expressed_gene.bed -o results/bed_file/readthrough_expressed_last_exon.bed
+
+# Bed file containing the last exons of expressed gene without readthrough
+python3 -m src.bed_handler.get_last_exons -g results/bed_file/no_readthrough_expressed_gene.bed -o results/bed_file/no_readthrough_expressed_last_exon.bed
+
+# Bed file containing the last exon in expressed genes with readthrough near CTCF (<=2000nt)
+python3 -m src.bed_handler.select_regulated_near_ctcf_exons -e results/bed_file/readthrough_expressed_last_exon.bed -t 2000 -l both -i True -N True -n readthrough_last_exon
+
+# Bed file containing the last exon in expressed genes with readthrough near CTCF (>2000nt)
+python3 -m src.bed_handler.select_regulated_near_ctcf_exons -e results/bed_file/readthrough_expressed_last_exon.bed -t 2000 -l both -i True -N False -n readthrough_last_exon
+
+cp results/bed_file/no_readthrough_expressed_gene.bed results/bed_file/no_readthrough_expressed_last_gene-dup.bed
+
+list_names=(readthrough_ctcf readthrough no_readthrough)
+bed_names=(readthrough_last_exon_near_CTCF_2000_both_ddx_with0_exon.bed readthrough_last_exon_far_CTCF_2000_both_ddx_with0_exon.bed no_readthrough_expressed_last_exon.bed)
+for i in ${!list_names[*]}; do
+  cname=${list_names[i]}
+  bed=${bed_names[i]}
+  gbed=${bed/exon\.bed/gene-dup.bed}
+  nbed=${gbed/\.bed/}
+  python3 -m src.visu \
+      --design data/design_exp_all_replicates.txt \
+      --bw_folder data/bigwig/ \
+      --region_bed results/bed_file/${gbed} \
+      --region_name ${cname} \
+      --output results/figures/  \
+      --border_name TSS TTS \
+      --environment 10000 25 \
+      --show_replicate n \
+      --figure_type metagene \
+      --nb_bin 100 \
+      --norm '0'
+
+  rm results/figures/metagene_${cname}_100bin_10000_nt-around-25-bin_b0_norm.pdf
+
+  python3 -m src.visu \
+      --design data/design_exp_all_replicates.txt \
+      --bw_folder data/bigwig/ \
+      --region_bed results/bed_file/${bed} \
+      --region_name ${cname} \
+      --output results/figures/  \
+      --border_name " " " " \
+      --environment 10000 25 \
+      --show_replicate n \
+      --figure_type metagene \
+      --nb_bin 30 \
+      -y 0.15 0.4 \
+      --norm "results/figures/coef_table/tmp_cov_table_design_exp_all_replicates_${nbed}_100bin_10000_nt-around-25-bin_bin0_norm.txt"
+
+  mv results/figures/metagene_${cname}_30bin_10000_nt-around-25-bin_file_norm.pdf results/figures/all_replicates_metaexon_${cname}_30bin_10000_nt-around-25-bin_file_norm.pdf
+done
+
+python3 -m src.gc_content -B results/bed_file/readthrough_last_exon_near_CTCF_2000_both_ddx_with0_exon.bed results/bed_file/readthrough_last_exon_far_CTCF_2000_both_ddx_with0_exon.bed results/bed_file/no_readthrough_expressed_last_exon.bed -b readthrough_ctcf readthrough no_readthrough -g data/Homo_sapiens.GRCh37.dna.primary_assembly.fa -f "exons" -e 2000
\ No newline at end of file
-- 
GitLab