# RNAseq - Genome mapping 
***

RNAseq - Genome mapping


In [2]:
​x
 
# Create directory --> ALL FILES CAN BE FOUND IN THIS DIRECTORY CONCERNING THIS PART OF RNAsequencing
mkdir -p ~/data/RNAseq/GSE49797
cd ~/data/RNAseq/GSE49797
pwd
/home/luna.kuleuven.be/r0307220/data/RNAseq/GSE49797
In [ ]:
 
# Convert .sra files to .fastq (takes a long time)
fastq-dump --split-files SRR950430
fastq-dump --split-files SRR950431
fastq-dump --split-files SRR950432
fastq-dump --split-files SRR950433
fastq-dump --split-files SRR950435
#(6-10 = High Fed rats)
fastq-dump --split-files SRR950436
fastq-dump --split-files SRR950437
fastq-dump --split-files SRR950438
fastq-dump --split-files SRR950439
fastq-dump --split-files SRR950440
In [ ]:
 
# rename files (1-5 = control)
mv SRR950430_1.fastq S1.fastq
mv SRR950431_1.fastq S2.fastq
mv SRR950432_1.fastq S3.fastq
mv SRR950433_1.fastq S4.fastq
mv SRR950435_1.fastq S5.fastq
#(6-10 = High Fed rats)
mv SRR950436_1.fastq S6.fastq
mv SRR950437_1.fastq S7.fastq
mv SRR950438_1.fastq S8.fastq
mv SRR950439_1.fastq S9.fastq 
mv SRR950440_1.fastq S10.fastq
​
In [ ]:
 
# Quality control of the sequencing data waq performed using FastQ.
/usr/local/bin/FastQC/fastqc -o . *.fastq
 
## Mapping to the genome
To map our reads of the Rattus norvegicus sequences, we will use STAR. 

Mapping to the genome

To map our reads of the Rattus norvegicus sequences, we will use STAR.

In [ ]:
 
# Generate genome index 
# --> This was already performed and downloaded by Mark Fiers in /mnt/nfs/data/rattus/STAR
# STAR --runThreadN 2 \
#     --runMode genomeGenerate
#     --genomeDir /mnt/nfs/data/rattus/STAR \
#     --genomeFastaFiles /mnt/nfs/data/rattus/Rattus_norvegicus.Rnor_6.0.dna.toplevel.fa \
#     --sjdbGTFfile /mnt/nfs/data/rattus/Rattus_norvegicus.Rnor_6.0.86.gtf
#     --sjdbOverhang Readlength-1
     
In [ ]:
 
# Use STAR to map to the genome (takes a long time)
STAR --genomeDir /mnt/nfs/data/rattus/STAR \
     --genomeLoad NoSharedMemory \
     --runThreadN 2 \
     --readFilesIn /home/luna.kuleuven.be/r0307220/data/RNAseq/GSE49797/S1.fastq \
     --outFileNamePrefix SF1mapped.
​
     
# This is the same for every sequence, output : SF2mapped.*, SF3mapped.*, SF3mapped.*, SF4mapped.*, SF5mapped.*, 
# HF1mapped.*, HF2mapped.*, HF3mapped.*, HF4mapped.*, HF5mapped.*
In [ ]:
 
# A SAM file is generated, containing the alignment of all reads. Since a SAM file is unsorted and uncompressed, we will convert the SAM files to sorted and compresses BAM files.
samtools sort -o SF1mapped.bam SF1mapped.Aligned.out.sam
samtools sort -o SF2mapped.bam SF2mapped.Aligned.out.sam
samtools sort -o SF3mapped.bam SF3mapped.Aligned.out.sam
samtools sort -o SF4mapped.bam SF4mapped.Aligned.out.sam
samtools sort -o SF5mapped.bam SF5mapped.Aligned.out.sam
​
samtools sort -o HF1mapped.bam HF1mapped.Aligned.out.sam
samtools sort -o HF2mapped.bam HF2mapped.Aligned.out.sam
samtools sort -o HF3mapped.bam HF3mapped.Aligned.out.sam
samtools sort -o HF4mapped.bam HF4mapped.Aligned.out.sam
samtools sort -o HF5mapped.bam HF5mapped.Aligned.out.sam
 
