參考來源如何用WGDI進行共線性分析(上) - 簡書 (jianshu.com)分析基因組共線性、計算Ks和鑒定WGD —— WGDI | 生信技工 (yanzhongsino.github.io)
還沒寫完 插個眼
#!/bin/bash
cwd=$(pwd)
bin=$cwd/bin
sample_genome_fa=""
query_genome_fa=""
sample_gff=""
query_gff=""
sample_pep_fa=""
query_pep_fa=""
prefix=""
execute_d_command=false
# 顯示腳本的使用方法
show_usage() {
echo "Usage: $0 [-prefix <prefix>] [-s <sample_gff>] [-q <query_gff>] [-sf <sample_genome_fa>] [-qf <query_genome_fa>] [-sp <sample_pep_fa>] [-qp <query_pep_fa>]"
echo "[option]"
echo " -prefix Prefix for the output files"
echo " -s Path to the sample GFF file"
echo " -q Path to the query GFF file"
echo " -sf Path to the sample genome FASTA file"
echo " -qf Path to the query genome FASTA file"
echo " -sp Path to the sample peptide FASTA file"
echo " -qp Path to the query peptide FASTA file"
echo " -d Execute "wgdi -d input.conf" when -d option is provided"
echo " -ks Execute "wgdi -ks input.conf" when -ks option is provided"
echo " --help Show this help message"
}
# 處理命令行選項
while getopts ":prefix:s:q:sf:qf:sp:qp:d-:" opt; do
case $opt in
prefix)
prefix=$OPTARG
;;
s)
sample_gff=$OPTARG
;;
q)
query_gff=$OPTARG
;;
sf)
sample_genome_fa=$OPTARG
;;
qf)
query_genome_fa=$OPTARG
;;
sp)
sample_pep_fa=$OPTARG
;;
qp)
query_pep_fa=$OPTARG
;;
d)
execute_d_command=true
;;
-)
case $OPTARG in
help)
show_usage
exit 0
;;
*)
echo "Invalid option: --$OPTARG" >&2
show_usage
exit 1
;;
esac
;;
\?)
echo "Invalid option: -$OPTARG" >&2
show_usage
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
show_usage
exit 1
;;
esac
done
# 檢查是否提供了prefix參數(shù)醇坝,如果未提供則使用默認的提取操作
if [ -z "$prefix" ]; then
if [ -z "$query_genome_fa" ]; then
echo "Error: You must provide query_genome.fa parameters." >&2
exit 1
fi
# 提取 sample_genome.fa 和 query_genome.fa 中第一個標點符號前的文字部分作為默認prefix
if [ -z "$sample_gff" ]; then
sample_gff=$query_genome_fa
prefix=$(echo "$sample_genome_fa" | awk -F'.' '{print $1}')_"$(echo "$query_genome_fa" | awk -F'.' '{print $1}')"
fi
if [ -z "$sample_gff" ]; then
sample_gff=$query_genome_fa
mkdir -p $prefix
python $bin/01.getgff.py $query_gff $prefix/temp.gff
python $bin/02.gff_lens.py $prefix/temp.gff $prefix/input.gff $prefix/input.len
python $bin/03.seq_newname.py $prefix/input.gff $query_pep_fa $prefix/input.pep.fa
python $bin/03.seq_newname.py $prefix/input.gff $query_cds_fa $prefix/input.cds.fa
### or use bin/generate_conf.py
#python $bin/generate_conf.py -p $prefix $sample.genome.fa $sample.gff
### make blast database
makeblastdb -in input.pep.fa -dbtype prot -out $cwd/db/$(echo "$query_pep_fa" | awk -F'.' '{print $1}')
blastp -num_threads 32 -db $cwd/db/$(echo "$query_pep_fa" | awk -F'.' '{print $1}') -query $sample_pep_fa -outfmt 6 -evalue 1e-5 -num_alignments 20 -out $cwd/$prefix/sample.blastp.txt &
else
# 文件路徑不同的情況下執(zhí)行的命令
python $bin/01.getgff.py "$sample_gff" temp_sample.gff
python $bin/01.getgff.py "$query_gff" temp_query.gff
fi
if $execute_d_command; then
gff1= $sample_gff
echo "Running wgdi -d."
echo "[dotplot]
blast = blast file
gff1 = $sample_gff
gff2 = $query_gff
lens1 = lens1 file
lens2 = lens2 file
genome1_name = $(echo "$sample_genome_fa" | awk -F'.' '{print $1}')
genome2_name = $(echo "$query_genome_fa" | awk -F'.' '{print $1}')
multiple = 1
score = 100
evalue = 1e-5
repeat_number = 10
position = order
blast_reverse = false
ancestor_left = ancestor file or none
ancestor_top = ancestor file or none
markersize = 0.5
figsize = 10,10
savefig = savefile(.png, .pdf, .svg)
">input.conf
wgdi -d input.conf
else
echo "Running specific command when sample_gff is not provided."
# 在這里添加您要執(zhí)行的特定命令(不帶 -d 選項)
fi
# 繪制共線性點陣圖
wgdi -d ? >input.conf
wgdi -d input.conf
#獲取共線性區(qū)塊
wgdi -icl ? >>input.conf
wgdi -icl input.conf
#計算共線性區(qū)塊的基因對間的ka和ks
wgdi -ks ? >>input.conf
wgdi -ks ks.total.conf
#整合共線性區(qū)塊信息
wgdi -bi ? >>input.conf
wgdi -bi input.conf
#過濾并繪制ks點陣圖
wgdi -bk ? >>input.conf
wgdi -bk input.conf
#過濾并繪制ks頻率分布圖
wgdi -kp ? >>input.conf
wgdi -kp input.conf
# 高斯擬合ks頻率分布圖的峰
wgdi -pf ? >>peak.conf
wgdi -pf peak.conf
#擬合結果作圖
wgdi -kf ? >>input.conf
wgdi -kf input.conf
我好菜啊