CSDN:记录bug史
#!/bin/bash
#PBS -N kissplice
#PBS -l nodes=zhangxclab002:ppn=12
#PBS -q batch
#PBS -V
#PBS -S /bin/bash
myPATH="/home/usr/transnp"
rawdata="/home/usr/transnp/rawdata"
#Write before all:
# if you use conda, please activate your environment needed in these scripts;
# 1. and 2. step can run together without conflict
#1. transdecoder1.sh & transdecoder2.sh : output .bed files;
#2. kissplice.sh : output *type_0a.fa file;
#3. blat.sh needs rawdata,type_0a.fa,blat.psl;
#4. kiss2reftran.sh relies on the previous four script-outputs;
#5. finally run clean.sh to put the same file type to one directory, thus clean the screen to make tidy results.
transdecoder1.sh(){
##############################################################transdecoder1.sh################################################
#判断.fa文件并按顺序执行
cd $myPATH
dir=$(ls -l $rawdata |awk '!/^d/ {print $NF}' |grep -i ".fa" )
for i in $dir
do
/home/usr/packages/TransDecoder-master/TransDecoder.LongOrfs -t $rawdata/$i
done
}
transdecoder2.sh(){
##############################################################transdecoder2.sh################################################
#判断.fa文件并按顺序执行
cd $myPATH
dir=$(ls -l $rawdata |awk '!/^d/ {print $NF}' |grep -i ".fa" )
for i in $dir
do
/home/usr/packages/TransDecoder-master/TransDecoder.Predict -t $rawdata/$i
done
echo "running transdecoder2 success"
}
kissplice.sh(){
##############################################################kissplice.sh:###################################################
#判断.fa文件并按顺序执行
cd $myPATH
#$comman=""
dir=$(ls -l $rawdata |awk '!/^d/ {print $NF}' |grep -i ".fa" )
for i in $dir
do
comma=" -r $rawdata/$i "
comman="$comman"" $comma"
done
echo "$comman"
#echo "start snp-calling"
if [ ! -d "$myPATH/kissplice_result" ];then
mkdir $myPATH/kissplice_result
fi
runkissplice="kissplice ""$comman"" -s 1 -o $myPATH/kissplice_result"
echo "$runkissplice"
$runkissplice
}
blat.sh(){
##############################################################blat.sh########################################################
#判断kissplice是否生成所需文件
cd $myPATH
files=$(ls $myPATH/kissplice_result/*type_0a.fa 2> /dev/null | wc -l)
if [ "$files" != "0" ] ;then #如果存在文件
echo "start BLAT"
if [ ! -d "$myPATH/blat_result" ];then
mkdir $myPATH/blat_result
fi
dir=$(ls -l $rawdata |awk '!/^d/ {print $NF}' |grep -i ".fa" )
for i in $dir
do
/home/usr/packages/blatsuite/blat -minIdentity=80 -q=rna $rawdata/$i $myPATH/kissplice_result/*type_0a.fa $myPATH/blat_result/blat_$i.psl
done
echo "blat run success"
else
echo "type_0a.fa not found, please check kissplice output"
fi
}
kiss2reftrans.sh(){
##############################################################kiss2reftrans.sh###############################################
cd $myPATH
#if [ ! -d "$myPATH/bedfiles/reftrans_$i" ];then
#cp $myPATH/*.bed $myPATH/bedfiles
#fi
#echo "bedfiles moved"
dir=$(ls -l $rawdata |awk '!/^d/ {print $NF}' |grep -i ".fa" )
for i in $dir
do
if [ ! -d "$myPATH/bedfiles/reftrans_$i" ];then
cp $myPATH/*.bed $myPATH/bedfiles
echo "bedfiles moved"
fi
if [ ! -d "$myPATH/reftrans_$i" ];then
mkdir $myPATH/reftrans_$i
fi
kissplice2reftranscriptome -b $myPATH/bedfiles/$i*.bed -k $myPATH/kissplice_result/*type_0a.fa -t $myPATH/blat_result/blat_$i.psl -o $myPATH/reftrans_$i/reftrans_$i.tsv -l $myPATH/reftrans_$i/lowQ_$i.tsv
echo "kiss2reftrans_$i success"
done
#now move data to make clean results
}
clean.sh(){
##############################################################clean.sh#######################################################
#now move data to make clean results
cd $myPATH
if [ ! -d "$myPATH/tsv_results" ];then
mkdir tsv_results
fi
mv *.tsv ./tsv_results
if [ ! -d "$myPATH/otherprocess_results" ];then
mkdir otherprocess_results
fi
mv *.Trinity.fa.* ./otherprocess_results
mv *.cmds ./otherprocess_results
}
transdecoder1.sh && transdecoder2.sh && kissplice.sh && blat.sh && kiss2reftrans.sh && clean.sh
↑最后一行请用前更改