#!/bin/bash
#SBATCH -t 6:00:00
#SBATCH --nodes=1 --ntasks-per-node=1
#SBATCH --export=NONE
#SBATCH --mail-user=kramsey@uri.edu
#SBATCH --mail-type=BEGIN,END,FAIL

#this script will convert the bedGraph files into bigwig files which are easier to view on IGV

cd /data/kramseylab/sam/2106_RNA-Seq_sam/

for f in *.sam;

do
        PREFIX="${f%.sam}"
	DIRPATH=/data/kramseylab/bam/2106_RNA-Seq_bam
	

	module load kentUtils/397-foss-2019b

    bedGraphToBigWig $DIRPATH/tracks/$PREFIX\_plus.bedGraph /data/kramseylab/genomefiles/LVS_genomefile.txt $DIRPATH/tracks/$PREFIX\_plus.bw
    bedGraphToBigWig $DIRPATH/tracks/$PREFIX\_minus.bedGraph /data/kramseylab/genomefiles/LVS_genomefile.txt $DIRPATH/tracks/$PREFIX\_minus.bw
shift

done

