##STAR构建索引##
STAR --runThreadN 40 --runMode genomeGenerate --genomeDir '/media/shen/disk1/jjc/reference/mm10/ERCC-STAR/' --genomeFastaFiles '/media/shen/disk1/jjc/reference/mm10/GRCm38-ERCC.fa' --sjdbGTFfile '/media/shen/disk1/jjc/reference/mm10/Mus_musculus.GRCm38.84-ERCC.gtf'
##STAR比对##
for ((x=1;x<=20;x++)); do STAR --runThreadN 40 --genomeDir '/media/shen/disk1/jjc/reference/mm10/ERCC-STAR/' --readFilesIn wy-0301-$x.R1.clean.fq.gz wy-0301-$x.R2.clean.fq.gz --outFileNamePrefix ../star-results/wy-0301-$x --readFilesCommand zcat; done
for ((x=1;x<=20;x++)); do samtools sort -@ 30 -o wy-0301-$x.bam wy-0301-$x.sam ; done
##featurecounts计数##
for ((x=1;x<=20;x++)); do featureCounts -T 30 -p -t exon -g gene_id -a '/media/shen/disk1/jjc/reference/mm10/Mus_musculus.GRCm38.84-ERCC.gtf' -o wy-0301-$x-counts.txt wy-0301-$x.bam ; done
for ((x=1;x<=20;x++)) ; do cut -f 1,7 wy-0301-$x-counts.txt | grep -v '^#' > wy-0301-$x_rawcounts.txt
for ((x=1;x<=20;x++)) ; do sed -i '1d' wy-0301-$x.rawcounts.txt ; done
##构建表达矩阵##
for ((x=2;x<=20;x++)) ; do awk '{print $2}' wy-0301-$x.rawcounts.txt > paste-$x.txt ; done
paste wy-0301-1.rawcounts.txt paste-2.txt paste-3.txt paste-4.txt paste-5.txt paste-6.txt paste-7.txt paste-8.txt paste-9.txt paste-10.txt paste-11.txt paste-12.txt paste-13.txt paste-14.txt paste-15.txt paste-16.txt paste-17.txt paste-18.txt paste-19.txt paste-20.txt | head
paste wy-0301-1.rawcounts.txt paste-2.txt paste-3.txt paste-4.txt paste-5.txt paste-6.txt paste-7.txt paste-8.txt paste-9.txt paste-10.txt paste-11.txt paste-12.txt paste-13.txt paste-14.txt paste-15.txt paste-16.txt paste-17.txt paste-18.txt paste-19.txt paste-20.txt > all_rawcounts.txt
##cellinfo##
Cell,phase,genotype,sex
wy.0301.1,PN1,KO,female
wy.0301.2,PN1,KO,female
wy.0301.3,PN1,KO,female
wy.0301.4,PN1,KO,male
wy.0301.5,PN1,KO,male
wy.0301.6,PN1,KO,male
wy.0301.7,PN3,KO,male
wy.0301.8,PN3,KO,male
wy.0301.9,PN3,WT,male
wy.0301.10,PN3,WT,male
wy.0301.11,PN3,WT,male
wy.0301.12,PN3,KO,female
wy.0301.13,PN3,KO,female
wy.0301.14,PN3,WT,female
wy.0301.15,PN3,WT,female
wy.0301.16,PN3,WT,female
wy.0301.17,PN3,KO,cyto
wy.0301.18,PN3,KO,cyto
wy.0301.19,PN3,WT,cyto
wy.0301.20,PN3,WT,cyto