Last updated: 2020-01-21
Checks: 7 0
Knit directory: 20170327_Psen2S4Ter_RNASeq/
This reproducible R Markdown analysis was created with workflowr (version 1.6.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20200119)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | c560637 | Steve Ped | 2020-01-20 | Started DE analysis |
Rmd | bc12101 | Steve Ped | 2020-01-20 | Added bash pipeline |
html | bc12101 | Steve Ped | 2020-01-20 | Added bash pipeline |
This document simply provides the bash code used for running the pre-processing and alignment.
cat(readLines("code/runPipeline.sh"), sep = "\n")
#!/bin/bash
#SBATCH -p batch
#SBATCH -N 1
#SBATCH -n 12
#SBATCH --time=2:00:00
#SBATCH --mem=32GB
#SBATCH -o /data/biohub/20170327_Psen2S4Ter_RNASeq/slurm/%x_%j.out
#SBATCH -e /data/biohub/20170327_Psen2S4Ter_RNASeq/slurm/%x_%j.err
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=stephen.pederson@adelaide.edu.au
## Clean run of the PSEN2 data.
## Cores
CORES=12
## Modules
module load FastQC/0.11.7
module load STAR/2.7.0d-foss-2016b
module load SAMtools/1.3.1-GCC-5.3.0-binutils-2.25
module load cutadapt/1.14-foss-2016b-Python-2.7.13
module load Subread/1.5.2-foss-2016b
## Function for checking directories
checkAndMake () {
echo "Checking if $1 exists"
if [[ ! -d $1 ]]
then
echo "Creating $1"
mkdir -p $1
fi
if [[ -d $1 ]]
then
echo "Found $1"
else
echo "$1 could not be created or found"
exit 1
fi
}
## Directories
PROJROOT=/data/biohub/20170327_Psen2S4Ter_RNASeq/data
REFS=/data/biorefs/reference_genomes/ensembl-release-98/danio_rerio/
if [[ ! -d ${REFS} ]]
then
echo "Couldn't find ${REFS}"
exit 1
fi
GTF=${REFS}/Danio_rerio.GRCz11.98.chr.gtf.gz
if [[ ! -f ${GTF} ]]
then
echo "Couldn't find ${GTF}"
exit 1
fi
# Raw Data
RAWDIR=${PROJROOT}/0_rawData
checkAndMake ${RAWDIR}
checkAndMake ${RAWDIR}/FastQC
## Trimmed
TRIMDIR=${PROJROOT}/1_trimmedData
checkAndMake ${TRIMDIR}/fastq
checkAndMake ${TRIMDIR}/FastQC
checkAndMake ${TRIMDIR}/log
## Aligned
ALIGNDIR=${PROJROOT}/2_alignedData
checkAndMake ${ALIGNDIR}
checkAndMake ${ALIGNDIR}/bam
checkAndMake ${ALIGNDIR}/FastQC
checkAndMake ${ALIGNDIR}/log
checkAndMake ${ALIGNDIR}/featureCounts
echo "All directories checked and created"
##----------------------------------------------------------------------------##
## Initial FastQC ##
##----------------------------------------------------------------------------##
fastqc -t ${CORES} -o ${RAWDIR}/FastQC --noextract ${RAWDIR}/fastq/*fastq.gz
##----------------------------------------------------------------------------##
## Trimming ##
##----------------------------------------------------------------------------##
for R1 in ${RAWDIR}/fastq/*R1.fastq.gz
do
R2=${R1%_R1.fastq.gz}_R2.fastq.gz
echo -e "The R1 file should be ${R1}"
echo -e "The R2 file should be ${R2}"
## Create output filenames
out1=${TRIMDIR}/fastq/$(basename $R1)
out2=${TRIMDIR}/fastq/$(basename $R2)
BNAME=${TRIMDIR}/fastq/$(basename ${R1%_1.fq.gz})
echo -e "Output file 1 will be ${out1}"
echo -e "Output file 2 will be ${out2}"
echo -e "Trimming:\t${BNAME}"
LOG=${TRIMDIR}/log/$(basename ${BNAME}).info
echo -e "Trimming info will be written to ${LOG}"
cutadapt \
-a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC \
-A AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT \
-o ${out1} \
-p ${out2} \
-m 35 \
--trim-n \
--max-n=1 \
--nextseq-trim=30 \
${R1} \
${R2} > ${LOG}
done
fastqc -t ${CORES} -o ${TRIMDIR}/FastQC --noextract ${TRIMDIR}/fastq/*fastq.gz
##----------------------------------------------------------------------------##
## STAR Alignment ##
##----------------------------------------------------------------------------##
## Aligning, filtering and sorting
for R1 in ${TRIMDIR}/fastq/*R1.fastq.gz
do
BNAME=$(basename ${R1%_R1.fastq.gz})
R2=${R1%_R1.fastq.gz}_R2.fastq.gz
echo -e "STAR will align:\t${R1}"
echo -e "STAR will also align:\t${R2}"
STAR \
--runThreadN ${CORES} \
--genomeDir ${REFS}/star \
--readFilesIn ${R1} ${R2} \
--readFilesCommand gunzip -c \
--outFileNamePrefix ${ALIGNDIR}/bam/${BNAME} \
--outSAMtype BAM SortedByCoordinate
done
## Move the log files into their own folder
mv ${ALIGNDIR}/bam/*out ${ALIGNDIR}/log
mv ${ALIGNDIR}/bam/*tab ${ALIGNDIR}/log
## Fastqc and indexing
for BAM in ${ALIGNDIR}/bam/*.bam
do
fastqc -t ${CORES} -f bam_mapped -o ${ALIGNDIR}/FastQC --noextract ${BAM}
samtools index ${BAM}
done
##----------------------------------------------------------------------------##
## featureCounts ##
##----------------------------------------------------------------------------##
## Feature Counts - obtaining all sorted bam files
sampleList=`find ${ALIGNDIR}/bam -name "*out.bam" | tr '\n' ' '`
## Extract gtf for featureCounts
zcat ${GTF} > temp.gtf
## Running featureCounts on the sorted bam files
featureCounts -Q 10 \
-s 2 \
-T ${CORES} \
-p \
--fracOverlap 1 \
-a temp.gtf \
-o ${ALIGNDIR}/featureCounts/counts.out ${sampleList}
## Remove the temporary gtf
rm temp.gtf
## Storing the output in a single file
cut -f1,7- ${ALIGNDIR}/featureCounts/counts.out | \
sed 1d > ${ALIGNDIR}/featureCounts/genes.out
##----------------------------------------------------------------------------##
## kallisto ##
##----------------------------------------------------------------------------##
## Aligning, filtering and sorting
for R1 in ${TRIMDIR}/fastq/*R1.fastq.gz
do
sbatch ${PROJROOT}/bash/singleKallisto.sh ${R1}
done
The final step of the above script is to call an instance of the following for each sample.
cat(readLines("code/singleKallisto.sh"), sep = "\n")
#!/bin/bash
#SBATCH -p batch
#SBATCH -N 1
#SBATCH -n 1
#SBATCH --time=2:00:00
#SBATCH --mem=4GB
#SBATCH -o /data/biohub/20170327_Psen2S4Ter_RNASeq/slurm/%x_%j.out
#SBATCH -e /data/biohub/20170327_Psen2S4Ter_RNASeq/slurm/%x_%j.err
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=stephen.pederson@adelaide.edu.au
# Load modules
module load kallisto/0.43.1-foss-2016b
## Reference Files
REFS=/data/biorefs/reference_genomes/ensembl-release-98/danio_rerio/
IDX=/${REFS}/kallisto/Danio_rerio.GRCz11.cdna.primary_assembly.psen2S4Ter.idx
## Directories
PROJROOT=/data/biohub/20170327_Psen2S4Ter_RNASeq/data
## Setup for kallisto output
ALIGNDIR=${PROJROOT}/3_kallisto
## Now organise the input files
F1=$1
F2=${F1%_R1.fastq.gz}_R2.fastq.gz
## Organise the output files
OUTDIR=${ALIGNDIR}/$(basename ${F1%_R1.fastq.gz})
echo -e "Creating ${OUTDIR}"
mkdir -p ${OUTDIR}
echo -e "Currently aligning:\n\t${F1}\n\t${F2}"
echo -e "Output will be written to ${OUTDIR}"
kallisto quant \
-b 50 \
--rf-stranded \
-t 1 \
-i ${IDX} \
-o ${OUTDIR} \
${F1} ${F2}
devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 3.6.2 (2019-12-12)
os Ubuntu 18.04.3 LTS
system x86_64, linux-gnu
ui X11
language en_AU:en
collate en_AU.UTF-8
ctype en_AU.UTF-8
tz Australia/Adelaide
date 2020-01-21
─ Packages ───────────────────────────────────────────────────────────────────
package * version date lib source
assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.6.0)
backports 1.1.5 2019-10-02 [2] CRAN (R 3.6.1)
callr 3.4.0 2019-12-09 [2] CRAN (R 3.6.2)
cli 2.0.1 2020-01-08 [2] CRAN (R 3.6.2)
crayon 1.3.4 2017-09-16 [2] CRAN (R 3.6.0)
desc 1.2.0 2018-05-01 [2] CRAN (R 3.6.0)
devtools 2.2.1 2019-09-24 [2] CRAN (R 3.6.1)
digest 0.6.23 2019-11-23 [2] CRAN (R 3.6.1)
ellipsis 0.3.0 2019-09-20 [2] CRAN (R 3.6.1)
evaluate 0.14 2019-05-28 [2] CRAN (R 3.6.0)
fansi 0.4.1 2020-01-08 [2] CRAN (R 3.6.2)
fs 1.3.1 2019-05-06 [2] CRAN (R 3.6.0)
git2r 0.26.1 2019-06-29 [2] CRAN (R 3.6.1)
glue 1.3.1 2019-03-12 [2] CRAN (R 3.6.0)
htmltools 0.4.0 2019-10-04 [2] CRAN (R 3.6.1)
httpuv 1.5.2 2019-09-11 [2] CRAN (R 3.6.1)
knitr 1.27 2020-01-16 [2] CRAN (R 3.6.2)
later 1.0.0 2019-10-04 [2] CRAN (R 3.6.1)
magrittr 1.5 2014-11-22 [2] CRAN (R 3.6.0)
memoise 1.1.0 2017-04-21 [2] CRAN (R 3.6.0)
pkgbuild 1.0.6 2019-10-09 [2] CRAN (R 3.6.1)
pkgload 1.0.2 2018-10-29 [2] CRAN (R 3.6.0)
prettyunits 1.1.0 2020-01-09 [2] CRAN (R 3.6.2)
processx 3.4.1 2019-07-18 [2] CRAN (R 3.6.1)
promises 1.1.0 2019-10-04 [2] CRAN (R 3.6.1)
ps 1.3.0 2018-12-21 [2] CRAN (R 3.6.0)
R6 2.4.1 2019-11-12 [2] CRAN (R 3.6.1)
Rcpp 1.0.3 2019-11-08 [2] CRAN (R 3.6.1)
remotes 2.1.0 2019-06-24 [2] CRAN (R 3.6.0)
rlang 0.4.2 2019-11-23 [2] CRAN (R 3.6.1)
rmarkdown 2.0 2019-12-12 [2] CRAN (R 3.6.2)
rprojroot 1.3-2 2018-01-03 [2] CRAN (R 3.6.0)
sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.6.0)
stringi 1.4.5 2020-01-11 [2] CRAN (R 3.6.2)
stringr 1.4.0 2019-02-10 [2] CRAN (R 3.6.0)
testthat 2.3.1 2019-12-01 [2] CRAN (R 3.6.1)
usethis 1.5.1 2019-07-04 [2] CRAN (R 3.6.1)
whisker 0.4 2019-08-28 [2] CRAN (R 3.6.1)
withr 2.1.2 2018-03-15 [2] CRAN (R 3.6.0)
workflowr * 1.6.0 2019-12-19 [2] CRAN (R 3.6.2)
xfun 0.12 2020-01-13 [2] CRAN (R 3.6.2)
yaml 2.2.0 2018-07-25 [2] CRAN (R 3.6.0)
[1] /home/steveped/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library