### Inspect Bam files for the Pparg gene

Inspect Bam files for the Pparg gene

 
<img width="80%" src="/user/r0308348/files/IGV-BAM.png">

 
<img width="80%" src="/user/r0308348/files/IGV-BAM2.png">

In [ ]:
 
# For quick access, an index of the BAM file is generated.
samtools index SF1mapped.bam
samtools index SF2mapped.bam
samtools index SF3mapped.bam
samtools index SF4mapped.bam
samtools index SF5mapped.bam
​
samtools index HF1mapped.bam
samtools index HF2mapped.bam
samtools index HF3mapped.bam
samtools index HF4mapped.bam
samtools index HF5mapped.bam
In [ ]:
 
# inspect files
# head -40 S2mapped.Aligned.out.sam | grep '^@'
# ls -l *.ba[mi]
# samtools view S2mapped.bam | head -3
# samtools idxstats S1mapped.bam
 
## Gene counts

Gene counts

In [ ]:
 
# Reads to gene counts, create a symbolic link to the annotation
ln -sf /home/luna.kuleuven.be/r0307220/data/RNAseq/GSE49797/*.gtf /mnt/nfs/data/rattus/
ls -l *gtf
In [2]:
 
ls -l /mnt/nfs/data/rattus/STAR
total 26941972
-rw-r--r-- 1 u0089478 teacher        5221 nov 24 15:50 chrLength.txt
-rw-r--r-- 1 u0089478 teacher       16699 nov 24 15:50 chrNameLength.txt
-rw-r--r-- 1 u0089478 teacher       11478 nov 24 15:50 chrName.txt
-rw-r--r-- 1 u0089478 teacher       10499 nov 24 15:50 chrStart.txt
-rw-r--r-- 1 u0089478 teacher    10621557 nov 24 16:12 exonGeTrInfo.tab
-rw-r--r-- 1 u0089478 teacher     4578826 nov 24 16:12 exonInfo.tab
-rw-r--r-- 1 u0089478 teacher      622332 nov 24 16:12 geneInfo.tab
-rw-r--r-- 1 u0089478 teacher  3136088239 nov 24 16:14 Genome
-rw-r--r-- 1 u0089478 teacher         565 nov 24 15:49 genomeParameters.txt
-rw-r--r-- 1 u0089478 teacher 22853142109 nov 24 16:14 SA
-rw-r--r-- 1 u0089478 teacher  1565873619 nov 24 16:14 SAindex
-rw-r--r-- 1 u0089478 teacher     5857577 nov 24 16:12 sjdbInfo.txt
-rw-r--r-- 1 u0089478 teacher     4607449 nov 24 16:12 sjdbList.fromGTF.out.tab
-rw-r--r-- 1 u0089478 teacher     4606943 nov 24 16:12 sjdbList.out.tab
-rw-r--r-- 1 u0089478 teacher     2493199 nov 24 16:12 transcriptInfo.tab
In [ ]:
 
featureCounts \
    -Q 10 \
    -g gene_name \
    -a /mnt/nfs/data/rattus/Rattus_norvegicus.Rnor_6.0.86.gtf \
    -o mapped.counts \
    SF1mapped.bam SF2mapped.bam SF3mapped.bam SF4mapped.bam SF5mapped.bam HF1mapped.bam HF2mapped.bam HF3mapped.bam HF4mapped.bam HF5mapped.bam
In [ ]:
 
ls -l *.counts*
In [ ]:
 
head -20 mapped.counts.summary | column -t
In [ ]:
 
head mapped.counts
In [ ]:
 
cut -f-6 mapped.counts > all.genedata.tsv
In [ ]:
 
head all.genedata.tsv
In [ ]:
 
cut -f1,7- mapped2.counts | grep -v '^#' > gene.counts
In [ ]:
 
head gene.counts
Bewaren