Small snippet that generates a genome index and aligns the RNAseq reads. #2

Merged
J.v.N. merged 2 commits from step3/star-alignment-snippet into master 2021-02-15 17:09:32 +01:00
1 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,53 @@
#!/bin/bash
#
# Align reads against reference genome.
STORAGE="/groups/umcg-griac/tmp04/rawdata/$(whoami)/step3"

I think /groups/umcg-griac/tmp04/rawdata/$(whoami) should be a separate variable named 'project_directory' (or similar). This implies that the project has to be here.

I think `/groups/umcg-griac/tmp04/rawdata/$(whoami)` should be a separate variable named 'project_directory' (or similar). This implies that the project has to be here.
# Store genome index in this location:.
GENOME_INDEX="${STORAGE}/genome_index"
mkdir -p "${GENOME_INDEX}"
# Store the generated `Aligned.sortedByCoord.out.bam` in this dir.
ALIGNMENT_OUTPUT="${STORAGE}/alignment"
mkdir -p "${ALIGNMENT_OUTPUT}"

${OUTPUT} is unknown - should probably be ${ALIGNMENT_OUTPUT}

${OUTPUT} is unknown - should probably be ${ALIGNMENT_OUTPUT}
# 1) Generate genome index.
#
# N.B.:
# - We're assuming a read size of 100 bp (--sjdbOverhang 100). Refer back to the
# previous quality control steps if you are unsure about the size. In case of
# reads of varying length, the ideal value is max(ReadLength)-1.
# - We're using gzip compressed reference data (--readFilesCommand zcat), i.e.,
# .gtf.gz and fa.gz. If not, you can remove the `zcat` flag.
# Storage location reference data (in this case on calculon).
REFERENCE_DATA="/groups/umcg-griac/prm02/rawdata/reference/genome"
GTF_FILE="${REFERENCE_DATA}/Homo_sapiens.GRCh38.100.gtf.gz"

I am unsure if STAR will decompress these files. Should I decompress them? Also, make sure the user notes the genome version.

I am unsure if STAR will decompress these files. Should I decompress them? Also, make sure the user notes the genome version.
Alternative reference file use : gencode.v19.annotation.gtf/gff3
##### Alternative reference file use : gencode.v19.annotation.gtf/gff3

Should I upload these to the server as well? Also, what is the reason to use another reference file than the ones we already have?

Should I upload these to the server as well? Also, what is the reason to use another reference file than the ones we already have?
FASTA_FILE="${REFERENCE_DATA}/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz"
Alternative assembly file used : Homo_sapiens_assembly19.fasta
##### Alternative assembly file used : Homo_sapiens_assembly19.fasta
STAR \
--runThreadN 8 \
--runMode genomeGenerate \
--readFilesCommand zcat \
--sjdbOverhang 100 \
sjdbOverhang 150
This was chosen based on the base pair reads for my analysis
##### sjdbOverhang 150 ##### This was chosen based on the base pair reads for my analysis

Alternative cut-off used : 150

This is also due to how my samples were sequenced (low-input method)

#### Alternative cut-off used : 150 #### This is also due to how my samples were sequenced (low-input method)

Alternative sjbOverhang cut-off used : 150

Alternative sjbOverhang cut-off used : 150
--genomeFastaFiles ${FASTA_FILE} \
--sjdbGTFfile ${GTF_FILE} \
--genomeDir ${GENOME_INDEX}
Alternative sjdbOverhang used : 150
This is also chosen due to the low-input RNA for sequencing.
##### Alternative sjdbOverhang used : 150 ##### This is also chosen due to the low-input RNA for sequencing.
# 2) Do the actual alignment.
#
# N.B.:
# - We are assuming paired-end, gzip compressed (--readFilesCommand zcat) FastQ
# files.
# THe compressed paired-end FastQ's that we are aligning.
R1="sample1_R1.fastq.gz"
R2="sample1_R2.fastq.gz"
STAR \
--runThreadN 8 \
--readFilesCommand zcat \
--readFilesIn "${R1}" "${R2}" \
--outSAMtype BAM SortedByCoordinate \
--genomeDir ${GENOME_INDEX} \
--outFileNamePrefix "${ALIGNMENT_OUTPUT}"