{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:05:33.604063Z", "start_time": "2023-05-20T16:05:30.146945Z" }, "collapsed": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2023-05-20 09:05:30-- https://www.mirbase.org/ftp/CURRENT/mature.fa.gz\r\n", "Resolving www.mirbase.org... 130.88.97.249\r\n", "Connecting to www.mirbase.org|130.88.97.249|:443... connected.\r\n", "HTTP request sent, awaiting response... 200 OK\r\n", "Length: 803746 (785K) [application/x-gzip]\r\n", "Saving to: ‘mature.fa.gz’\r\n", "\r\n", "mature.fa.gz 100%[===================>] 784.91K 342KB/s in 2.3s \r\n", "\r\n", "2023-05-20 09:05:33 (342 KB/s) - ‘mature.fa.gz’ saved [803746/803746]\r\n", "\r\n" ] } ], "source": [ "!wget https://www.mirbase.org/ftp/CURRENT/mature.fa.gz" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:08:16.201849Z", "start_time": "2023-05-20T16:08:16.145057Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ ">hsa-let-7a-5p MIMAT0000062 Homo sapiens let-7a-5p\n", "TGAGGTAGTAGGTTGTATAGTT\n", ">hsa-let-7a-3p MIMAT0004481 Homo sapiens let-7a-3p\n", "CTATACAATCTACTGTCTTTC\n", ">hsa-let-7a-2-3p MIMAT0010195 Homo sapiens let-7a-2-3p\n", "CTGTACAGCCTCCTAGCTTTCC\n", ">hsa-let-7b-5p MIMAT0000063 Homo sapiens let-7b-5p\n", "TGAGGTAGTAGGTTGTGTGGTT\n", ">hsa-let-7b-3p MIMAT0004482 Homo sapiens let-7b-3p\n", "CTATACAACCTACTGCCTTCCC\n" ] } ], "source": [ "%%bash\n", "#extract human miRNAs\n", "zcat mature.fa.gz | grep -A1 sapiens | sed '/^[^>]/s/U/T/g' > mature.hsa.fa\n", "head mature.hsa.fa" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:14:51.607352Z", "start_time": "2023-05-20T16:14:51.443975Z" }, "collapsed": false }, "outputs": [], "source": [ "%%bash\n", "samtools faidx mature.hsa.fa" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:10:22.921848Z", "start_time": "2023-05-20T16:10:22.331328Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Settings:\n", " Output files: \"mature_hsa.*.bt2\"\n", " Line rate: 6 (line is 64 bytes)\n", " Lines per side: 1 (side is 64 bytes)\n", " Offset rate: 4 (one in 16)\n", " FTable chars: 10\n", " Strings: unpacked\n", " Max bucket size: default\n", " Max bucket size, sqrt multiplier: default\n", " Max bucket size, len divisor: 4\n", " Difference-cover sample period: 1024\n", " Endianness: little\n", " Actual local endianness: little\n", " Sanity checking: disabled\n", " Assertions: disabled\n", " Random seed: 0\n", " Sizeofs: void*:8, int:4, long:8, size_t:8\n", "Input files DNA, FASTA:\n", " mature.hsa.fa\n", "Reading reference sizes\n", " Time reading reference sizes: 00:00:00\n", "Calculating joined length\n", "Writing header\n", "Reserving space for joined string\n", "Joining reference sequences\n", " Time to join reference sequences: 00:00:00\n", "bmax according to bmaxDivN setting: 14346\n", "Using parameters --bmax 10760 --dcv 1024\n", " Doing ahead-of-time memory usage test\n", " Passed! Constructing with these parameters: --bmax 10760 --dcv 1024\n", "Constructing suffix-array element generator\n", "Building DifferenceCoverSample\n", " Building sPrime\n", " Building sPrimeOrder\n", " V-Sorting samples\n", " V-Sorting samples time: 00:00:00\n", " Allocating rank array\n", " Ranking v-sort output\n", " Ranking v-sort output time: 00:00:00\n", " Invoking Larsson-Sadakane on ranks\n", " Invoking Larsson-Sadakane on ranks time: 00:00:00\n", " Sanity-checking and returning\n", "Building samples\n", "Reserving space for 12 sample suffixes\n", "Generating random suffixes\n", "QSorting 12 sample offsets, eliminating duplicates\n", "QSorting sample offsets, eliminating duplicates time: 00:00:00\n", "Multikey QSorting 12 samples\n", " (Using difference cover)\n", " Multikey QSorting samples time: 00:00:00\n", "Calculating bucket sizes\n", "Splitting and merging\n", " Splitting and merging time: 00:00:00\n", "Avg bucket size: 57386 (target: 10759)\n", "Converting suffix-array elements to index image\n", "Allocating ftab, absorbFtab\n", "Entering Ebwt loop\n", "Getting block 1 of 1\n", " No samples; assembling all-inclusive block\n", " Sorting block of length 57386 for bucket 1\n", " (Using difference cover)\n", " Sorting block time: 00:00:00\n", "Returning block of 57387 for bucket 1\n", "Exited Ebwt loop\n", "fchr[A]: 0\n", "fchr[C]: 12681\n", "fchr[G]: 26180\n", "fchr[T]: 42679\n", "fchr[$]: 57386\n", "Exiting Ebwt::buildToDisk()\n", "Returning from initFromVector\n", "Wrote 4393751 bytes to primary EBWT file: mature_hsa.1.bt2\n", "Wrote 14352 bytes to secondary EBWT file: mature_hsa.2.bt2\n", "Re-opening _in1 and _in2 as input streams\n", "Returning from Ebwt constructor\n", "Headers:\n", " len: 57386\n", " bwtLen: 57387\n", " sz: 14347\n", " bwtSz: 14347\n", " lineRate: 6\n", " offRate: 4\n", " offMask: 0xfffffff0\n", " ftabChars: 10\n", " eftabLen: 20\n", " eftabSz: 80\n", " ftabLen: 1048577\n", " ftabSz: 4194308\n", " offsLen: 3587\n", " offsSz: 14348\n", " lineSz: 64\n", " sideSz: 64\n", " sideBwtSz: 48\n", " sideBwtLen: 192\n", " numSides: 299\n", " numLines: 299\n", " ebwtTotLen: 19136\n", " ebwtTotSz: 19136\n", " color: 0\n", " reverse: 0\n", "Total time for call to driver() for forward index: 00:00:00\n", "Reading reference sizes\n", " Time reading reference sizes: 00:00:00\n", "Calculating joined length\n", "Writing header\n", "Reserving space for joined string\n", "Joining reference sequences\n", " Time to join reference sequences: 00:00:00\n", " Time to reverse reference sequence: 00:00:00\n", "bmax according to bmaxDivN setting: 14346\n", "Using parameters --bmax 10760 --dcv 1024\n", " Doing ahead-of-time memory usage test\n", " Passed! Constructing with these parameters: --bmax 10760 --dcv 1024\n", "Constructing suffix-array element generator\n", "Building DifferenceCoverSample\n", " Building sPrime\n", " Building sPrimeOrder\n", " V-Sorting samples\n", " V-Sorting samples time: 00:00:00\n", " Allocating rank array\n", " Ranking v-sort output\n", " Ranking v-sort output time: 00:00:00\n", " Invoking Larsson-Sadakane on ranks\n", " Invoking Larsson-Sadakane on ranks time: 00:00:00\n", " Sanity-checking and returning\n", "Building samples\n", "Reserving space for 12 sample suffixes\n", "Generating random suffixes\n", "QSorting 12 sample offsets, eliminating duplicates\n", "QSorting sample offsets, eliminating duplicates time: 00:00:00\n", "Multikey QSorting 12 samples\n", " (Using difference cover)\n", " Multikey QSorting samples time: 00:00:00\n", "Calculating bucket sizes\n", "Splitting and merging\n", " Splitting and merging time: 00:00:00\n", "Avg bucket size: 57386 (target: 10759)\n", "Converting suffix-array elements to index image\n", "Allocating ftab, absorbFtab\n", "Entering Ebwt loop\n", "Getting block 1 of 1\n", " No samples; assembling all-inclusive block\n", " Sorting block of length 57386 for bucket 1\n", " (Using difference cover)\n", " Sorting block time: 00:00:00\n", "Returning block of 57387 for bucket 1\n", "Exited Ebwt loop\n", "fchr[A]: 0\n", "fchr[C]: 12681\n", "fchr[G]: 26180\n", "fchr[T]: 42679\n", "fchr[$]: 57386\n", "Exiting Ebwt::buildToDisk()\n", "Returning from initFromVector\n", "Wrote 4393751 bytes to primary EBWT file: mature_hsa.rev.1.bt2\n", "Wrote 14352 bytes to secondary EBWT file: mature_hsa.rev.2.bt2\n", "Re-opening _in1 and _in2 as input streams\n", "Returning from Ebwt constructor\n", "Headers:\n", " len: 57386\n", " bwtLen: 57387\n", " sz: 14347\n", " bwtSz: 14347\n", " lineRate: 6\n", " offRate: 4\n", " offMask: 0xfffffff0\n", " ftabChars: 10\n", " eftabLen: 20\n", " eftabSz: 80\n", " ftabLen: 1048577\n", " ftabSz: 4194308\n", " offsLen: 3587\n", " offsSz: 14348\n", " lineSz: 64\n", " sideSz: 64\n", " sideBwtSz: 48\n", " sideBwtLen: 192\n", " numSides: 299\n", " numLines: 299\n", " ebwtTotLen: 19136\n", " ebwtTotSz: 19136\n", " color: 0\n", " reverse: 1\n", "Total time for backward call to driver() for mirror index: 00:00:00\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Building a SMALL index\n" ] } ], "source": [ "%%bash\n", "#buile index\n", "bowtie2-build mature.hsa.fa mature_hsa" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:30:35.241341Z", "start_time": "2023-05-20T16:26:29.303820Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/A2508.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/A2508.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/A375.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/A375.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/A549.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/A549.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/BxPC3.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/BxPC3.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/C42Bu.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/C42Bu.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/Colo320.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/Colo320.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/H1299.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/H1299.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/H23u.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/H23u.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/H358u.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/H358u.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HCC44.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HCC44.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HCT116.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HCT116.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HEK293T-16.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HEK293T-16.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HEK293T-1.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HEK293T-1.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HEK293T-26.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HEK293T-26.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HEK293T-9.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HEK293T-9.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HEPG2.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HEPG2.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/HS707A.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/HS707A.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/K562.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/K562.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/LNCaP.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/LNCaP.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/LS174T.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/LS174T.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/MCF7.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/MCF7.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/MDA231.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/MDA231.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/MDA453.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/MDA453.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/PACA2.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/PACA2.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/PANC1.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/PANC1.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/PC3.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/PC3.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/SW480u.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/SW480u.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/SW620u.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/SW620u.hsa-miR.bam\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U fastq/ZR751.trim.fastq.gz | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/ZR751.hsa-miR.bam\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "4821010 reads; of these:\n", " 4821010 (100.00%) were unpaired; of these:\n", " 4802725 (99.62%) aligned 0 times\n", " 8705 (0.18%) aligned exactly 1 time\n", " 9580 (0.20%) aligned >1 times\n", "0.38% overall alignment rate\n", "4776794 reads; of these:\n", " 4776794 (100.00%) were unpaired; of these:\n", " 4754325 (99.53%) aligned 0 times\n", " 9945 (0.21%) aligned exactly 1 time\n", " 12524 (0.26%) aligned >1 times\n", "0.47% overall alignment rate\n", "4955992 reads; of these:\n", " 4955992 (100.00%) were unpaired; of these:\n", " 4931131 (99.50%) aligned 0 times\n", " 12243 (0.25%) aligned exactly 1 time\n", " 12618 (0.25%) aligned >1 times\n", "0.50% overall alignment rate\n", "4932829 reads; of these:\n", " 4932829 (100.00%) were unpaired; of these:\n", " 4915807 (99.65%) aligned 0 times\n", " 7826 (0.16%) aligned exactly 1 time\n", " 9196 (0.19%) aligned >1 times\n", "0.35% overall alignment rate\n", "4553779 reads; of these:\n", " 4553779 (100.00%) were unpaired; of these:\n", " 4531848 (99.52%) aligned 0 times\n", " 7366 (0.16%) aligned exactly 1 time\n", " 14565 (0.32%) aligned >1 times\n", "0.48% overall alignment rate\n", "6464528 reads; of these:\n", " 6464528 (100.00%) were unpaired; of these:\n", " 6436582 (99.57%) aligned 0 times\n", " 10498 (0.16%) aligned exactly 1 time\n", " 17448 (0.27%) aligned >1 times\n", "0.43% overall alignment rate\n", "4489153 reads; of these:\n", " 4489153 (100.00%) were unpaired; of these:\n", " 4471925 (99.62%) aligned 0 times\n", " 8902 (0.20%) aligned exactly 1 time\n", " 8326 (0.19%) aligned >1 times\n", "0.38% overall alignment rate\n", "4019383 reads; of these:\n", " 4019383 (100.00%) were unpaired; of these:\n", " 3997543 (99.46%) aligned 0 times\n", " 11181 (0.28%) aligned exactly 1 time\n", " 10659 (0.27%) aligned >1 times\n", "0.54% overall alignment rate\n", "3655799 reads; of these:\n", " 3655799 (100.00%) were unpaired; of these:\n", " 3639679 (99.56%) aligned 0 times\n", " 7308 (0.20%) aligned exactly 1 time\n", " 8812 (0.24%) aligned >1 times\n", "0.44% overall alignment rate\n", "7007928 reads; of these:\n", " 7007928 (100.00%) were unpaired; of these:\n", " 6980739 (99.61%) aligned 0 times\n", " 10843 (0.15%) aligned exactly 1 time\n", " 16346 (0.23%) aligned >1 times\n", "0.39% overall alignment rate\n", "5966114 reads; of these:\n", " 5966114 (100.00%) were unpaired; of these:\n", " 5950253 (99.73%) aligned 0 times\n", " 6855 (0.11%) aligned exactly 1 time\n", " 9006 (0.15%) aligned >1 times\n", "0.27% overall alignment rate\n", "4217907 reads; of these:\n", " 4217907 (100.00%) were unpaired; of these:\n", " 4198913 (99.55%) aligned 0 times\n", " 7085 (0.17%) aligned exactly 1 time\n", " 11909 (0.28%) aligned >1 times\n", "0.45% overall alignment rate\n", "4101770 reads; of these:\n", " 4101770 (100.00%) were unpaired; of these:\n", " 4088791 (99.68%) aligned 0 times\n", " 5288 (0.13%) aligned exactly 1 time\n", " 7691 (0.19%) aligned >1 times\n", "0.32% overall alignment rate\n", "5970825 reads; of these:\n", " 5970825 (100.00%) were unpaired; of these:\n", " 5959974 (99.82%) aligned 0 times\n", " 5437 (0.09%) aligned exactly 1 time\n", " 5414 (0.09%) aligned >1 times\n", "0.18% overall alignment rate\n", "5948472 reads; of these:\n", " 5948472 (100.00%) were unpaired; of these:\n", " 5934365 (99.76%) aligned 0 times\n", " 6041 (0.10%) aligned exactly 1 time\n", " 8066 (0.14%) aligned >1 times\n", "0.24% overall alignment rate\n", "4079143 reads; of these:\n", " 4079143 (100.00%) were unpaired; of these:\n", " 4062616 (99.59%) aligned 0 times\n", " 8477 (0.21%) aligned exactly 1 time\n", " 8050 (0.20%) aligned >1 times\n", "0.41% overall alignment rate\n", "4486372 reads; of these:\n", " 4486372 (100.00%) were unpaired; of these:\n", " 4461801 (99.45%) aligned 0 times\n", " 10688 (0.24%) aligned exactly 1 time\n", " 13883 (0.31%) aligned >1 times\n", "0.55% overall alignment rate\n", "6052256 reads; of these:\n", " 6052256 (100.00%) were unpaired; of these:\n", " 6027059 (99.58%) aligned 0 times\n", " 9673 (0.16%) aligned exactly 1 time\n", " 15524 (0.26%) aligned >1 times\n", "0.42% overall alignment rate\n", "5058477 reads; of these:\n", " 5058477 (100.00%) were unpaired; of these:\n", " 5031761 (99.47%) aligned 0 times\n", " 8373 (0.17%) aligned exactly 1 time\n", " 18343 (0.36%) aligned >1 times\n", "0.53% overall alignment rate\n", "4495300 reads; of these:\n", " 4495300 (100.00%) were unpaired; of these:\n", " 4466388 (99.36%) aligned 0 times\n", " 14500 (0.32%) aligned exactly 1 time\n", " 14412 (0.32%) aligned >1 times\n", "0.64% overall alignment rate\n", "4878799 reads; of these:\n", " 4878799 (100.00%) were unpaired; of these:\n", " 4853373 (99.48%) aligned 0 times\n", " 13422 (0.28%) aligned exactly 1 time\n", " 12004 (0.25%) aligned >1 times\n", "0.52% overall alignment rate\n", "4911860 reads; of these:\n", " 4911860 (100.00%) were unpaired; of these:\n", " 4887113 (99.50%) aligned 0 times\n", " 10158 (0.21%) aligned exactly 1 time\n", " 14589 (0.30%) aligned >1 times\n", "0.50% overall alignment rate\n", "4908472 reads; of these:\n", " 4908472 (100.00%) were unpaired; of these:\n", " 4879950 (99.42%) aligned 0 times\n", " 11657 (0.24%) aligned exactly 1 time\n", " 16865 (0.34%) aligned >1 times\n", "0.58% overall alignment rate\n", "5741493 reads; of these:\n", " 5741493 (100.00%) were unpaired; of these:\n", " 5724200 (99.70%) aligned 0 times\n", " 7739 (0.13%) aligned exactly 1 time\n", " 9554 (0.17%) aligned >1 times\n", "0.30% overall alignment rate\n", "3805981 reads; of these:\n", " 3805981 (100.00%) were unpaired; of these:\n", " 3790834 (99.60%) aligned 0 times\n", " 6854 (0.18%) aligned exactly 1 time\n", " 8293 (0.22%) aligned >1 times\n", "0.40% overall alignment rate\n", "3026377 reads; of these:\n", " 3026377 (100.00%) were unpaired; of these:\n", " 3007927 (99.39%) aligned 0 times\n", " 7559 (0.25%) aligned exactly 1 time\n", " 10891 (0.36%) aligned >1 times\n", "0.61% overall alignment rate\n", "5734706 reads; of these:\n", " 5734706 (100.00%) were unpaired; of these:\n", " 5715120 (99.66%) aligned 0 times\n", " 9143 (0.16%) aligned exactly 1 time\n", " 10443 (0.18%) aligned >1 times\n", "0.34% overall alignment rate\n", "4477297 reads; of these:\n", " 4477297 (100.00%) were unpaired; of these:\n", " 4453612 (99.47%) aligned 0 times\n", " 9742 (0.22%) aligned exactly 1 time\n", " 13943 (0.31%) aligned >1 times\n", "0.53% overall alignment rate\n", "3595305 reads; of these:\n", " 3595305 (100.00%) were unpaired; of these:\n", " 3576052 (99.46%) aligned 0 times\n", " 8967 (0.25%) aligned exactly 1 time\n", " 10286 (0.29%) aligned >1 times\n", "0.54% overall alignment rate\n" ] } ], "source": [ "%%bash\n", "for f in fastq/*.trim.fastq.gz; do\n", "out=${f/.trim.fastq.gz/.hsa-miR.bam}\n", "out=`basename $out`\n", "echo \"bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U $f | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/$out\";\n", "bowtie2 --sensitive --end-to-end -N 1 -p 12 -x mature_hsa -U $f | samtools view -q10 -F20 - -Sb -h -t mature.hsa.fa.fai -o bam/$out\n", "done" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:31:34.910317Z", "start_time": "2023-05-20T16:31:29.781463Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "samtools sort -o bam/A2508.hsa-miR.srt.bam bam/A2508.hsa-miR.bam\n", "samtools sort -o bam/A375.hsa-miR.srt.bam bam/A375.hsa-miR.bam\n", "samtools sort -o bam/A549.hsa-miR.srt.bam bam/A549.hsa-miR.bam\n", "samtools sort -o bam/BxPC3.hsa-miR.srt.bam bam/BxPC3.hsa-miR.bam\n", "samtools sort -o bam/C42Bu.hsa-miR.srt.bam bam/C42Bu.hsa-miR.bam\n", "samtools sort -o bam/Colo320.hsa-miR.srt.bam bam/Colo320.hsa-miR.bam\n", "samtools sort -o bam/H1299.hsa-miR.srt.bam bam/H1299.hsa-miR.bam\n", "samtools sort -o bam/H23u.hsa-miR.srt.bam bam/H23u.hsa-miR.bam\n", "samtools sort -o bam/H358u.hsa-miR.srt.bam bam/H358u.hsa-miR.bam\n", "samtools sort -o bam/HCC44.hsa-miR.srt.bam bam/HCC44.hsa-miR.bam\n", "samtools sort -o bam/HCT116.hsa-miR.srt.bam bam/HCT116.hsa-miR.bam\n", "samtools sort -o bam/HEK293T-16.hsa-miR.srt.bam bam/HEK293T-16.hsa-miR.bam\n", "samtools sort -o bam/HEK293T-1.hsa-miR.srt.bam bam/HEK293T-1.hsa-miR.bam\n", "samtools sort -o bam/HEK293T-26.hsa-miR.srt.bam bam/HEK293T-26.hsa-miR.bam\n", "samtools sort -o bam/HEK293T-9.hsa-miR.srt.bam bam/HEK293T-9.hsa-miR.bam\n", "samtools sort -o bam/HEPG2.hsa-miR.srt.bam bam/HEPG2.hsa-miR.bam\n", "samtools sort -o bam/HS707A.hsa-miR.srt.bam bam/HS707A.hsa-miR.bam\n", "samtools sort -o bam/K562.hsa-miR.srt.bam bam/K562.hsa-miR.bam\n", "samtools sort -o bam/LNCaP.hsa-miR.srt.bam bam/LNCaP.hsa-miR.bam\n", "samtools sort -o bam/LS174T.hsa-miR.srt.bam bam/LS174T.hsa-miR.bam\n", "samtools sort -o bam/MCF7.hsa-miR.srt.bam bam/MCF7.hsa-miR.bam\n", "samtools sort -o bam/MDA231.hsa-miR.srt.bam bam/MDA231.hsa-miR.bam\n", "samtools sort -o bam/MDA453.hsa-miR.srt.bam bam/MDA453.hsa-miR.bam\n", "samtools sort -o bam/PACA2.hsa-miR.srt.bam bam/PACA2.hsa-miR.bam\n", "samtools sort -o bam/PANC1.hsa-miR.srt.bam bam/PANC1.hsa-miR.bam\n", "samtools sort -o bam/PC3.hsa-miR.srt.bam bam/PC3.hsa-miR.bam\n", "samtools sort -o bam/SW480u.hsa-miR.srt.bam bam/SW480u.hsa-miR.bam\n", "samtools sort -o bam/SW620u.hsa-miR.srt.bam bam/SW620u.hsa-miR.bam\n", "samtools sort -o bam/ZR751.hsa-miR.srt.bam bam/ZR751.hsa-miR.bam\n" ] } ], "source": [ "%%bash\n", "for f in bam/*.hsa-miR.bam; do\n", "out=${f/.bam/.srt.bam};\n", "echo \"samtools sort -o $out $f\";\n", "samtools sort -m 2G -o $out $f\n", "samtools index $out;\n", "done" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:32:10.395458Z", "start_time": "2023-05-20T16:32:10.342608Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "umi_tools dedup -I bam/A2508.hsa-miR.srt.bam -S bam/A2508.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/A375.hsa-miR.srt.bam -S bam/A375.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/A549.hsa-miR.srt.bam -S bam/A549.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/BxPC3.hsa-miR.srt.bam -S bam/BxPC3.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/C42Bu.hsa-miR.srt.bam -S bam/C42Bu.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/Colo320.hsa-miR.srt.bam -S bam/Colo320.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/H1299.hsa-miR.srt.bam -S bam/H1299.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/H23u.hsa-miR.srt.bam -S bam/H23u.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/H358u.hsa-miR.srt.bam -S bam/H358u.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HCC44.hsa-miR.srt.bam -S bam/HCC44.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HCT116.hsa-miR.srt.bam -S bam/HCT116.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HEK293T-16.hsa-miR.srt.bam -S bam/HEK293T-16.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HEK293T-1.hsa-miR.srt.bam -S bam/HEK293T-1.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HEK293T-26.hsa-miR.srt.bam -S bam/HEK293T-26.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HEK293T-9.hsa-miR.srt.bam -S bam/HEK293T-9.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HEPG2.hsa-miR.srt.bam -S bam/HEPG2.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/HS707A.hsa-miR.srt.bam -S bam/HS707A.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/K562.hsa-miR.srt.bam -S bam/K562.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/LNCaP.hsa-miR.srt.bam -S bam/LNCaP.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/LS174T.hsa-miR.srt.bam -S bam/LS174T.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/MCF7.hsa-miR.srt.bam -S bam/MCF7.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/MDA231.hsa-miR.srt.bam -S bam/MDA231.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/MDA453.hsa-miR.srt.bam -S bam/MDA453.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/PACA2.hsa-miR.srt.bam -S bam/PACA2.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/PANC1.hsa-miR.srt.bam -S bam/PANC1.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/PC3.hsa-miR.srt.bam -S bam/PC3.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/SW480u.hsa-miR.srt.bam -S bam/SW480u.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/SW620u.hsa-miR.srt.bam -S bam/SW620u.hsa-miR.srt.dd.bam &\n", "umi_tools dedup -I bam/ZR751.hsa-miR.srt.bam -S bam/ZR751.hsa-miR.srt.dd.bam &\n" ] } ], "source": [ "%%bash\n", "for f in bam/*.hsa-miR.srt.bam; do\n", "out=${f/.srt.bam/.srt.dd.bam};\n", "echo \"umi_tools dedup -I $f -S $out &\";\n", "#umi_tools dedup -I $f -S $out &\n", "done" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:33:55.460620Z", "start_time": "2023-05-20T16:33:55.353828Z" }, "collapsed": false }, "outputs": [], "source": [ "%%bash\n", "for f in bam/*.hsa-miR.srt.dd.bam; do\n", "samtools index $f &\n", "done" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:39:03.632496Z", "start_time": "2023-05-20T16:39:02.067991Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bam/A2508.hsa-miR.srt.dd.bam\n", "bam/A375.hsa-miR.srt.dd.bam\n", "bam/A549.hsa-miR.srt.dd.bam\n", "bam/BxPC3.hsa-miR.srt.dd.bam\n", "bam/C42Bu.hsa-miR.srt.dd.bam\n", "bam/Colo320.hsa-miR.srt.dd.bam\n", "bam/H1299.hsa-miR.srt.dd.bam\n", "bam/H23u.hsa-miR.srt.dd.bam\n", "bam/H358u.hsa-miR.srt.dd.bam\n", "bam/HCC44.hsa-miR.srt.dd.bam\n", "bam/HCT116.hsa-miR.srt.dd.bam\n", "bam/HEK293T-16.hsa-miR.srt.dd.bam\n", "bam/HEK293T-1.hsa-miR.srt.dd.bam\n", "bam/HEK293T-26.hsa-miR.srt.dd.bam\n", "bam/HEK293T-9.hsa-miR.srt.dd.bam\n", "bam/HEPG2.hsa-miR.srt.dd.bam\n", "bam/HS707A.hsa-miR.srt.dd.bam\n", "bam/K562.hsa-miR.srt.dd.bam\n", "bam/LNCaP.hsa-miR.srt.dd.bam\n", "bam/LS174T.hsa-miR.srt.dd.bam\n", "bam/MCF7.hsa-miR.srt.dd.bam\n", "bam/MDA231.hsa-miR.srt.dd.bam\n", "bam/MDA453.hsa-miR.srt.dd.bam\n", "bam/PACA2.hsa-miR.srt.dd.bam\n", "bam/PANC1.hsa-miR.srt.dd.bam\n", "bam/PC3.hsa-miR.srt.dd.bam\n", "bam/SW480u.hsa-miR.srt.dd.bam\n", "bam/SW620u.hsa-miR.srt.dd.bam\n", "bam/ZR751.hsa-miR.srt.dd.bam\n" ] } ], "source": [ "%%bash\n", "for f in bam/*.hsa-miR.srt.dd.bam; do\n", "out=${f/.srt.dd.bam/.cnt};\n", "out=`basename $out`\n", "echo $f\n", "samtools view $f | cut -f3 | sort | uniq -c | awk '{ print $2 \"\\t\" $1}' > count/$out\n", "done" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:39:27.678503Z", "start_time": "2023-05-20T16:39:24.308743Z" }, "collapsed": false }, "outputs": [], "source": [ "import rpy2.ipython\n", "%load_ext rpy2.ipython\n", "import warnings\n", "from rpy2.rinterface import RRuntimeWarning\n", "warnings.filterwarnings(\"ignore\", category=RRuntimeWarning)" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:42:10.187793Z", "start_time": "2023-05-20T16:42:09.845743Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " A2508 A375 A549 BxPC3 C42Bu Colo320 H1299 H23u H358u HCC44\n", "hsa-let-7a-2-3p 1 9 1 0 0 0 0 0 0 0\n", "hsa-let-7a-3p 30 65 29 32 66 36 13 10 13 31\n", "hsa-let-7a-5p 838 843 929 894 1108 892 692 541 773 936\n", "hsa-let-7b-3p 13 12 13 22 131 22 2 5 6 39\n", "hsa-let-7b-5p 282 195 511 306 833 521 36 71 172 643\n", "hsa-let-7c-5p 69 11 86 4 685 85 3 4 2 5\n", " HCT116 HEK293T.1 HEK293T.16 HEK293T.26 HEK293T.9 HEPG2 HS707A\n", "hsa-let-7a-2-3p 1 0 0 0 0 0 6\n", "hsa-let-7a-3p 56 10 4 9 11 4 33\n", "hsa-let-7a-5p 897 277 228 404 272 257 975\n", "hsa-let-7b-3p 30 0 0 0 1 2 53\n", "hsa-let-7b-5p 321 11 10 11 10 13 657\n", "hsa-let-7c-5p 2 17 24 19 20 1 72\n", " K562 LNCaP LS174T MCF7 MDA231 MDA453 PACA2 PANC1 PC3 SW480u\n", "hsa-let-7a-2-3p 0 0 0 0 2 0 0 1 1 0\n", "hsa-let-7a-3p 1 59 33 13 11 109 19 27 17 29\n", "hsa-let-7a-5p 169 1113 753 755 1074 1205 768 838 983 789\n", "hsa-let-7b-3p 1 47 64 4 10 65 16 23 9 27\n", "hsa-let-7b-5p 9 822 435 211 261 906 221 361 475 498\n", "hsa-let-7c-5p 2 966 4 91 3 34 5 6 0 2\n", " SW620u ZR751\n", "hsa-let-7a-2-3p 1 0\n", "hsa-let-7a-3p 21 18\n", "hsa-let-7a-5p 736 786\n", "hsa-let-7b-3p 18 14\n", "hsa-let-7b-5p 453 300\n", "hsa-let-7c-5p 5 46\n" ] } ], "source": [ "%%R\n", "files<-list.files(pattern=\".hsa-miR.cnt\", recursive=TRUE, full.names=TRUE)\n", "datalist = lapply(files, function(x){read.table(file=x,header=FALSE,col.names=c(\"miRNA\", sub(\"./count/(\\\\S+).hsa-miR.cnt\", \"\\\\1\", x)))})\n", "m <- Reduce(function(...) merge(..., by=1, all = TRUE), datalist)\n", "rownames(m) <- m[,1]\n", "m[is.na(m)] <- 0\n", "m <- m[,-1]\n", "head(m)" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:43:34.724737Z", "start_time": "2023-05-20T16:43:22.580119Z" }, "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "R[write to console]: Loading required package: S4Vectors\n", "\n", "R[write to console]: Loading required package: stats4\n", "\n", "R[write to console]: Loading required package: BiocGenerics\n", "\n", "R[write to console]: Loading required package: parallel\n", "\n", "R[write to console]: \n", "Attaching package: ‘BiocGenerics’\n", "\n", "\n", "R[write to console]: The following objects are masked from ‘package:parallel’:\n", "\n", " clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,\n", " clusterExport, clusterMap, parApply, parCapply, parLapply,\n", " parLapplyLB, parRapply, parSapply, parSapplyLB\n", "\n", "\n", "R[write to console]: The following objects are masked from ‘package:stats’:\n", "\n", " IQR, mad, sd, var, xtabs\n", "\n", "\n", "R[write to console]: The following objects are masked from ‘package:base’:\n", "\n", " anyDuplicated, append, as.data.frame, basename, cbind, colnames,\n", " dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,\n", " grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,\n", " order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,\n", " rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,\n", " union, unique, unsplit, which, which.max, which.min\n", "\n", "\n", "R[write to console]: \n", "Attaching package: ‘S4Vectors’\n", "\n", "\n", "R[write to console]: The following object is masked from ‘package:base’:\n", "\n", " expand.grid\n", "\n", "\n", "R[write to console]: Loading required package: IRanges\n", "\n", "R[write to console]: Loading required package: GenomicRanges\n", "\n", "R[write to console]: Loading required package: GenomeInfoDb\n", "\n", "R[write to console]: Loading required package: SummarizedExperiment\n", "\n", "R[write to console]: Loading required package: Biobase\n", "\n", "R[write to console]: Welcome to Bioconductor\n", "\n", " Vignettes contain introductory material; view with\n", " 'browseVignettes()'. To cite Bioconductor, see\n", " 'citation(\"Biobase\")', and for packages 'citation(\"pkgname\")'.\n", "\n", "\n", "R[write to console]: Loading required package: DelayedArray\n", "\n", "R[write to console]: Loading required package: matrixStats\n", "\n", "R[write to console]: \n", "Attaching package: ‘matrixStats’\n", "\n", "\n", "R[write to console]: The following objects are masked from ‘package:Biobase’:\n", "\n", " anyMissing, rowMedians\n", "\n", "\n", "R[write to console]: Loading required package: BiocParallel\n", "\n", "R[write to console]: \n", "Attaching package: ‘DelayedArray’\n", "\n", "\n", "R[write to console]: The following objects are masked from ‘package:matrixStats’:\n", "\n", " colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges\n", "\n", "\n", "R[write to console]: The following objects are masked from ‘package:base’:\n", "\n", " aperm, apply, rowsum\n", "\n", "\n", "R[write to console]: converting counts to integer mode\n", "\n" ] } ], "source": [ "%%R\n", "library(DESeq2)\n", "colData <- data.frame(cond=colnames(m), row.names=colnames(m))\n", "dds <- DESeqDataSetFromMatrix(countData = m, colData=colData, design = ~ cond)" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "ExecuteTime": { "end_time": "2023-05-20T16:43:52.052339Z", "start_time": "2023-05-20T16:43:51.814855Z" }, "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " A2508 A375 A549 BxPC3 C42Bu Colo320 H1299 \n", " 1.0888061 1.2424944 1.0869263 1.0162428 1.0632169 1.6634946 1.0384271 \n", " H23u H358u HCC44 HCT116 HEK293T.1 HEK293T.16 HEK293T.26 \n", " 1.2745386 0.9586256 1.4011483 0.7453279 0.8418885 1.0259433 0.7463888 \n", " HEK293T.9 HEPG2 HS707A K562 LNCaP LS174T MCF7 \n", " 0.8957911 1.1909768 0.9530245 0.9804775 0.8729802 1.6712495 1.5413835 \n", " MDA231 MDA453 PACA2 PANC1 PC3 SW480u SW620u \n", " 1.0963836 1.4634479 1.0580141 1.0480069 0.8270327 1.0059966 1.1430368 \n", " ZR751 \n", " 1.0876778 \n" ] } ], "source": [ "%%R\n", "dds <- estimateSizeFactors(dds)\n", "sf <- sizeFactors(dds)\n", "ncu <- counts(dds, normalized=TRUE)\n", "write.table(m, file=\"miRNA_counts.txt\", sep=\"\\t\", quote=FALSE, col.names=NA )\n", "write.table(ncu, file=\"miRNA_norm-counts.txt\", sep=\"\\t\", quote=FALSE, col.names=NA )\n", "sf" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }