polish: make genes read by list instead of ls
This commit is contained in:
parent
7636c65c5a
commit
3a761cbe2a
1 changed files with 28 additions and 8 deletions
36
batch.sh
36
batch.sh
|
@ -21,7 +21,7 @@ HELP=false
|
||||||
|
|
||||||
### Get some arrays
|
### Get some arrays
|
||||||
|
|
||||||
ARGS=$(getopt -o c:,f:,h,l:,m:,r:,t: --long contig:,functions:,help,list:,memory:,reference:,threads: -n 'batch.sh' -- "$@")
|
ARGS=$(getopt -o c:,f:,g:,h,l:,m:,r:,t: --long contigs:,genes:,functions:,help,list:,memory:,reference:,threads: -n 'batch.sh' -- "$@")
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Failed to parse options." >&2
|
echo "Failed to parse options." >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -30,11 +30,16 @@ eval set -- "$ARGS"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-c|--contig)
|
-c|--contigs)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"") ARG_C='scaffolds'; shift 2 ;;
|
"") ARG_C='scaffolds'; shift 2 ;;
|
||||||
*) ARG_C=$2; shift 2 ;;
|
*) ARG_C=$2; shift 2 ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
-g|--genes)
|
||||||
|
case "$2" in
|
||||||
|
"") shift 2 ;;
|
||||||
|
*) ARG_G=$2; shift 2 ;;
|
||||||
|
esac ;;
|
||||||
-f|--functions)
|
-f|--functions)
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"") ARG_F='all'; shift 2 ;;
|
"") ARG_F='all'; shift 2 ;;
|
||||||
|
@ -45,14 +50,15 @@ while true; do
|
||||||
Version: $pkgver\n \
|
Version: $pkgver\n \
|
||||||
License: GPL-3.0-only\n \
|
License: GPL-3.0-only\n \
|
||||||
Author: Guoyi Zhang\n \
|
Author: Guoyi Zhang\n \
|
||||||
-c\t--contig\tcontings type: scaffolds or contigs\n \
|
-c\t--contigs\tcontings type: scaffolds or contigs\n \
|
||||||
|
-g\t--genes\tgene file path\n \
|
||||||
-f\t--functions\tfunctions type (optional): all clean assembly fasta map pre split merge align\n \
|
-f\t--functions\tfunctions type (optional): all clean assembly fasta map pre split merge align\n \
|
||||||
-h\t--help\thelp: show this information\n \
|
-h\t--help\thelp: show this information\n \
|
||||||
-l\t--list\tlist file path\n \
|
-l\t--list\tlist file path\n \
|
||||||
-m\t--memory\tmemory settings (optional, default 16 GB)\n \
|
-m\t--memory\tmemory settings (optional, default 16 GB)\n \
|
||||||
-r\t--reference\treference genome path\n \
|
-r\t--reference\treference genome path\n \
|
||||||
-t\t--threads\tthreads setting (optional, default 8 threads)\n \
|
-t\t--threads\tthreads setting (optional, default 8 threads)\n \
|
||||||
for example: bash $0 -c scaffolds -f all -l list -r Reference.exons.aa.fas \n"
|
for example: bash $0 -c scaffolds -f all -l list -g genes -r Reference.exons.aa.fas \n"
|
||||||
HELP=true
|
HELP=true
|
||||||
shift ;;
|
shift ;;
|
||||||
-l|--list)
|
-l|--list)
|
||||||
|
@ -89,7 +95,9 @@ if [ "$HELP" = false ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readarray -t full_names < "$ARG_L"
|
readarray -t full_names < "$ARG_L"
|
||||||
|
readarray -t genes < "$ARG_G"
|
||||||
length_fn=${#full_names[@]}
|
length_fn=${#full_names[@]}
|
||||||
|
length_gn=${#genes[@]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Quality control && Trimming
|
### Quality control && Trimming
|
||||||
|
@ -214,12 +222,18 @@ fi
|
||||||
|
|
||||||
if [ "$ARG_F" = "all" ] || [ "$ARG_F" = "merge" ]; then
|
if [ "$ARG_F" = "all" ] || [ "$ARG_F" = "merge" ]; then
|
||||||
|
|
||||||
|
## Check if the genes is specified
|
||||||
|
if [ -z "$ARG_G" ] ; then
|
||||||
|
echo "Argument of genes list missing."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p $DirMerge
|
mkdir -p $DirMerge
|
||||||
cd $DirSplit
|
cd $DirSplit
|
||||||
for genes in $(ls)
|
for (( i=0; i<$length_gn; i++ ))
|
||||||
do
|
do
|
||||||
cd $genes
|
cd ${genes[$i]}
|
||||||
cat * > ../$genes.fasta
|
cat * > ../${genes[$i]}.fasta
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
mv *.fasta ../$DirMerge
|
mv *.fasta ../$DirMerge
|
||||||
|
@ -229,10 +243,16 @@ fi
|
||||||
|
|
||||||
if [ "$ARG_F" = "all" ] || [ "$ARG_F" = "align" ]; then
|
if [ "$ARG_F" = "all" ] || [ "$ARG_F" = "align" ]; then
|
||||||
|
|
||||||
|
## Check if the genes is specified
|
||||||
|
if [ -z "$ARG_G" ] ; then
|
||||||
|
echo "Argument of genes list missing."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p $DirAlign
|
mkdir -p $DirAlign
|
||||||
mkdir -p $DirAlign/AA && mkdir -p $DirAlign/NT
|
mkdir -p $DirAlign/AA && mkdir -p $DirAlign/NT
|
||||||
cd $DirMerge
|
cd $DirMerge
|
||||||
for genes in $(ls | sed "s@.fasta@@g")
|
for (( i=0; i<$length_gn; i++ ))
|
||||||
do
|
do
|
||||||
java -jar $PathMacse -prog alignSequences -seq ${genes}.fasta -out_AA ../$DirAlign/AA/$genes.fasta -out_NT ../$DirAlign/NT/$genes.fasta
|
java -jar $PathMacse -prog alignSequences -seq ${genes}.fasta -out_AA ../$DirAlign/AA/$genes.fasta -out_NT ../$DirAlign/NT/$genes.fasta
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue