wget http://ftp.ensembl.org/pub/release-106/fasta/sus_scrofa/dna/Sus_scrofa.Sscrofa11.1.dna.toplevel.fa.gz
gzip -d Sus_scrofa.Sscrofa11.1.dna.toplevel.fa.gz
wget http://ftp.ensembl.org/pub/release-106/gtf/sus_scrofa/Sus_scrofa.Sscrofa11.1.106.gtf.gz
hisat2-build Sus_scrofa.Sscrofa11.1.dna.toplevel.fa Sus_scrofa
vi fastq-dump.sh
#!/usr/bin/bash
for i in `ls *.sra`
do
fastq-dump --split-files $i &
done
nohup bash fastq-dump.sh
vi gzip.sh
#!/usr/bin/bash
for i in `ls *.fastq`
do
gzip $i &
done
nohup bash gzip.sh
cd /public/jychu/pig_rna_Seq/LW
for i in `pwd`/*;do cd $i;mkdir -p cleandata/bam/count;done
vi RNASQ_test01.sh
#!/usr/bin/bash
SAMPLE=test01
INDEX='/public/jychu/reference/index/hisat/pig/Sus_scrofa'
GTF='/public/jychu/reference/annotate/pig/Sus_scrofa.Sscrofa11.1.106.gtf'
fq1=test01_1.fastq.gz
fq2=test01_2.fastq.gz
#清洗数据
trim_galore -output_dir cleandata --paired --length 36 --quality 25 --stringency 5 $fq1 $fq2
#比对
hisat2 -p 2 -x $INDEX -1 cleandata/${SAMPLE}_1_val_1.fq.gz -2 cleandata/${SAMPLE}_2_val_2.fq.gz | samtools view -@2 -b > cleandata/bam/$SAMPLE.bam
#排序
samtools sort -@2 cleandata/bam/$SAMPLE.bam -o cleandata/bam/$SAMPLE.sort.bam
# 计数
htseq-count -r pos -f bam cleandata/bam/$SAMPLE.sort.bam $GTF > cleandata/bam/count/$SAMPLE.htseq_count
# 统计FPKM值
stringtie cleandata/bam/$SAMPLE.sort.bam -p 2 -A cleandata/bam/count/$SAMPLE.tab -G $GTF -o cleandata/bam/count/$SAMPLE-stringtie.gtf
#删除无用文件(判断最后结果是否存在,如果存在删除无用文件并输出运行成功,否则输出报错)
if [ -f cleandata/bam/count/$SAMPLE-stringtie.gtf ]; then rm -f cleandata/bam/$SAMPLE.bam ;echo "$SAMPLE is done! " >>rna-seq.info ;else echo "$SAMPLE is error! " >>rna-seq.info ;fi
for i in `ls *_1*|tr "_" "\t"|cut -f1`;do sed "s/test01/$i/g" ../RNASQ_test01.sh >RNASQ_$i.sh;done
for i in `ls RNASQ*.sh`;do echo " bash $i &" >>allrun.sh;done
chmod a+x allrun.sh
nohup ./allrun.sh