-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge_overlap_mm10.sh
66 lines (55 loc) · 3.25 KB
/
merge_overlap_mm10.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# merge_overlap_mm10.sh
#!/bin/sh
# cell_dir="/home/ygli/gam_paper_data/gam_seq_mapped2/overlap_result_chr1_10kb/"
# merge_output_dir="/home/ygli/gam_paper_data/gam_seq_mapped2/overlap_result_chr1_10kb/"
cell_list=$1
code_dir=$2
cell_dir=$3
merge_output_dir=$4
first_cell=$5
final_cell=$6
echo "doing merge in cell..."
for cell in `cat $cell_list`
do
echo $cell
python ${code_dir}combine_cover.py $cell mm10 ${merge_output_dir} >${cell_dir}${cell}"/cover_mm10.log"
done
cd ${merge_output_dir}
mkdir combine
merge_output_dir=${merge_output_dir}"combine/"
echo "doing merge between cell..."
# for the first 3 column
cut -f 1,2,3 ${cell_dir}${first_cell}/${first_cell}_mm10_total_cover.txt > ${merge_output_dir}first3.txt
# merge first cell
# awk -F'\t' '{print $NF}' ${cell_dir}${first_cell}/${first_cell}_mm10_total_cover.txt | paste ${merge_output_dir}first3.txt - >${merge_output_dir}${first_cell}_mm10_combine.txt
# for cell in `cat $cell_list`
# do
# if [ "$cell" != "$final_cell" ];then
# awk -F'\t' '{print $NF}' ${cell_dir}${cell:0:4}`expr ${cell:4:5} + 1`/${cell:0:4}`expr ${cell:4:5} + 1`_mm10_total_cover.txt | paste ${merge_output_dir}${cell}_mm10_combine.txt - >${merge_output_dir}${cell:0:4}`expr ${cell:4:5} + 1`_mm10_combine.txt
# fi
# # # merge Cell8
# # awk -F'\t' '{print $NF}' ${cell_dir}Cell8/Cell8_C_total_cover.txt | paste ${merge_output_dir}Cell7_C_combine.txt - >${merge_output_dir}Cell8_C_combine.txt
# # # merge Cell9
# # awk -F'\t' '{print $NF}' ${cell_dir}Cell9/Cell9_C_total_cover.txt | paste ${merge_output_dir}Cell8_C_combine.txt - >${merge_output_dir}Cell9_C_combine.txt
# # # merge Cell10
# # awk -F'\t' '{print $NF}' ${cell_dir}Cell10/Cell10_C_total_cover.txt | paste ${merge_output_dir}Cell9_C_combine.txt - >${merge_output_dir}Cell10_C_combine.txt
# # # merge Cell11
# # awk -F'\t' '{print $NF}' ${cell_dir}Cell11/Cell11_C_total_cover.txt | paste ${merge_output_dir}Cell10_C_combine.txt - >${merge_output_dir}Cell11_C_combine.txt
# done
for cell in `cat $cell_list`
do
awk -F'\t' '{print $NF}' ${cell_dir}${cell}/${cell}_mm10_total_cover.txt > ${cell_dir}${cell}/${cell}_mm10_total_cover_lastcol.txt
done
paste ${merge_output_dir}first3.txt ${cell_dir}*/*_mm10_total_cover_lastcol.txt > ${merge_output_dir}${final_cell}_mm10_combine.txt
# # for the first 3 column
# cut -f 1,2,3 ${cell_dir}Cell7/Cell7_S_total_cover.txt > ${merge_output_dir}first3.txt
# # merge Cell7
# awk -F'\t' '{print $NF}' ${cell_dir}Cell7/Cell7_S_total_cover.txt | paste ${merge_output_dir}first3.txt - >${merge_output_dir}Cell7_S_combine.txt
# # merge Cell8
# awk -F'\t' '{print $NF}' ${cell_dir}Cell8/Cell8_S_total_cover.txt | paste ${merge_output_dir}Cell7_S_combine.txt - >${merge_output_dir}Cell8_S_combine.txt
# # merge Cell9
# awk -F'\t' '{print $NF}' ${cell_dir}Cell9/Cell9_S_total_cover.txt | paste ${merge_output_dir}Cell8_S_combine.txt - >${merge_output_dir}Cell9_S_combine.txt
# # merge Cell10
# awk -F'\t' '{print $NF}' ${cell_dir}Cell10/Cell10_S_total_cover.txt | paste ${merge_output_dir}Cell9_S_combine.txt - >${merge_output_dir}Cell10_S_combine.txt
# # merge Cell11
# awk -F'\t' '{print $NF}' ${cell_dir}Cell11/Cell11_S_total_cover.txt | paste ${merge_output_dir}Cell10_S_combine.txt - >${merge_output_dir}Cell11_S_combine.txt