#!/bin/bash
######################################################
#参数传递
while getopts "l:m:s:h" opt; do
case $opt in
l)
slist=$OPTARG
;;
m)
maxtseq=$OPTARG
;;
s)
matchsize=$OPTARG
;;
h)
echo ""
;;
# \?)
# echo "Invalid option: -$OPTARG"
# ;;
esac
done
######################################################
#帮助文档
display_usage() {
echo -e "\nThis script is for identifing different modes of duplicated gene pairs and genes"
echo -e "\n\tUsage:bash dupGenFinder.sh -l -m -s \n"
echo -e "\t-l: The target species list file \n"
echo -e "\t-m: parameter for blastp: -max_target_seqs, default is 5 \n"
echo -e "\t-s: match_size (number of genes required to call a collinear block for MCScanX), default is 5 \n\n"
}
# if less than one arguments supplied, display usage
if [ $# -le 0 ]
then
display_usage
exit 1
fi
# check whether user had supplied -h or --help . If yes display usage
if [[ ( $* == "--help") || $* == "-h" ]]
then
display_usage
exit 0
fi
######################################################
#变量判定
if [ ! $matchsize ];then
matchsize=5
fi
if [ ! $maxtseq ];then
maxtseq=5
fi
if [ ! $slist ];then
echo -e "\tERROR: Lack of required list file of species names"
echo -e '\tExample: echo -e "Arabidopsis_thaliana\\nLindera_megaphylla\\nGlycine_max" > SpeciesList'
exit 1
fi
网友评论