{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Group assignment Bioinformatics\n",
    "### Group members: \n",
    "Alexandra Ristani r0603823\n",
    "\n",
    "Nikola Sklenovská r0474833\n",
    "\n",
    "Shana Verschuere r0307152"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Transcriptome Profiling of Activated T Cells\n",
    "\n",
    "<b>T cells</b> play a central role in the cell-mediated immune system and their <b>activation</b>, which is based on a strictly controlled <b>network of genes and proteins</b>, is an essential response of the immune response. The molecular and cellular events underlying this complex process are not fully understood though. \n",
    "\n",
    "In an attempt to determine the trascriptional profile of activated T-cells the differential expression of <i>in vitro</i> activated T cells by means of <b>RNA-sequencing</b> (RNAseq) was studied (for a detailed description, see <b>section 1</b>). In order to check if the <i>in vitro</i> transcriptional profile accurately represents what happens <i>in vivo</i>, a differential expression analysis in a <b>microarray</b> dataset of patients with an inflammatory disease, in this case asthma, was performed (for a detailed description, see <b>section 2</b>)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1 RNAseq\n",
    "\n",
    "## Transcriptome Profiling of <i>in vitro</i> Activated T Cells\n",
    "\n",
    "Referring to a study which can be found under PMCID: PMC3894192.\n",
    "\n",
    "RNAseq was used for the purpose of transcriptome profiling of RNA samples from a human T cell activation experiment. Here, CD4+ memory T cells were stimulated with both anti-CD3 and anti-CD28, after which RNA was isolated at a total of 6 time points, with two biological replicates per time point.The dataset can be found in te SRA database found on ncbi under the number <b>SRP026389</b>.\n",
    "\n",
    "Below, we described the first part of the RNAseq analysis, involving the processing of the RNAseq data (see <b>section 1</b>). The second part constituting <b>differential expression analysis</b> can be found in the <b>Addendum</b>.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.1 Processing RNAseq data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1.1 Retrieving SRA data "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "First we made a cache directory for the SRA toolkit."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "mkdir /home/luna.kuleuven.be/r0307152/assignment/~/data/ncbi2\n",
    "vdb-config -s /repository/user/main/public/root=~/data/ncbi2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, we ensured that we are in a work directory."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "mkdir /home/luna.kuleuven.be/r0307152/data/assignment && cd /home/luna.kuleuven.be/r0307152/data/assignment"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We downloaded the SRA data, which can be found on the SRA database found on ncbi under the number SRP026389. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 45645666 spots for SRR924538\r\n",
      "Written 45645666 spots for SRR924538\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924538"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 48629616 spots for SRR924537\r\n",
      "Written 48629616 spots for SRR924537\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924537"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 47388222 spots for SRR924536\r\n",
      "Written 47388222 spots for SRR924536\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924536"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 47397849 spots for SRR924535\r\n",
      "Written 47397849 spots for SRR924535\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924535"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 52336874 spots for SRR924534\r\n",
      "Written 52336874 spots for SRR924534\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924534"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 46253538 spots for SRR924533\r\n",
      "Written 46253538 spots for SRR924533\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924533"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 49222642 spots for SRR924532\r\n",
      "Written 49222642 spots for SRR924532\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924532"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 50046772 spots for SRR924531\r\n",
      "Written 50046772 spots for SRR924531\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924531"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 45812679 spots for SRR924530\r\n",
      "Written 45812679 spots for SRR924530\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924530"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 51972705 spots for SRR924529\r\n",
      "Written 51972705 spots for SRR924529\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924529"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 47255516 spots for SRR924528\r\n",
      "Written 47255516 spots for SRR924528\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924528"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Read 54255978 spots for SRR924146\r\n",
      "Written 54255978 spots for SRR924146\r\n"
     ]
    }
   ],
   "source": [
    "fastq-dump --split-files SRR924146"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "cd /home/luna.kuleuven.be/r0307152/data/assignment"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We symlinked the fastq files by creating a symbolic link."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total 347605080\r\n",
      "drwxr-xr-x 3 r0307152 domain users        4096 nov 23 22:04 ~\r\n",
      "lrwxrwxrwx 1 r0307152 domain users          36 nov 25 10:43 *.fastq -> /mnt/nfs/data/work/SRP026389/*.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 16474020950 nov 25 03:52 SRR924146_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 16474020950 nov 25 03:52 SRR924146_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14346141286 nov 25 02:08 SRR924528_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14346141286 nov 25 02:08 SRR924528_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 15780044866 nov 25 00:39 SRR924529_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 15780044866 nov 25 00:39 SRR924529_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 13907034480 nov 24 23:00 SRR924530_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 13907034480 nov 24 23:00 SRR924530_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 15194725688 nov 24 21:22 SRR924531_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 15194725688 nov 24 21:22 SRR924531_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14943138186 nov 24 19:45 SRR924532_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14943138186 nov 24 19:45 SRR924532_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14041392542 nov 24 18:09 SRR924533_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14041392542 nov 24 18:09 SRR924533_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 15893046732 nov 24 12:27 SRR924534_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 15893046732 nov 24 12:27 SRR924534_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14388382530 nov 24 10:44 SRR924535_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14388382530 nov 24 10:44 SRR924535_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14385931344 nov 24 09:15 SRR924536_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14385931344 nov 24 09:15 SRR924536_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14763432342 nov 24 01:02 SRR924537_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 14763432342 nov 24 01:02 SRR924537_2.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 13856431400 nov 23 23:28 SRR924538_1.fastq\r\n",
      "-rw-r--r-- 1 r0307152 domain users 13856431400 nov 23 23:28 SRR924538_2.fastq\r\n"
     ]
    }
   ],
   "source": [
    "ln -sf /mnt/nfs/data/work/SRP026389/*.fastq /home/luna.kuleuven.be/r0307152/data/assignment/\n",
    "ls -l"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1.2 Quality control using FASTQC"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We ran the FASTQC program on every .fastq file."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Started analysis of SRR924538_1.fastq\r\n",
      "Approx 5% complete for SRR924538_1.fastq\r\n",
      "Approx 10% complete for SRR924538_1.fastq\r\n",
      "Approx 15% complete for SRR924538_1.fastq\r\n",
      "Approx 20% complete for SRR924538_1.fastq\r\n",
      "Approx 25% complete for SRR924538_1.fastq\r\n",
      "Approx 30% complete for SRR924538_1.fastq\r\n",
      "Approx 35% complete for SRR924538_1.fastq\r\n",
      "Approx 40% complete for SRR924538_1.fastq\r\n",
      "Approx 45% complete for SRR924538_1.fastq\r\n",
      "Approx 50% complete for SRR924538_1.fastq\r\n",
      "Approx 55% complete for SRR924538_1.fastq\r\n",
      "Approx 60% complete for SRR924538_1.fastq\r\n",
      "Approx 65% complete for SRR924538_1.fastq\r\n",
      "Approx 70% complete for SRR924538_1.fastq\r\n",
      "Approx 75% complete for SRR924538_1.fastq\r\n",
      "Approx 80% complete for SRR924538_1.fastq\r\n",
      "Approx 85% complete for SRR924538_1.fastq\r\n",
      "Approx 90% complete for SRR924538_1.fastq\r\n",
      "Approx 95% complete for SRR924538_1.fastq\r\n",
      "Analysis complete for SRR924538_1.fastq\r\n",
      "Started analysis of SRR924538_2.fastq\r\n",
      "Approx 5% complete for SRR924538_2.fastq\r\n",
      "Approx 10% complete for SRR924538_2.fastq\r\n",
      "Approx 15% complete for SRR924538_2.fastq\r\n",
      "Approx 20% complete for SRR924538_2.fastq\r\n",
      "Approx 25% complete for SRR924538_2.fastq\r\n",
      "Approx 30% complete for SRR924538_2.fastq\r\n",
      "Approx 35% complete for SRR924538_2.fastq\r\n",
      "Approx 40% complete for SRR924538_2.fastq\r\n",
      "Approx 45% complete for SRR924538_2.fastq\r\n",
      "Approx 50% complete for SRR924538_2.fastq\r\n",
      "Approx 55% complete for SRR924538_2.fastq\r\n",
      "Approx 60% complete for SRR924538_2.fastq\r\n",
      "Approx 65% complete for SRR924538_2.fastq\r\n",
      "Approx 70% complete for SRR924538_2.fastq\r\n",
      "Approx 75% complete for SRR924538_2.fastq\r\n",
      "Approx 80% complete for SRR924538_2.fastq\r\n",
      "Approx 85% complete for SRR924538_2.fastq\r\n",
      "Approx 90% complete for SRR924538_2.fastq\r\n",
      "Approx 95% complete for SRR924538_2.fastq\r\n",
      "Analysis complete for SRR924538_2.fastq\r\n"
     ]
    }
   ],
   "source": [
    "/usr/local/bin/FastQC/fastqc -o . SRR924538_1.fastq SRR924538_2.fastq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Started analysis of SRR924537_1.fastq\r\n",
      "Approx 5% complete for SRR924537_1.fastq\r\n",
      "Approx 10% complete for SRR924537_1.fastq\r\n",
      "Approx 15% complete for SRR924537_1.fastq\r\n",
      "Approx 20% complete for SRR924537_1.fastq\r\n",
      "Approx 25% complete for SRR924537_1.fastq\r\n",
      "Approx 30% complete for SRR924537_1.fastq\r\n",
      "Approx 35% complete for SRR924537_1.fastq\r\n",
      "Approx 40% complete for SRR924537_1.fastq\r\n",
      "Approx 45% complete for SRR924537_1.fastq\r\n",
      "Approx 50% complete for SRR924537_1.fastq\r\n",
      "Approx 55% complete for SRR924537_1.fastq\r\n",
      "Approx 60% complete for SRR924537_1.fastq\r\n",
      "Approx 65% complete for SRR924537_1.fastq\r\n",
      "Approx 70% complete for SRR924537_1.fastq\r\n",
      "Approx 75% complete for SRR924537_1.fastq\r\n",
      "Approx 80% complete for SRR924537_1.fastq\r\n",
      "Approx 85% complete for SRR924537_1.fastq\r\n",
      "Approx 90% complete for SRR924537_1.fastq\r\n",
      "Approx 95% complete for SRR924537_1.fastq\r\n",
      "Analysis complete for SRR924537_1.fastq\r\n",
      "Started analysis of SRR924537_2.fastq\r\n",
      "Approx 5% complete for SRR924537_2.fastq\r\n",
      "Approx 10% complete for SRR924537_2.fastq\r\n",
      "Approx 15% complete for SRR924537_2.fastq\r\n",
      "Approx 20% complete for SRR924537_2.fastq\r\n",
      "Approx 25% complete for SRR924537_2.fastq\r\n",
      "Approx 30% complete for SRR924537_2.fastq\r\n",
      "Approx 35% complete for SRR924537_2.fastq\r\n",
      "Approx 40% complete for SRR924537_2.fastq\r\n",
      "Approx 45% complete for SRR924537_2.fastq\r\n",
      "Approx 50% complete for SRR924537_2.fastq\r\n",
      "Approx 55% complete for SRR924537_2.fastq\r\n",
      "Approx 60% complete for SRR924537_2.fastq\r\n",
      "Approx 65% complete for SRR924537_2.fastq\r\n",
      "Approx 70% complete for SRR924537_2.fastq\r\n",
      "Approx 75% complete for SRR924537_2.fastq\r\n",
      "Approx 80% complete for SRR924537_2.fastq\r\n",
      "Approx 85% complete for SRR924537_2.fastq\r\n",
      "Approx 90% complete for SRR924537_2.fastq\r\n",
      "Approx 95% complete for SRR924537_2.fastq\r\n",
      "Analysis complete for SRR924537_2.fastq\r\n",
      "Started analysis of SRR924536_1.fastq\r\n",
      "Approx 5% complete for SRR924536_1.fastq\r\n",
      "Approx 10% complete for SRR924536_1.fastq\r\n",
      "Approx 15% complete for SRR924536_1.fastq\r\n",
      "Approx 20% complete for SRR924536_1.fastq\r\n",
      "Approx 25% complete for SRR924536_1.fastq\r\n",
      "Approx 30% complete for SRR924536_1.fastq\r\n",
      "Approx 35% complete for SRR924536_1.fastq\r\n",
      "Approx 40% complete for SRR924536_1.fastq\r\n",
      "Approx 45% complete for SRR924536_1.fastq\r\n",
      "Approx 50% complete for SRR924536_1.fastq\r\n",
      "Approx 55% complete for SRR924536_1.fastq\r\n",
      "Approx 60% complete for SRR924536_1.fastq\r\n",
      "Approx 65% complete for SRR924536_1.fastq\r\n",
      "Approx 70% complete for SRR924536_1.fastq\r\n",
      "Approx 75% complete for SRR924536_1.fastq\r\n",
      "Approx 80% complete for SRR924536_1.fastq\r\n",
      "Approx 85% complete for SRR924536_1.fastq\r\n",
      "Approx 90% complete for SRR924536_1.fastq\r\n",
      "Approx 95% complete for SRR924536_1.fastq\r\n",
      "Analysis complete for SRR924536_1.fastq\r\n",
      "Started analysis of SRR924536_2.fastq\r\n",
      "Approx 5% complete for SRR924536_2.fastq\r\n",
      "Approx 10% complete for SRR924536_2.fastq\r\n",
      "Approx 15% complete for SRR924536_2.fastq\r\n",
      "Approx 20% complete for SRR924536_2.fastq\r\n",
      "Approx 25% complete for SRR924536_2.fastq\r\n",
      "Approx 30% complete for SRR924536_2.fastq\r\n",
      "Approx 35% complete for SRR924536_2.fastq\r\n",
      "Approx 40% complete for SRR924536_2.fastq\r\n",
      "Approx 45% complete for SRR924536_2.fastq\r\n",
      "Approx 50% complete for SRR924536_2.fastq\r\n",
      "Approx 55% complete for SRR924536_2.fastq\r\n",
      "Approx 60% complete for SRR924536_2.fastq\r\n",
      "Approx 65% complete for SRR924536_2.fastq\r\n",
      "Approx 70% complete for SRR924536_2.fastq\r\n",
      "Approx 75% complete for SRR924536_2.fastq\r\n",
      "Approx 80% complete for SRR924536_2.fastq\r\n",
      "Approx 85% complete for SRR924536_2.fastq\r\n",
      "Approx 90% complete for SRR924536_2.fastq\r\n",
      "Approx 95% complete for SRR924536_2.fastq\r\n",
      "Analysis complete for SRR924536_2.fastq\r\n",
      "Started analysis of SRR924535_1.fastq\r\n",
      "Approx 5% complete for SRR924535_1.fastq\r\n",
      "Approx 10% complete for SRR924535_1.fastq\r\n",
      "Approx 15% complete for SRR924535_1.fastq\r\n",
      "Approx 20% complete for SRR924535_1.fastq\r\n",
      "Approx 25% complete for SRR924535_1.fastq\r\n",
      "Approx 30% complete for SRR924535_1.fastq\r\n",
      "Approx 35% complete for SRR924535_1.fastq\r\n",
      "Approx 40% complete for SRR924535_1.fastq\r\n",
      "Approx 45% complete for SRR924535_1.fastq\r\n",
      "Approx 50% complete for SRR924535_1.fastq\r\n",
      "Approx 55% complete for SRR924535_1.fastq\r\n",
      "Approx 60% complete for SRR924535_1.fastq\r\n",
      "Approx 65% complete for SRR924535_1.fastq\r\n",
      "Approx 70% complete for SRR924535_1.fastq\r\n",
      "Approx 75% complete for SRR924535_1.fastq\r\n",
      "Approx 80% complete for SRR924535_1.fastq\r\n",
      "Approx 85% complete for SRR924535_1.fastq\r\n",
      "Approx 90% complete for SRR924535_1.fastq\r\n",
      "Approx 95% complete for SRR924535_1.fastq\r\n",
      "Analysis complete for SRR924535_1.fastq\r\n",
      "Started analysis of SRR924535_2.fastq\r\n",
      "Approx 5% complete for SRR924535_2.fastq\r\n",
      "Approx 10% complete for SRR924535_2.fastq\r\n",
      "Approx 15% complete for SRR924535_2.fastq\r\n",
      "Approx 20% complete for SRR924535_2.fastq\r\n",
      "Approx 25% complete for SRR924535_2.fastq\r\n",
      "Approx 30% complete for SRR924535_2.fastq\r\n",
      "Approx 35% complete for SRR924535_2.fastq\r\n",
      "Approx 40% complete for SRR924535_2.fastq\r\n",
      "Approx 45% complete for SRR924535_2.fastq\r\n",
      "Approx 50% complete for SRR924535_2.fastq\r\n",
      "Approx 55% complete for SRR924535_2.fastq\r\n",
      "Approx 60% complete for SRR924535_2.fastq\r\n",
      "Approx 65% complete for SRR924535_2.fastq\r\n",
      "Approx 70% complete for SRR924535_2.fastq\r\n",
      "Approx 75% complete for SRR924535_2.fastq\r\n",
      "Approx 80% complete for SRR924535_2.fastq\r\n",
      "Approx 85% complete for SRR924535_2.fastq\r\n",
      "Approx 90% complete for SRR924535_2.fastq\r\n",
      "Approx 95% complete for SRR924535_2.fastq\r\n",
      "Analysis complete for SRR924535_2.fastq\r\n",
      "Started analysis of SRR924534_1.fastq\r\n",
      "Approx 5% complete for SRR924534_1.fastq\r\n",
      "Approx 10% complete for SRR924534_1.fastq\r\n",
      "Approx 15% complete for SRR924534_1.fastq\r\n",
      "Approx 20% complete for SRR924534_1.fastq\r\n",
      "Approx 25% complete for SRR924534_1.fastq\r\n",
      "Approx 30% complete for SRR924534_1.fastq\r\n",
      "Approx 35% complete for SRR924534_1.fastq\r\n",
      "Approx 40% complete for SRR924534_1.fastq\r\n",
      "Approx 45% complete for SRR924534_1.fastq\r\n",
      "Approx 50% complete for SRR924534_1.fastq\r\n",
      "Approx 55% complete for SRR924534_1.fastq\r\n",
      "Approx 60% complete for SRR924534_1.fastq\r\n",
      "Approx 65% complete for SRR924534_1.fastq\r\n",
      "Approx 70% complete for SRR924534_1.fastq\r\n",
      "Approx 75% complete for SRR924534_1.fastq\r\n",
      "Approx 80% complete for SRR924534_1.fastq\r\n",
      "Approx 85% complete for SRR924534_1.fastq\r\n",
      "Approx 90% complete for SRR924534_1.fastq\r\n",
      "Approx 95% complete for SRR924534_1.fastq\r\n",
      "Analysis complete for SRR924534_1.fastq\r\n",
      "Started analysis of SRR924534_2.fastq\r\n",
      "Approx 5% complete for SRR924534_2.fastq\r\n",
      "Approx 10% complete for SRR924534_2.fastq\r\n",
      "Approx 15% complete for SRR924534_2.fastq\r\n",
      "Approx 20% complete for SRR924534_2.fastq\r\n",
      "Approx 25% complete for SRR924534_2.fastq\r\n",
      "Approx 30% complete for SRR924534_2.fastq\r\n",
      "Approx 35% complete for SRR924534_2.fastq\r\n",
      "Approx 40% complete for SRR924534_2.fastq\r\n",
      "Approx 45% complete for SRR924534_2.fastq\r\n",
      "Approx 50% complete for SRR924534_2.fastq\r\n",
      "Approx 55% complete for SRR924534_2.fastq\r\n",
      "Approx 60% complete for SRR924534_2.fastq\r\n",
      "Approx 65% complete for SRR924534_2.fastq\r\n",
      "Approx 70% complete for SRR924534_2.fastq\r\n",
      "Approx 75% complete for SRR924534_2.fastq\r\n",
      "Approx 80% complete for SRR924534_2.fastq\r\n",
      "Approx 85% complete for SRR924534_2.fastq\r\n",
      "Approx 90% complete for SRR924534_2.fastq\r\n",
      "Approx 95% complete for SRR924534_2.fastq\r\n",
      "Analysis complete for SRR924534_2.fastq\r\n",
      "Started analysis of SRR924533_1.fastq\r\n",
      "Approx 5% complete for SRR924533_1.fastq\r\n",
      "Approx 10% complete for SRR924533_1.fastq\r\n",
      "Approx 15% complete for SRR924533_1.fastq\r\n",
      "Approx 20% complete for SRR924533_1.fastq\r\n",
      "Approx 25% complete for SRR924533_1.fastq\r\n",
      "Approx 30% complete for SRR924533_1.fastq\r\n",
      "Approx 35% complete for SRR924533_1.fastq\r\n",
      "Approx 40% complete for SRR924533_1.fastq\r\n",
      "Approx 45% complete for SRR924533_1.fastq\r\n",
      "Approx 50% complete for SRR924533_1.fastq\r\n",
      "Approx 55% complete for SRR924533_1.fastq\r\n",
      "Approx 60% complete for SRR924533_1.fastq\r\n",
      "Approx 65% complete for SRR924533_1.fastq\r\n",
      "Approx 70% complete for SRR924533_1.fastq\r\n",
      "Approx 75% complete for SRR924533_1.fastq\r\n",
      "Approx 80% complete for SRR924533_1.fastq\r\n",
      "Approx 85% complete for SRR924533_1.fastq\r\n",
      "Approx 90% complete for SRR924533_1.fastq\r\n",
      "Approx 95% complete for SRR924533_1.fastq\r\n",
      "Analysis complete for SRR924533_1.fastq\r\n",
      "Started analysis of SRR924533_2.fastq\r\n",
      "Approx 5% complete for SRR924533_2.fastq\r\n",
      "Approx 10% complete for SRR924533_2.fastq\r\n",
      "Approx 15% complete for SRR924533_2.fastq\r\n",
      "Approx 20% complete for SRR924533_2.fastq\r\n",
      "Approx 25% complete for SRR924533_2.fastq\r\n",
      "Approx 30% complete for SRR924533_2.fastq\r\n",
      "Approx 35% complete for SRR924533_2.fastq\r\n",
      "Approx 40% complete for SRR924533_2.fastq\r\n",
      "Approx 45% complete for SRR924533_2.fastq\r\n",
      "Approx 50% complete for SRR924533_2.fastq\r\n",
      "Approx 55% complete for SRR924533_2.fastq\r\n",
      "Approx 60% complete for SRR924533_2.fastq\r\n",
      "Approx 65% complete for SRR924533_2.fastq\r\n",
      "Approx 70% complete for SRR924533_2.fastq\r\n",
      "Approx 75% complete for SRR924533_2.fastq\r\n",
      "Approx 80% complete for SRR924533_2.fastq\r\n",
      "Approx 85% complete for SRR924533_2.fastq\r\n",
      "Approx 90% complete for SRR924533_2.fastq\r\n",
      "Approx 95% complete for SRR924533_2.fastq\r\n",
      "Analysis complete for SRR924533_2.fastq\r\n",
      "Started analysis of SRR924532_1.fastq\r\n",
      "Approx 5% complete for SRR924532_1.fastq\r\n",
      "Approx 10% complete for SRR924532_1.fastq\r\n",
      "Approx 15% complete for SRR924532_1.fastq\r\n",
      "Approx 20% complete for SRR924532_1.fastq\r\n",
      "Approx 25% complete for SRR924532_1.fastq\r\n",
      "Approx 30% complete for SRR924532_1.fastq\r\n",
      "Approx 35% complete for SRR924532_1.fastq\r\n",
      "Approx 40% complete for SRR924532_1.fastq\r\n",
      "Approx 45% complete for SRR924532_1.fastq\r\n",
      "Approx 50% complete for SRR924532_1.fastq\r\n",
      "Approx 55% complete for SRR924532_1.fastq\r\n",
      "Approx 60% complete for SRR924532_1.fastq\r\n",
      "Approx 65% complete for SRR924532_1.fastq\r\n",
      "Approx 70% complete for SRR924532_1.fastq\r\n",
      "Approx 75% complete for SRR924532_1.fastq\r\n",
      "Approx 80% complete for SRR924532_1.fastq\r\n",
      "Approx 85% complete for SRR924532_1.fastq\r\n",
      "Approx 90% complete for SRR924532_1.fastq\r\n",
      "Approx 95% complete for SRR924532_1.fastq\r\n",
      "Analysis complete for SRR924532_1.fastq\r\n",
      "Started analysis of SRR924532_2.fastq\r\n",
      "Approx 5% complete for SRR924532_2.fastq\r\n",
      "Approx 10% complete for SRR924532_2.fastq\r\n",
      "Approx 15% complete for SRR924532_2.fastq\r\n",
      "Approx 20% complete for SRR924532_2.fastq\r\n",
      "Approx 25% complete for SRR924532_2.fastq\r\n",
      "Approx 30% complete for SRR924532_2.fastq\r\n",
      "Approx 35% complete for SRR924532_2.fastq\r\n",
      "Approx 40% complete for SRR924532_2.fastq\r\n",
      "Approx 45% complete for SRR924532_2.fastq\r\n",
      "Approx 50% complete for SRR924532_2.fastq\r\n",
      "Approx 55% complete for SRR924532_2.fastq\r\n",
      "Approx 60% complete for SRR924532_2.fastq\r\n",
      "Approx 65% complete for SRR924532_2.fastq\r\n",
      "Approx 70% complete for SRR924532_2.fastq\r\n",
      "Approx 75% complete for SRR924532_2.fastq\r\n",
      "Approx 80% complete for SRR924532_2.fastq\r\n",
      "Approx 85% complete for SRR924532_2.fastq\r\n",
      "Approx 90% complete for SRR924532_2.fastq\r\n",
      "Approx 95% complete for SRR924532_2.fastq\r\n",
      "Analysis complete for SRR924532_2.fastq\r\n",
      "Started analysis of SRR924531_1.fastq\r\n",
      "Approx 5% complete for SRR924531_1.fastq\r\n",
      "Approx 10% complete for SRR924531_1.fastq\r\n",
      "Approx 15% complete for SRR924531_1.fastq\r\n",
      "Approx 20% complete for SRR924531_1.fastq\r\n",
      "Approx 25% complete for SRR924531_1.fastq\r\n",
      "Approx 30% complete for SRR924531_1.fastq\r\n",
      "Approx 35% complete for SRR924531_1.fastq\r\n",
      "Approx 40% complete for SRR924531_1.fastq\r\n",
      "Approx 45% complete for SRR924531_1.fastq\r\n",
      "Approx 50% complete for SRR924531_1.fastq\r\n",
      "Approx 55% complete for SRR924531_1.fastq\r\n",
      "Approx 60% complete for SRR924531_1.fastq\r\n",
      "Approx 65% complete for SRR924531_1.fastq\r\n",
      "Approx 70% complete for SRR924531_1.fastq\r\n",
      "Approx 75% complete for SRR924531_1.fastq\r\n",
      "Approx 80% complete for SRR924531_1.fastq\r\n",
      "Approx 85% complete for SRR924531_1.fastq\r\n",
      "Approx 90% complete for SRR924531_1.fastq\r\n",
      "Approx 95% complete for SRR924531_1.fastq\r\n",
      "Analysis complete for SRR924531_1.fastq\r\n",
      "Started analysis of SRR924531_2.fastq\r\n",
      "Approx 5% complete for SRR924531_2.fastq\r\n",
      "Approx 10% complete for SRR924531_2.fastq\r\n",
      "Approx 15% complete for SRR924531_2.fastq\r\n",
      "Approx 20% complete for SRR924531_2.fastq\r\n",
      "Approx 25% complete for SRR924531_2.fastq\r\n",
      "Approx 30% complete for SRR924531_2.fastq\r\n",
      "Approx 35% complete for SRR924531_2.fastq\r\n",
      "Approx 40% complete for SRR924531_2.fastq\r\n",
      "Approx 45% complete for SRR924531_2.fastq\r\n",
      "Approx 50% complete for SRR924531_2.fastq\r\n",
      "Approx 55% complete for SRR924531_2.fastq\r\n",
      "Approx 60% complete for SRR924531_2.fastq\r\n",
      "Approx 65% complete for SRR924531_2.fastq\r\n",
      "Approx 70% complete for SRR924531_2.fastq\r\n",
      "Approx 75% complete for SRR924531_2.fastq\r\n",
      "Approx 80% complete for SRR924531_2.fastq\r\n",
      "Approx 85% complete for SRR924531_2.fastq\r\n",
      "Approx 90% complete for SRR924531_2.fastq\r\n",
      "Approx 95% complete for SRR924531_2.fastq\r\n",
      "Analysis complete for SRR924531_2.fastq\r\n",
      "Started analysis of SRR924530_1.fastq\r\n",
      "Approx 5% complete for SRR924530_1.fastq\r\n",
      "Approx 10% complete for SRR924530_1.fastq\r\n",
      "Approx 15% complete for SRR924530_1.fastq\r\n",
      "Approx 20% complete for SRR924530_1.fastq\r\n",
      "Approx 25% complete for SRR924530_1.fastq\r\n",
      "Approx 30% complete for SRR924530_1.fastq\r\n",
      "Approx 35% complete for SRR924530_1.fastq\r\n",
      "Approx 40% complete for SRR924530_1.fastq\r\n",
      "Approx 45% complete for SRR924530_1.fastq\r\n",
      "Approx 50% complete for SRR924530_1.fastq\r\n",
      "Approx 55% complete for SRR924530_1.fastq\r\n",
      "Approx 60% complete for SRR924530_1.fastq\r\n",
      "Approx 65% complete for SRR924530_1.fastq\r\n",
      "Approx 70% complete for SRR924530_1.fastq\r\n",
      "Approx 75% complete for SRR924530_1.fastq\r\n",
      "Approx 80% complete for SRR924530_1.fastq\r\n",
      "Approx 85% complete for SRR924530_1.fastq\r\n",
      "Approx 90% complete for SRR924530_1.fastq\r\n",
      "Approx 95% complete for SRR924530_1.fastq\r\n",
      "Analysis complete for SRR924530_1.fastq\r\n",
      "Started analysis of SRR924530_2.fastq\r\n",
      "Approx 5% complete for SRR924530_2.fastq\r\n",
      "Approx 10% complete for SRR924530_2.fastq\r\n",
      "Approx 15% complete for SRR924530_2.fastq\r\n",
      "Approx 20% complete for SRR924530_2.fastq\r\n",
      "Approx 25% complete for SRR924530_2.fastq\r\n",
      "Approx 30% complete for SRR924530_2.fastq\r\n",
      "Approx 35% complete for SRR924530_2.fastq\r\n",
      "Approx 40% complete for SRR924530_2.fastq\r\n",
      "Approx 45% complete for SRR924530_2.fastq\r\n",
      "Approx 50% complete for SRR924530_2.fastq\r\n",
      "Approx 55% complete for SRR924530_2.fastq\r\n",
      "Approx 60% complete for SRR924530_2.fastq\r\n",
      "Approx 65% complete for SRR924530_2.fastq\r\n",
      "Approx 70% complete for SRR924530_2.fastq\r\n",
      "Approx 75% complete for SRR924530_2.fastq\r\n",
      "Approx 80% complete for SRR924530_2.fastq\r\n",
      "Approx 85% complete for SRR924530_2.fastq\r\n",
      "Approx 90% complete for SRR924530_2.fastq\r\n",
      "Approx 95% complete for SRR924530_2.fastq\r\n",
      "Analysis complete for SRR924530_2.fastq\r\n",
      "Started analysis of SRR924529_1.fastq\r\n",
      "Approx 5% complete for SRR924529_1.fastq\r\n",
      "Approx 10% complete for SRR924529_1.fastq\r\n",
      "Approx 15% complete for SRR924529_1.fastq\r\n",
      "Approx 20% complete for SRR924529_1.fastq\r\n",
      "Approx 25% complete for SRR924529_1.fastq\r\n",
      "Approx 30% complete for SRR924529_1.fastq\r\n",
      "Approx 35% complete for SRR924529_1.fastq\r\n",
      "Approx 40% complete for SRR924529_1.fastq\r\n",
      "Approx 45% complete for SRR924529_1.fastq\r\n",
      "Approx 50% complete for SRR924529_1.fastq\r\n",
      "Approx 55% complete for SRR924529_1.fastq\r\n",
      "Approx 60% complete for SRR924529_1.fastq\r\n",
      "Approx 65% complete for SRR924529_1.fastq\r\n",
      "Approx 70% complete for SRR924529_1.fastq\r\n",
      "Approx 75% complete for SRR924529_1.fastq\r\n",
      "Approx 80% complete for SRR924529_1.fastq\r\n",
      "Approx 85% complete for SRR924529_1.fastq\r\n",
      "Approx 90% complete for SRR924529_1.fastq\r\n",
      "Approx 95% complete for SRR924529_1.fastq\r\n",
      "Analysis complete for SRR924529_1.fastq\r\n",
      "Started analysis of SRR924529_2.fastq\r\n",
      "Approx 5% complete for SRR924529_2.fastq\r\n",
      "Approx 10% complete for SRR924529_2.fastq\r\n",
      "Approx 15% complete for SRR924529_2.fastq\r\n",
      "Approx 20% complete for SRR924529_2.fastq\r\n",
      "Approx 25% complete for SRR924529_2.fastq\r\n",
      "Approx 30% complete for SRR924529_2.fastq\r\n",
      "Approx 35% complete for SRR924529_2.fastq\r\n",
      "Approx 40% complete for SRR924529_2.fastq\r\n",
      "Approx 45% complete for SRR924529_2.fastq\r\n",
      "Approx 50% complete for SRR924529_2.fastq\r\n",
      "Approx 55% complete for SRR924529_2.fastq\r\n",
      "Approx 60% complete for SRR924529_2.fastq\r\n",
      "Approx 65% complete for SRR924529_2.fastq\r\n",
      "Approx 70% complete for SRR924529_2.fastq\r\n",
      "Approx 75% complete for SRR924529_2.fastq\r\n",
      "Approx 80% complete for SRR924529_2.fastq\r\n",
      "Approx 85% complete for SRR924529_2.fastq\r\n",
      "Approx 90% complete for SRR924529_2.fastq\r\n",
      "Approx 95% complete for SRR924529_2.fastq\r\n",
      "Analysis complete for SRR924529_2.fastq\r\n",
      "Started analysis of SRR924528_1.fastq\r\n",
      "Approx 5% complete for SRR924528_1.fastq\r\n",
      "Approx 10% complete for SRR924528_1.fastq\r\n",
      "Approx 15% complete for SRR924528_1.fastq\r\n",
      "Approx 20% complete for SRR924528_1.fastq\r\n",
      "Approx 25% complete for SRR924528_1.fastq\r\n",
      "Approx 30% complete for SRR924528_1.fastq\r\n",
      "Approx 35% complete for SRR924528_1.fastq\r\n",
      "Approx 40% complete for SRR924528_1.fastq\r\n",
      "Approx 45% complete for SRR924528_1.fastq\r\n",
      "Approx 50% complete for SRR924528_1.fastq\r\n",
      "Approx 55% complete for SRR924528_1.fastq\r\n",
      "Approx 60% complete for SRR924528_1.fastq\r\n",
      "Approx 65% complete for SRR924528_1.fastq\r\n",
      "Approx 70% complete for SRR924528_1.fastq\r\n",
      "Approx 75% complete for SRR924528_1.fastq\r\n",
      "Approx 80% complete for SRR924528_1.fastq\r\n",
      "Approx 85% complete for SRR924528_1.fastq\r\n",
      "Approx 90% complete for SRR924528_1.fastq\r\n",
      "Approx 95% complete for SRR924528_1.fastq\r\n",
      "Analysis complete for SRR924528_1.fastq\r\n",
      "Started analysis of SRR924528_2.fastq\r\n",
      "Approx 5% complete for SRR924528_2.fastq\r\n",
      "Approx 10% complete for SRR924528_2.fastq\r\n",
      "Approx 15% complete for SRR924528_2.fastq\r\n",
      "Approx 20% complete for SRR924528_2.fastq\r\n",
      "Approx 25% complete for SRR924528_2.fastq\r\n",
      "Approx 30% complete for SRR924528_2.fastq\r\n",
      "Approx 35% complete for SRR924528_2.fastq\r\n",
      "Approx 40% complete for SRR924528_2.fastq\r\n",
      "Approx 45% complete for SRR924528_2.fastq\r\n",
      "Approx 50% complete for SRR924528_2.fastq\r\n",
      "Approx 55% complete for SRR924528_2.fastq\r\n",
      "Approx 60% complete for SRR924528_2.fastq\r\n",
      "Approx 65% complete for SRR924528_2.fastq\r\n",
      "Approx 70% complete for SRR924528_2.fastq\r\n",
      "Approx 75% complete for SRR924528_2.fastq\r\n",
      "Approx 80% complete for SRR924528_2.fastq\r\n",
      "Approx 85% complete for SRR924528_2.fastq\r\n",
      "Approx 90% complete for SRR924528_2.fastq\r\n",
      "Approx 95% complete for SRR924528_2.fastq\r\n",
      "Analysis complete for SRR924528_2.fastq\r\n",
      "Started analysis of SRR924146_1.fastq\r\n",
      "Approx 5% complete for SRR924146_1.fastq\r\n",
      "Approx 10% complete for SRR924146_1.fastq\r\n",
      "Approx 15% complete for SRR924146_1.fastq\r\n",
      "Approx 20% complete for SRR924146_1.fastq\r\n",
      "Approx 25% complete for SRR924146_1.fastq\r\n",
      "Approx 30% complete for SRR924146_1.fastq\r\n",
      "Approx 35% complete for SRR924146_1.fastq\r\n",
      "Approx 40% complete for SRR924146_1.fastq\r\n",
      "Approx 45% complete for SRR924146_1.fastq\r\n",
      "Approx 50% complete for SRR924146_1.fastq\r\n",
      "Approx 55% complete for SRR924146_1.fastq\r\n",
      "Approx 60% complete for SRR924146_1.fastq\r\n",
      "Approx 65% complete for SRR924146_1.fastq\r\n",
      "Approx 70% complete for SRR924146_1.fastq\r\n",
      "Approx 75% complete for SRR924146_1.fastq\r\n",
      "Approx 80% complete for SRR924146_1.fastq\r\n",
      "Approx 85% complete for SRR924146_1.fastq\r\n",
      "Approx 90% complete for SRR924146_1.fastq\r\n",
      "Approx 95% complete for SRR924146_1.fastq\r\n",
      "Analysis complete for SRR924146_1.fastq\r\n",
      "Started analysis of SRR924146_2.fastq\r\n",
      "Approx 5% complete for SRR924146_2.fastq\r\n",
      "Approx 10% complete for SRR924146_2.fastq\r\n",
      "Approx 15% complete for SRR924146_2.fastq\r\n",
      "Approx 20% complete for SRR924146_2.fastq\r\n",
      "Approx 25% complete for SRR924146_2.fastq\r\n",
      "Approx 30% complete for SRR924146_2.fastq\r\n",
      "Approx 35% complete for SRR924146_2.fastq\r\n",
      "Approx 40% complete for SRR924146_2.fastq\r\n",
      "Approx 45% complete for SRR924146_2.fastq\r\n",
      "Approx 50% complete for SRR924146_2.fastq\r\n",
      "Approx 55% complete for SRR924146_2.fastq\r\n",
      "Approx 60% complete for SRR924146_2.fastq\r\n",
      "Approx 65% complete for SRR924146_2.fastq\r\n",
      "Approx 70% complete for SRR924146_2.fastq\r\n",
      "Approx 75% complete for SRR924146_2.fastq\r\n",
      "Approx 80% complete for SRR924146_2.fastq\r\n",
      "Approx 85% complete for SRR924146_2.fastq\r\n",
      "Approx 90% complete for SRR924146_2.fastq\r\n",
      "Approx 95% complete for SRR924146_2.fastq\r\n",
      "Analysis complete for SRR924146_2.fastq\r\n"
     ]
    }
   ],
   "source": [
    "/usr/local/bin/FastQC/fastqc -o . SRR924537_1.fastq SRR924537_2.fastq SRR924536_1.fastq SRR924536_2.fastq SRR924535_1.fastq SRR924535_2.fastq SRR924534_1.fastq SRR924534_2.fastq SRR924533_1.fastq SRR924533_2.fastq SRR924532_1.fastq SRR924532_2.fastq SRR924531_1.fastq SRR924531_2.fastq SRR924530_1.fastq SRR924530_2.fastq SRR924529_1.fastq SRR924529_2.fastq SRR924528_1.fastq SRR924528_2.fastq SRR924146_1.fastq SRR924146_2.fastq"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "The FastQC reports showed that most samples have a problem with:\n",
    "(1) <b> Per base sequence content </b>: there is a bias at the beginning of the reads, which is common for RNA-Seq data. This occurs during RNA-seq library preparation, when “random” primers are annealed to the start of sequences.\n",
    "(2) <b> Sequence duplication level </b>: while analysing transcriptome sequencing data, we should not remove these duplicates because we don’t know whether they represent PCR duplicates or high gene expression of our samples.\n",
    "\n",
    "All samples have good <b> Per base sequence quality scores </b> and <b> Per sequence quality scores </b>.\n",
    "All samples have good <b> Per sequence GC content distribution </b>."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Below there is an example of what the FastQC report partly looks like for sample SRR924146_1."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img width=\"70%\" src=\"/user/r0307152/files/FastQC_Report_SRR924146_1_PerBaseSequenceContent.jpg\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img width=\"70%\" src=\"/user/r0307152/files/FastQC_Report_SRR924146_1_PerSequenceGCcontent.jpg\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### 1.1.3 Mapping to genome"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We loaded the genome into the memory."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 25 14:08:07 ..... started STAR run\r\n",
      "Nov 25 14:08:07 ..... loading genome\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeLoad LoadAndExit --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Mapping the reads from all the samples against the reference genome at the same time didn't work."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Segmentation fault (core dumped)\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924538_1.fastq SRR924538_2.fastq SRR924537_1.fastq SRR924537_2.fastq SRR924536_1.fastq SRR924536_2.fastq SRR924535_1.fastq SRR924535_2.fastq SRR924534_1.fastq SRR924534_2.fastq SRR924533_1.fastq SRR924533_2.fastq SRR924532_1.fastq SRR924532_2.fastq SRR924531_1.fastq SRR924531_2.fastq SRR924530_1.fastq SRR924530_2.fastq SRR924529_1.fastq SRR924529_2.fastq SRR924528_1.fastq SRR924528_2.fastq SRR924146_1.fastq SRR924146_2.fastq \\\n",
    "     --outFileNamePrefix allsamples2."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So instead, we mapped the reads from one sample at a time against the reference genome."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 25 14:24:10 ..... started STAR run\r\n",
      "Nov 25 14:24:10 ..... loading genome\r\n",
      "Nov 25 14:24:10 ..... started mapping\r\n",
      "Nov 25 14:58:44 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924538_1.fastq SRR924538_2.fastq \\\n",
    "     --outFileNamePrefix SRR924538."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 25 14:58:46 ..... started STAR run\r\n",
      "Nov 25 14:58:46 ..... loading genome\r\n",
      "Nov 25 14:58:46 ..... started mapping\r\n",
      "Nov 25 15:31:52 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924537_1.fastq SRR924537_2.fastq \\\n",
    "     --outFileNamePrefix SRR924537."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 25 21:43:29 ..... started STAR run\r\n",
      "Nov 25 21:43:29 ..... loading genome\r\n",
      "Nov 25 21:43:29 ..... started mapping\r\n",
      "Nov 25 22:15:53 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924536_1.fastq SRR924536_2.fastq \\\n",
    "     --outFileNamePrefix SRR924536."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 25 22:15:55 ..... started STAR run\r\n",
      "Nov 25 22:15:55 ..... loading genome\r\n",
      "Nov 25 22:15:55 ..... started mapping\r\n",
      "Nov 25 22:49:56 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924535_1.fastq SRR924535_2.fastq \\\n",
    "     --outFileNamePrefix SRR924535."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 25 22:49:57 ..... started STAR run\r\n",
      "Nov 25 22:49:57 ..... loading genome\r\n",
      "Nov 25 22:49:58 ..... started mapping\r\n",
      "Nov 25 23:24:27 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924534_1.fastq SRR924534_2.fastq \\\n",
    "     --outFileNamePrefix SRR924534."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 00:26:12 ..... started STAR run\r\n",
      "Nov 26 00:26:12 ..... loading genome\r\n",
      "Nov 26 00:26:12 ..... started mapping\r\n",
      "Nov 26 00:58:22 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924533_1.fastq SRR924533_2.fastq \\\n",
    "     --outFileNamePrefix SRR924533."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 00:58:23 ..... started STAR run\r\n",
      "Nov 26 00:58:23 ..... loading genome\r\n",
      "Nov 26 00:58:23 ..... started mapping\r\n",
      "Nov 26 01:34:23 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn SRR924532_1.fastq SRR924532_2.fastq \\\n",
    "     --outFileNamePrefix SRR924532."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 01:34:25 ..... started STAR run\r\n",
      "Nov 26 01:34:25 ..... loading genome\r\n",
      "Nov 26 01:34:25 ..... started mapping\r\n",
      "Nov 26 02:10:08 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn  SRR924531_1.fastq SRR924531_2.fastq \\\n",
    "     --outFileNamePrefix SRR924531."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 02:10:10 ..... started STAR run\r\n",
      "Nov 26 02:10:10 ..... loading genome\r\n",
      "Nov 26 02:10:10 ..... started mapping\r\n",
      "Nov 26 02:45:13 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn  SRR924530_1.fastq SRR924530_2.fastq \\\n",
    "     --outFileNamePrefix SRR924530."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 02:45:15 ..... started STAR run\r\n",
      "Nov 26 02:45:15 ..... loading genome\r\n",
      "Nov 26 02:45:15 ..... started mapping\r\n",
      "Nov 26 03:21:41 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn  SRR924529_1.fastq SRR924529_2.fastq \\\n",
    "     --outFileNamePrefix SRR924529."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 08:15:36 ..... started STAR run\r\n",
      "Nov 26 08:15:36 ..... loading genome\r\n",
      "Nov 26 08:15:36 ..... started mapping\r\n",
      "Nov 26 08:49:58 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn  SRR924528_1.fastq SRR924528_2.fastq \\\n",
    "     --outFileNamePrefix SRR924528."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nov 26 08:50:00 ..... started STAR run\r\n",
      "Nov 26 08:50:00 ..... loading genome\r\n",
      "Nov 26 08:50:00 ..... started mapping\r\n",
      "Nov 26 09:28:11 ..... finished successfully\r\n"
     ]
    }
   ],
   "source": [
    "STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db \\\n",
    "     --genomeLoad LoadAndKeep \\\n",
    "     --runThreadN 2 \\\n",
    "     --readFilesIn  SRR924146_1.fastq SRR924146_2.fastq \\\n",
    "     --outFileNamePrefix SRR924146."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1.4 SAM file structure"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We wanted to see what one of these files looks like."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "@HD\tVN:1.4\r\n",
      "@SQ\tSN:chrM\tLN:16571\r\n",
      "@SQ\tSN:chr1\tLN:249250621\r\n",
      "@SQ\tSN:chr2\tLN:243199373\r\n",
      "@SQ\tSN:chr3\tLN:198022430\r\n",
      "@SQ\tSN:chr4\tLN:191154276\r\n",
      "@SQ\tSN:chr5\tLN:180915260\r\n",
      "@SQ\tSN:chr6\tLN:171115067\r\n",
      "@SQ\tSN:chr7\tLN:159138663\r\n",
      "@SQ\tSN:chr8\tLN:146364022\r\n",
      "@SQ\tSN:chr9\tLN:141213431\r\n",
      "@SQ\tSN:chr10\tLN:135534747\r\n",
      "@SQ\tSN:chr11\tLN:135006516\r\n",
      "@SQ\tSN:chr12\tLN:133851895\r\n",
      "@SQ\tSN:chr13\tLN:115169878\r\n",
      "@SQ\tSN:chr14\tLN:107349540\r\n",
      "@SQ\tSN:chr15\tLN:102531392\r\n",
      "@SQ\tSN:chr16\tLN:90354753\r\n",
      "@SQ\tSN:chr17\tLN:81195210\r\n",
      "@SQ\tSN:chr18\tLN:78077248\r\n",
      "@SQ\tSN:chr19\tLN:59128983\r\n",
      "@SQ\tSN:chr20\tLN:63025520\r\n",
      "@SQ\tSN:chr21\tLN:48129895\r\n",
      "@SQ\tSN:chr22\tLN:51304566\r\n",
      "@SQ\tSN:chrX\tLN:155270560\r\n",
      "@SQ\tSN:chrY\tLN:59373566\r\n",
      "@PG\tID:STAR\tPN:STAR\tVN:STAR_2.5.2b\tCL:STAR   --runThreadN 2   --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db   --genomeLoad LoadAndKeep   --readFilesIn SRR924146_1.fastq   SRR924146_2.fastq      --outFileNamePrefix SRR924146.\r\n",
      "@CO\tuser command line: STAR --genomeDir /mnt/nfs/mfiers/STAR/hg19_star_db --genomeLoad LoadAndKeep --runThreadN 2 --readFilesIn SRR924146_1.fastq SRR924146_2.fastq --outFileNamePrefix SRR924146.\r\n"
     ]
    }
   ],
   "source": [
    "head -40 SRR924146.Aligned.out.sam | grep '^@'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "SRR924146.1\t99\tchr9\t130704859\t255\t90M\t=\t130704894\t125\tGGGGNCTGAGGTCATGGCTCCCAGGAAGAGGCCGCCAGCAGGGGCCCCAGGACACAAGGAAGGGACAGCTGAAGCACTAAGGAGTCAGAC\t???D%2==<D?:DEBBBEEEI12C?38?;;D1C?@6)07BD=((55:AAD))6@AA?;=>;2),558?=3::A:)+<:AA%%%%%%%%%%\tNH:i:1\tHI:i:1\tAS:i:167\tnM:i:5\r\n",
      "SRR924146.1\t147\tchr9\t130704894\t255\t90M\t=\t130704859\t-125\tCAGCAGGTCCCCCAGGACACAAGGAAGGGACAGCTGAAGCACTAAGCAGTCAGACAGTCACAGGTGGCTGGATTCCGGAGGCGGTCTGGC\t%%%%%%%%%%%%%%%%@A>;3CB;>CE?7.?=*=4CD@88.8*@=*=AHCF4EEHDF9IHDAEEHD::+D@BGGE1HHFF6FDDEDD@7@\tNH:i:1\tHI:i:1\tAS:i:167\tnM:i:5\r\n",
      "SRR924146.2\t99\tchrX\t47511285\t255\t10M185N64M5427N16M\t=\t47511531\t5905\tCTCTAAGCCCCTCTAGCAACATGTGGATATGGGCTTTGATATTCATGGAGGCCTTGGTGAGGCTGTTGCTGAGCAGCACTGTGTCAACGA\t?@@DDA4+:+CDFFCBHIEHIICBHHC9EF4CC8DDBBBDDGI:++?+99*?;FGGCG=CFFHIIHI<EHHCAE;*6);AC;>>@>;A;?\tNH:i:1\tHI:i:1\tAS:i:175\tnM:i:3\r\n",
      "SRR924146.2\t147\tchrX\t47511531\t255\t13M5427N68M142N9M\t=\t47511285\t-5905\tGCTGTTGCTGAGCACCACTGTGTCAACGAAGAAGTTACAGCCCAAATCCACCTGCATATATAACCCCGAGTGCTTAGCTTCCTGGAGTCG\t<B?<5:ACCA@@;;CAAA;;7*?>FCFHHIIHAGE@FF=.(>>EGFBEBBDGB9BIGD9B:*C?*C8C3<+A<4F>@?;FHFDDDAD??=\tNH:i:1\tHI:i:1\tAS:i:175\tnM:i:3\r\n",
      "SRR924146.3\t99\tchr9\t135895238\t1\t90M\t=\t135895246\t98\tATTTGAAGCTGGTATCTCCAAGAATGGGCAGACCCGAGAGCATGCCCTTCTGGCTTACACACTGGGTGTGAAACAACTAATTGTCGGTGT\t@@@FADDFHHGHHGGIGHIIIIBEEHIIIIIIIEF<?6?@AH<?8DFFGIIIIIAACGGE3;C:;A@DD=CC6;A=AACC@ACACBB;<@\tNH:i:3\tHI:i:1\tAS:i:178\tnM:i:0\r\n",
      "SRR924146.3\t147\tchr9\t135895246\t1\t90M\t=\t135895238\t-98\tCTGGTATCTCCAAGAATGGGCAGACCCGAGAGCATGCCCTTCTGGCTTACACACTGGGTGTGAAACAACTAATTGTCGGTGTTAACAAAA\tC:@>C>3?:CCDC>>-3DCC>CADFFHFFHC=.=-=ACEF>HDD<HGGFB+HGH?IIIGGF>IGGIGHEEGHGEG@GHHFHHDBDDD@@@\tNH:i:3\tHI:i:1\tAS:i:178\tnM:i:0\r\n"
     ]
    }
   ],
   "source": [
    "head -34 SRR924146.Aligned.out.sam | grep -v '^@'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1.5 BAM file"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We sorted the SAM files and converted them to BAM files."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 38 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924538.bam SRR924538.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 40 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924537.bam SRR924537.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 39 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924536.bam SRR924536.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 39 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924535.bam SRR924535.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 43 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924534.bam SRR924534.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 38 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924533.bam SRR924533.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 40 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924532.bam SRR924532.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 41 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924531.bam SRR924531.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 37 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924530.bam SRR924530.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 43 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924529.bam SRR924529.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 38 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924528.bam SRR924528.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[bam_sort_core] merging from 44 files...\r\n"
     ]
    }
   ],
   "source": [
    "samtools sort -o SRR924146.bam SRR924146.Aligned.out.sam"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We generated an index using samtools."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924538.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924537.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924536.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924535.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924534.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924533.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924532.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924531.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924530.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924529.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924528.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "samtools index SRR924146.bam"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We checked if all the files were there."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 25014402019 nov 25 14:58 SRR924538.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  5688324784 nov 26 11:52 SRR924538.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2948792 nov 27 04:46 SRR924538.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924538*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 26779648697 nov 25 15:31 SRR924537.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6067543265 nov 26 12:16 SRR924537.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2962728 nov 27 04:48 SRR924537.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924537*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 26225142814 nov 25 22:15 SRR924536.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  5956618590 nov 26 12:40 SRR924536.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2973360 nov 27 04:49 SRR924536.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924536*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 26056204290 nov 25 22:49 SRR924535.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6051889205 nov 26 13:03 SRR924535.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2978680 nov 27 04:51 SRR924535.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924535*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 28675472065 nov 25 23:24 SRR924534.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6554343488 nov 26 13:29 SRR924534.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2913248 nov 27 04:53 SRR924534.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924534*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 25208506126 nov 26 00:58 SRR924533.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  5906977480 nov 26 13:51 SRR924533.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2920360 nov 27 04:54 SRR924533.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924533*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 26556587204 nov 26 01:34 SRR924532.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6152650521 nov 26 14:35 SRR924532.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2992568 nov 27 04:57 SRR924532.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924532*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 27039066331 nov 26 02:10 SRR924531.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6237915278 nov 26 15:05 SRR924531.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2949792 nov 27 05:01 SRR924531.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924531*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 24711202058 nov 26 02:45 SRR924530.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  5851673669 nov 26 15:30 SRR924530.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     3010696 nov 27 05:03 SRR924530.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924530*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 28412576508 nov 26 03:21 SRR924529.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6464535414 nov 26 15:59 SRR924529.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     3045008 nov 27 05:06 SRR924529.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924529*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 25360136625 nov 26 08:49 SRR924528.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  5654358539 nov 27 04:18 SRR924528.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     2922440 nov 27 05:10 SRR924528.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924528*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 29287253565 nov 26 09:28 SRR924146.Aligned.out.sam\r\n",
      "-rw-r--r-- 1 r0307152 domain users  6516590248 nov 27 04:45 SRR924146.bam\r\n",
      "-rw-r--r-- 1 r0307152 domain users     3101216 nov 27 05:11 SRR924146.bam.bai\r\n"
     ]
    }
   ],
   "source": [
    "ls -l SRR924146*[bs]a[mi]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We viewed the reads that map to each chromosome using samtools idxstats."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "chrM\t16571\t2649102\t0\r\n",
      "chr1\t249250621\t9000870\t0\r\n",
      "chr2\t243199373\t5658956\t0\r\n",
      "chr3\t198022430\t4016180\t0\r\n",
      "chr4\t191154276\t2225934\t0\r\n",
      "chr5\t180915260\t3881160\t0\r\n",
      "chr6\t171115067\t6264808\t0\r\n",
      "chr7\t159138663\t4260954\t0\r\n",
      "chr8\t146364022\t2634808\t0\r\n",
      "chr9\t141213431\t3423528\t0\r\n",
      "chr10\t135534747\t3023888\t0\r\n",
      "chr11\t135006516\t5146672\t0\r\n",
      "chr12\t133851895\t6753572\t0\r\n",
      "chr13\t115169878\t1280402\t0\r\n",
      "chr14\t107349540\t2441992\t0\r\n",
      "chr15\t102531392\t2961050\t0\r\n",
      "chr16\t90354753\t4075158\t0\r\n",
      "chr17\t81195210\t5728326\t0\r\n",
      "chr18\t78077248\t854748\t0\r\n",
      "chr19\t59128983\t6112174\t0\r\n",
      "chr20\t63025520\t1750228\t0\r\n",
      "chr21\t48129895\t842930\t0\r\n",
      "chr22\t51304566\t2366180\t0\r\n",
      "chrX\t155270560\t3379020\t0\r\n",
      "chrY\t59373566\t182594\t0\r\n",
      "*\t0\t0\t0\r\n"
     ]
    }
   ],
   "source": [
    "samtools idxstats SRR924538.bam"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We viewed the distribution of the mapping flags with samtools flagstat."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "90915234 + 0 in total (QC-passed reads + QC-failed reads)\r\n",
      "4647904 + 0 secondary\r\n",
      "0 + 0 supplementary\r\n",
      "0 + 0 duplicates\r\n",
      "90915234 + 0 mapped (100.00% : N/A)\r\n",
      "86267330 + 0 paired in sequencing\r\n",
      "43133665 + 0 read1\r\n",
      "43133665 + 0 read2\r\n",
      "86267330 + 0 properly paired (100.00% : N/A)\r\n",
      "86267330 + 0 with itself and mate mapped\r\n",
      "0 + 0 singletons (0.00% : N/A)\r\n",
      "0 + 0 with mate mapped to a different chr\r\n",
      "0 + 0 with mate mapped to a different chr (mapQ>=5)\r\n"
     ]
    }
   ],
   "source": [
    "samtools flagstat SRR924538.bam"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We then visualized the alignment with IGV. By inspecting the SRP02638.gene.counts.tsv with Excel, we chose a gene that has a high gene count number, for example <i>TPRG1L</i> and inspected it in sample SRR924530."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img width=\"50%\" src=\"/user/r0307152/files/IGV_SRR924530_TPRG1L.jpg\" >"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1.6 Reads to gene count "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We made a symbolic link to the full human annotation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lrwxrwxrwx 1 r0307152 domain users 56 nov 27 10:58 gencode.v19.nopseudo.plus.sort.gtf -> /mnt/nfs/data/RNA-seq/gencode.v19.nopseudo.plus.sort.gtf\r\n"
     ]
    }
   ],
   "source": [
    "ln -sf /mnt/nfs/data/RNA-seq/gencode.v19.nopseudo.plus.sort.gtf\n",
    "ls -l *gtf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "##description: evidence-based annotation of the human genome (GRCh37), version 19 (Ensembl 74)\r\n",
      "##provider: GENCODE\r\n",
      "##contact: gencode@sanger.ac.uk\r\n",
      "##format: gtf\r\n",
      "##date: 2013-12-05\r\n",
      "chr1\tHAVANA\texon\t29554\t30039\t.\t+\t.\tgene_id \"ENSG00000243485.2\"; transcript_id \"ENST00000473358.1\"; gene_type \"lincRNA\"; gene_status \"NOVEL\"; gene_name \"MIR1302-11\"; transcript_type \"lincRNA\"; transcript_status \"KNOWN\"; transcript_name \"MIR1302-11-001\"; exon_number 1;  exon_id \"ENSE00001947070.1\";  level 2; tag \"not_best_in_genome_evidence\"; havana_gene \"OTTHUMG00000000959.2\"; havana_transcript \"OTTHUMT00000002840.1\";\r\n",
      "chr1\tHAVANA\tgene\t29554\t31109\t.\t+\t.\tgene_id \"ENSG00000243485.2\"; transcript_id \"ENSG00000243485.2\"; gene_type \"lincRNA\"; gene_status \"NOVEL\"; gene_name \"MIR1302-11\"; transcript_type \"lincRNA\"; transcript_status \"NOVEL\"; transcript_name \"MIR1302-11\"; level 2; havana_gene \"OTTHUMG00000000959.2\";\r\n",
      "chr1\tHAVANA\ttranscript\t29554\t31097\t.\t+\t.\tgene_id \"ENSG00000243485.2\"; transcript_id \"ENST00000473358.1\"; gene_type \"lincRNA\"; gene_status \"NOVEL\"; gene_name \"MIR1302-11\"; transcript_type \"lincRNA\"; transcript_status \"KNOWN\"; transcript_name \"MIR1302-11-001\"; level 2; tag \"not_best_in_genome_evidence\"; havana_gene \"OTTHUMG00000000959.2\"; havana_transcript \"OTTHUMT00000002840.1\";\r\n",
      "chr1\tHAVANA\texon\t30267\t30667\t.\t+\t.\tgene_id \"ENSG00000243485.2\"; transcript_id \"ENST00000469289.1\"; gene_type \"lincRNA\"; gene_status \"NOVEL\"; gene_name \"MIR1302-11\"; transcript_type \"lincRNA\"; transcript_status \"KNOWN\"; transcript_name \"MIR1302-11-002\"; exon_number 1;  exon_id \"ENSE00001841699.1\";  level 2; tag \"not_best_in_genome_evidence\"; havana_gene \"OTTHUMG00000000959.2\"; havana_transcript \"OTTHUMT00000002841.2\";\r\n",
      "chr1\tHAVANA\ttranscript\t30267\t31109\t.\t+\t.\tgene_id \"ENSG00000243485.2\"; transcript_id \"ENST00000469289.1\"; gene_type \"lincRNA\"; gene_status \"NOVEL\"; gene_name \"MIR1302-11\"; transcript_type \"lincRNA\"; transcript_status \"KNOWN\"; transcript_name \"MIR1302-11-002\"; level 2; tag \"not_best_in_genome_evidence\"; havana_gene \"OTTHUMG00000000959.2\"; havana_transcript \"OTTHUMT00000002841.2\";\r\n"
     ]
    }
   ],
   "source": [
    "head -10 gencode.v19.nopseudo.plus.sort.gtf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\r\n",
      "       \u001b[44;37m ========== \u001b[0m\u001b[36m    _____ _    _ ____  _____  ______          _____  \r\n",
      "       \u001b[44;37m =====      \u001b[0m\u001b[36m   / ____| |  | |  _ \\|  __ \\|  ____|   /\\   |  __ \\ \r\n",
      "       \u001b[44;37m   =====    \u001b[0m\u001b[36m  | (___ | |  | | |_) | |__) | |__     /  \\  | |  | |\r\n",
      "       \u001b[44;37m     ====   \u001b[0m\u001b[36m   \\___ \\| |  | |  _ <|  _  /|  __|   / /\\ \\ | |  | |\r\n",
      "       \u001b[44;37m       ==== \u001b[0m\u001b[36m   ____) | |__| | |_) | | \\ \\| |____ / ____ \\| |__| |\r\n",
      "       \u001b[44;37m ========== \u001b[0m\u001b[36m  |_____/ \\____/|____/|_|  \\_\\______/_/    \\_\\_____/\u001b[0m\r\n",
      "\tv1.5.0-p1\r\n",
      "\r\n",
      "//==========================\u001b[36m featureCounts setting \u001b[0m===========================\\\\\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "||             Input files : \u001b[36m12 BAM files  \u001b[0m \u001b[0m                                  ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924146.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924528.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924529.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924530.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924531.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924532.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924533.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924534.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924535.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924536.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924537.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||                           \u001b[32mP\u001b[36m SRR924538.bam\u001b[0m \u001b[0m                                 ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "||             Output file : \u001b[36mSRP02638.counts\u001b[0m \u001b[0m                                 ||\r\n",
      "||             Annotations : \u001b[36m/mnt/nfs/data/RNA-seq/gencode.v19.nopseudo.p\u001b[0m ...\u001b[0m \u001b[0m||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "||                 Threads : \u001b[36m1\u001b[0m \u001b[0m                                               ||\r\n",
      "||                   Level : \u001b[36mmeta-feature level\u001b[0m \u001b[0m                              ||\r\n",
      "||              Paired-end : \u001b[36mno\u001b[0m \u001b[0m                                              ||\r\n",
      "||         Strand specific : \u001b[36mno\u001b[0m \u001b[0m                                              ||\r\n",
      "||      Multimapping reads : \u001b[36mnot counted\u001b[0m \u001b[0m                                     ||\r\n",
      "|| Multi-overlapping reads : \u001b[36mnot counted\u001b[0m \u001b[0m                                     ||\r\n",
      "||       Read orientations : \u001b[36mfr\u001b[0m \u001b[0m                                              ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "\\\\=====================\u001b[36m http://subread.sourceforge.net/ \u001b[0m======================//\r\n",
      "\r\n",
      "//=================================\u001b[36m Running \u001b[0m==================================\\\\\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Load annotation file /mnt/nfs/data/RNA-seq/gencode.v19.nopseudo.plus.s\u001b[0m ... \u001b[0m||\r\n",
      "||    Features : \u001b[36m1156385\u001b[0m \u001b[0m                                                     ||\r\n",
      "||    Meta-features : \u001b[36m41863\u001b[0m \u001b[0m                                                  ||\r\n",
      "||    Chromosomes/contigs : \u001b[36m25\u001b[0m \u001b[0m                                               ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924146.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m106561304\u001b[0m \u001b[0m                                                ||\r\n",
      "||    Successfully assigned reads : \u001b[36m78493768 (73.7%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.10 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924528.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m92258374\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m68424120 (74.2%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.38 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924529.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m103398320\u001b[0m \u001b[0m                                                ||\r\n",
      "||    Successfully assigned reads : \u001b[36m78648744 (76.1%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.27 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924530.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m89926144\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m68138126 (75.8%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.13 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924531.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m98359772\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m74331258 (75.6%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m1.96 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924532.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m96625770\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m73621724 (76.2%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m1.94 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924533.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m91659962\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m71350631 (77.8%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m1.95 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924534.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m104267238\u001b[0m \u001b[0m                                                ||\r\n",
      "||    Successfully assigned reads : \u001b[36m81239709 (77.9%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.20 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924535.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m94677630\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m75553012 (79.8%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.16 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924536.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m95300170\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m76142841 (79.9%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.03 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924537.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m97292542\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m76494037 (78.6%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m2.00 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "|| Process BAM file SRR924538.bam... \u001b[0m                                         ||\r\n",
      "||    Paired-end reads are included. \u001b[0m                                         ||\r\n",
      "||    Assign reads to features... \u001b[0m                                            ||\r\n",
      "||    Total reads : \u001b[36m90915234\u001b[0m \u001b[0m                                                 ||\r\n",
      "||    Successfully assigned reads : \u001b[36m71320341 (78.4%)\u001b[0m \u001b[0m                         ||\r\n",
      "||    Running time : \u001b[36m1.83 minutes\u001b[0m \u001b[0m                                            ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "||                         \u001b[36mRead assignment finished.\u001b[0m \u001b[0m                         ||\r\n",
      "||  \u001b[0m                                                                          ||\r\n",
      "\\\\=====================\u001b[36m http://subread.sourceforge.net/ \u001b[0m======================//\r\n",
      "\r\n"
     ]
    }
   ],
   "source": [
    "   featureCounts \\\n",
    "        -Q 10 \\\n",
    "        -g gene_name \\\n",
    "        -a /mnt/nfs/data/RNA-seq/gencode.v19.nopseudo.plus.sort.gtf \\\n",
    "        -o SRP02638.counts\\\n",
    "        SRR924146.bam SRR924528.bam SRR924529.bam SRR924530.bam SRR924531.bam SRR924532.bam SRR924533.bam SRR924534.bam SRR924535.bam SRR924536.bam SRR924537.bam SRR924538.bam"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-rw-r--r-- 1 r0307152 domain users 9673003 nov 27 11:31 SRP02638.counts\r\n",
      "-rw-r--r-- 1 r0307152 domain users     973 nov 27 11:31 SRP02638.counts.summary\r\n"
     ]
    }
   ],
   "source": [
    "ls -l *.counts*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We inspected  both files."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Status                     SRR924146.bam  SRR924528.bam  SRR924529.bam  SRR924530.bam  SRR924531.bam  SRR924532.bam  SRR924533.bam  SRR924534.bam  SRR924535.bam  SRR924536.bam  SRR924537.bam  SRR924538.bam\r\n",
      "Assigned                   78493768       68424120       78648744       68138126       74331258       73621724       71350631       81239709       75553012       76142841       76494037       71320341\r\n",
      "Unassigned_Ambiguity       5621847        5008735        5758077        5035676        5562630        5340883        5249822        5976220        5608206        5728570        6021270        5733123\r\n",
      "Unassigned_MultiMapping    0              0              0              0              0              0              0              0              0              0              0              0\r\n",
      "Unassigned_NoFeatures      11118025       9103459        9096969        8092548        9227912        8760661        7140419        7757383        5081474        5152607        6156879        5808154\r\n",
      "Unassigned_Unmapped        0              0              0              0              0              0              0              0              0              0              0              0\r\n",
      "Unassigned_MappingQuality  11327664       9722060        9894530        8659794        9237972        8902502        7919090        9293926        8434938        8276152        8620356        8053616\r\n",
      "Unassigned_FragmentLength  0              0              0              0              0              0              0              0              0              0              0              0\r\n",
      "Unassigned_Chimera         0              0              0              0              0              0              0              0              0              0              0              0\r\n",
      "Unassigned_Secondary       0              0              0              0              0              0              0              0              0              0              0              0\r\n",
      "Unassigned_Nonjunction     0              0              0              0              0              0              0              0              0              0              0              0\r\n",
      "Unassigned_Duplicate       0              0              0              0              0              0              0              0              0              0              0              0\r\n"
     ]
    }
   ],
   "source": [
    "head -20 SRP02638.counts.summary | column -t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Status\tSRR924146.bam\tSRR924528.bam\tSRR924529.bam\tSRR924530.bam\tSRR924531.bam\tSRR924532.bam\tSRR924533.bam\tSRR924534.bam\tSRR924535.bam\tSRR924536.bam\tSRR924537.bam\tSRR924538.bam\r\n",
      "Assigned\t78493768\t68424120\t78648744\t68138126\t74331258\t73621724\t71350631\t81239709\t75553012\t76142841\t76494037\t71320341\r\n",
      "Unassigned_Ambiguity\t5621847\t5008735\t5758077\t5035676\t5562630\t5340883\t5249822\t5976220\t5608206\t5728570\t6021270\t5733123\r\n",
      "Unassigned_MultiMapping\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "Unassigned_NoFeatures\t11118025\t9103459\t9096969\t8092548\t9227912\t8760661\t7140419\t7757383\t5081474\t5152607\t6156879\t5808154\r\n",
      "Unassigned_Unmapped\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "Unassigned_MappingQuality\t11327664\t9722060\t9894530\t8659794\t9237972\t8902502\t7919090\t9293926\t8434938\t8276152\t8620356\t8053616\r\n",
      "Unassigned_FragmentLength\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "Unassigned_Chimera\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "Unassigned_Secondary\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "Unassigned_Nonjunction\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "Unassigned_Duplicate\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n"
     ]
    }
   ],
   "source": [
    "head -20 SRP02638.counts.summary"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We seperated the columns on the gene structure and the columns with the actual counts. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "cut -f-6 SRP02638.counts > SRP02638.genedata.tsv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "# Program:featureCounts v1.5.0-p1; Command:\"featureCounts\" \"-Q\" \"10\" \"-g\" \"gene_name\" \"-a\" \"/mnt/nfs/data/RNA-seq/gencode.v19.nopseudo.plus.sort.gtf\" \"-o\" \"SRP02638.counts\" \"SRR924146.bam\" \"SRR924528.bam\" \"SRR924529.bam\" \"SRR924530.bam\" \"SRR924531.bam\" \"SRR924532.bam\" \"SRR924533.bam\" \"SRR924534.bam\" \"SRR924535.bam\" \"SRR924536.bam\" \"SRR924537.bam\" \"SRR924538.bam\" \r\n",
      "Geneid\tChr\tStart\tEnd\tStrand\tLength\r\n",
      "MIR1302-11\tchr1;chr1;chr1\t29554;30267;30976\t30039;30667;31109\t+;+;+\t1021\r\n",
      "FAM138A\tchr1;chr1;chr1\t34554;35245;35721\t35174;35481;36081\t-;-;-\t1219\r\n",
      "OR4F5\tchr1\t69091\t70008\t+\t918\r\n",
      "RP11-34P13.7\tchr1;chr1;chr1;chr1;chr1;chr1;chr1\t89295;92091;110953;112700;120721;129055;133374\t91629;92240;111357;112804;120932;129223;133566\t-;-;-;-;-;-;-\t3569\r\n",
      "RP11-34P13.8\tchr1;chr1\t89551;90287\t90050;91105\t-;-\t1319\r\n",
      "AL627309.1\tchr1;chr1\t134901;137621\t135802;139379\t-;-\t2661\r\n",
      "RP11-34P13.14\tchr1;chr1\t139790;140075\t139847;140339\t-;-\t323\r\n",
      "RP11-34P13.13\tchr1;chr1;chr1;chr1;chr1;chr1;chr1;chr1;chr1;chr1\t141474;146386;155767;164263;165884;168100;168610;169049;172557;173753\t143011;149707;155831;164791;165942;168165;168767;169264;172688;173862\t-;-;-;-;-;-;-;-;-;-\t6195\r\n"
     ]
    }
   ],
   "source": [
    "head SRP02638.genedata.tsv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "cut -f1,7- SRP02638.counts | grep -v '^#' > SRP02638.gene.counts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Geneid\tSRR924146.bam\tSRR924528.bam\tSRR924529.bam\tSRR924530.bam\tSRR924531.bam\tSRR924532.bam\tSRR924533.bam\tSRR924534.bam\tSRR924535.bam\tSRR924536.bam\tSRR924537.bam\tSRR924538.bam\r\n",
      "MIR1302-11\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "FAM138A\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "OR4F5\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "RP11-34P13.7\t6\t3\t4\t16\t2\t4\t4\t2\t2\t0\t0\t0\r\n",
      "RP11-34P13.8\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n",
      "AL627309.1\t165\t158\t194\t155\t100\t154\t95\t68\t26\t40\t83\t95\r\n",
      "RP11-34P13.14\t0\t2\t2\t2\t0\t0\t0\t1\t2\t0\t1\t1\r\n",
      "RP11-34P13.13\t11\t8\t9\t14\t5\t10\t2\t2\t1\t3\t8\t6\r\n",
      "RNU6-1100P\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\r\n"
     ]
    }
   ],
   "source": [
    "head SRP02638.gene.counts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We downloaded the SRP02638.gene.counts to our computer and changed it to SRP02638.gene.counts.tsv for inspection with Excel."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.2 Differential expression analysis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "For differential expression analysis using DESeq2: see Addendum section A"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.3 Gene Regulatory Network\n",
    "### 1.3.1 Gene Ontology (GO) enrichment analysis on gene signatures\n",
    "\n",
    "For the analysis the DEGs of the 24h versus 0h was used.\n",
    "\n",
    "The tool GOrilla was used to identify and visualize enriched GO terms in a ranked list of 3313 genes that were found to be significantly differentially expressed.\n",
    "\n",
    "GORilla’s output:\n",
    "Species used: Homo sapiens\n",
    "The system has recognized 2743 genes out of 3313 gene terms entered by the user.\n",
    "2743 genes were recognized by gene symbol and 0 genes by other gene IDs .\n",
    "Only 2462 of these genes are associated with a GO term.\n",
    "\n",
    "GORilla produces an overview diagram, showing the processes that the DEGs of our dataset are implicated in: \n",
    "<img width=\"100%\" src=\"/user/r0307152/files/RNAseq.png\">\n",
    "\n",
    "DEGs appear to be implicated in a lot of processes and mainly in immune system processes and cell activation pathways including leukocyte, granulocyte and neutrophil activation (main cells activated during immune response). This comes as no surprise as the T cells are a key component of the cell-mediated immune response.\n",
    "\n",
    "### 1.3.2 Functional analysis of significant modules in the interaction network\n",
    "\n",
    "We use the iRegulon software to predict regulators and targets within our dataset. \n",
    "\n",
    "The top scored regulon corresponds to the transcription factor with the code name: V$NFKAPPAB_01, and has a score of 3.622 with 105 direct targets for differential expression of genes in inflammation.This matches annotation for <b>NF-κB</b>. NF-κB is a transcriptional factor involved in cellular responses to stimuli such as stress, cytokines etc. It has a key role in the regulation of the immune response to infection (bacterial, viral), and incorrect regulation of NF-κB has been linked to inflammatory and autoimmune disease, viral infection and improper immune development. [7]\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2 Microarray analysis\n",
    "\n",
    "## Transcriptome Profiling of <i>in vivo</i> Activated T Cells in patients with Severe Asthma\n",
    "\n",
    "Referring to a study which can be found under PMID: 21917308.\n",
    "\n",
    "Asthma is a chronic lung disease characterised by inflamation and narrowing of the airways. Previously, it has been shown that the immune system is a key element of asthma progression and lots of inflammatory cells participate in its progression. \n",
    "\n",
    "Microarray analysis was performed in order to detect differentially expressed genes (DEGs) in CD8+ T cells of patients with Severe Asthma (SA) as compared to healthy controls (HC). For that reason, the gene expression profile <b>GSE31773</b> was downloaded from Gene Expression Omnibus(GEO) database. This dataset includes 40 samples: 20 of circulating CD4+ cells and 20 СD8+ T cell specimens, isolated from 8 HC, 4 patients with non-severe asthma and 8 patients with SA. For our analysis only <b>16 samples of CD8+ T cell specimens, isolated from 8 HC and 8 SA patients </b>, are used. Therefore this study investigates gene expression changes in CD8+ T cells in humans suffering from SA. Differentially expressed genes (DEGs) were screened out using limma package in R.\n",
    "\n",
    "For the execution of the microarray analysis: see <b>Addendum section B</b>."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Gene Regulatory Network\n",
    "### Gene Ontology (GO) enrichment analysis on gene signatures\n",
    "\n",
    "The tool GOrilla was used to identify and visualize enriched GO terms in a ranked list of 3167 genes that were found to be significantly differentially expressed on the microarray dataset.\n",
    "\n",
    "GORilla’s output:\n",
    "Species used: Homo sapiens\n",
    "The system has recognized 3059 genes out of 3167 gene terms entered by the user. 3059 genes were recognized by gene symbol and 0 genes by other gene IDs. 1 duplicate genes were removed (keeping the highest ranking instance of each gene) leaving a total of 3058 genes.\n",
    "Only 2623 of these genes are associated with a GO term.\n",
    "\n",
    "GORilla produces an overview diagram, showing the processes that the DEGs of our dataset are implicated in: \n",
    "\n",
    "<img width=\"100%\" src=\"/user/r0307152/files/Microarray.png\">\n",
    "\n",
    "DEGS in T cells are implicated in pathways such as detection of hormone stimulus, glycoprotein transport, intracellular sterol and cholesterol transport, regulation of cell proliferation, negative regulation of lipid and cholesterol storage and positive regulation of peptide secretion.\n",
    "Asthma is a chronic inflammatory disease characterized by complex cellular interactions. Therefore, a variety of genes associated with diverse cellular pathways can be implicated in the disease development. Pathways involving the regulation, storage and transport of lipids can be implicated since important inflammatory modulators such as eicosanoids, leukotrienes (LTs) and prostaglandins (PGs) are lipid derived. Moreover, lately lipid mediators acting as anti-inflammatory and pro-resolution mediators of allergic airway inflammation has been characterized, revealing the important connection between lipids and immunity. [2] Factors regulating the proliferation of immune cells are also implicated in states of inflammation and asthma. [3]\n",
    "\n",
    "### Functional analysis of significant modules in the interaction network\n",
    "We use the iRegulon software to predict regulators and targets within our dataset.\n",
    "\n",
    "The top scored regulon corresponds to the <b>EIF5A2</b> enriched with a score of 4.214 with 795 direct targets for differential expression of genes in asthma. EIF5A is a transcription factor and is not a surprise that a transcription factor of all the DEGs is the one that is interacting the most with the rest of the DEGs.\n",
    "EIF5A2 or Eukaryotic translation initiation factor 5A-2 is a mRNA-binding protein essential for translation elongation, that has recently been described as an oncogene in many types of human cancer. [3] EIF5A has been though to contribute to the production of proinflammatory cytokines, promoting inflammation. [4] Inflammatory response is a key component of asthma pathogenesis, suggesting that eIF5A might indeed play a role in the disease progression. [2]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3 Conclusion"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "\n",
    "Based on the gene regulatory network analysis done in both the RNAseq and microarray data it seems that different pathways are implicated in the <i>in vivo</i> and the <i>in vitro</i> situation. \n",
    "But is that the case?\n",
    "Probably not. The different results obtained are probably due to the fact that in the RNAseq analysis the genomic profiling of CD4+ T cells was studied, whereas in the microarray analysis that of the CD8+ T cells.\n",
    "\n",
    "There is established cooperation between CD8+ and CD4+ T cells during the immune response. [6]\n",
    "\n",
    "CD4+ cells are helper cells are the ones helping in the activation of other immune cells, possibly also CD8+ cells, therefore CD4+ cells are mainly implicated in activation pathways, whereas CD8+ cells as cytotoxic T cells are implicated in cascades such as peptide secretion, lipid transfer and cellular response to hormone stimulus."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 4 References\n",
    "1.\tTsitsiou E, Williams A, Moschos S, Patel K, Rossios C, Jiang X et al. Transcriptome analysis shows activation of circulating CD8+ T cells in patients with severe asthma. Journal of Allergy and Clinical Immunology. 2012;129(1):95-103.\n",
    "2.\tMurdoch JR, Lloyd CM. Chronic inflammation and asthma. Mutation Research. 2010;690(1-2):24-39. doi:10.1016/j.mrfmmm.2009.09.005.\n",
    "3.\tWaal Malefyt R., Haanen J., Spits H., Roncarolo M.G., te Velde A., Figdor C., Johnson K., Kastelein R., Yssel H., de Vries J.E. Interleukin 10 (IL-10) and viral IL-10 strongly reduce antigen-specific human T cell proliferation by diminishing the antigen-presenting capacity of monocytes via downregulation of class II major histocompatibility complex expression. J. Exp. Med. 1991;174:915–924.\n",
    "4.\tWang F, Guan X, Xie D. Roles of Eukaryotic Initiation Factor 5A2 in Human Cancer. International Journal of Biological Sciences. 2013;9(10):1013-1020.\n",
    "5.\tMaier B, Ogihara T, Trace A, Tersey S, Robbins R, Chakrabarti S et al. The unique hypusine modification of eIF5A promotes islet β cell inflammation and dysfunction in mice. Journal of Clinical Investigation. 2010;120(6):2156-2170.\n",
    "6. Castellino, Flora and Ronald N. Germain. \"COOPERATION BETWEEN CD4+ AND CD8+ T CELLS: When, Where, And How\". Annual Review of Immunology 24.1 (2006): 519-540.\n",
    "7. Castellino, Flora and Ronald N. Germain. \"COOPERATION BETWEEN CD4+ AND CD8+ T CELLS: When, Where, And How\". Annual Review of Immunology 24.1 (2006): 519-540."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Bash",
   "language": "bash",
   "name": "bash"
  },
  "language_info": {
   "codemirror_mode": "shell",
   "file_extension": ".sh",
   "mimetype": "text/x-sh",
   "name": "bash"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
