#!/bin/bash
#SBATCH -t 24:00:00
#SBATCH --nodes=1 --ntasks-per-node=1
#SBATCH --export=NONE

module load Bowtie2/2.3.5.1-GCC-8.3.0
module load HTSeq/0.11.2-foss-2019b-Python-3.7.4
module load R-bundle-Bioconductor/3.10-foss-2019b

#bowtie2 -x /data/mramseylab/genomes/cmatr/cmatr /data/mramseylab/raw_reads/2018_subging_gingivitis/SRR5787581.1.fastq -S submeta_SAMPLES1.sam
bowtie2 -x /data/mramseylab/genomes/cmatr/cmatr /data/mramseylab/raw_reads/2018_subging_gingivitis/SRR5787583.1.fastq -S submeta_SAMPLES2.sam
bowtie2 -x /data/mramseylab/genomes/cmatr/cmatr /data/mramseylab/raw_reads/2018_subging_gingivitis/SRR5787585.1.fastq -S submeta_SAMPLES3.sam


#htseq-count -s yes -t CDS -a 1 -m intersection-nonempty -i ID submeta_SAMPLES1.sam /data/mramseylab/genomes/cmatr/cmatr.gff > condition2_submeta_counts1.txt
htseq-count -s yes -t CDS -a 1 -m intersection-nonempty -i ID submeta_SAMPLES2.sam /data/mramseylab/genomes/cmatr/cmatr.gff > condition2_submeta_counts2.txt
htseq-count -s yes -t CDS -a 1 -m intersection-nonempty -i ID submeta_SAMPLES3.sam /data/mramseylab/genomes/cmatr/cmatr.gff > condition2_submeta_counts3.txt

mkdir alignment
mv *.sam ./alignment

mkdir figures
mkdir kegg_analysis
mkdir rnaseq_analysis

Rscript deseq_tablesandkegg.R
