<commit_before>{
 "metadata": {
  "name": "",
  "signature": "sha256:9056f6a355030e263b2bc9abc1c1c01be716742dd5ba911094ad93d4edbc3f7d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "import pysam"
     ]
    },
    {
     "cell_type": "raw",
     "metadata": {},
     "source": [
      "samfile = pysam.Samfile(\"test.sam\", mode=\"w\", referencelengths=[100], referencenames=[\"testchr\"])\n",
      "read = pysam.AlignedRead()\n",
      "read.seq = \"AAAAAAAAAA\"\n",
      "read.pos = 2"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#This code executes manual unit testing of the sequtil by Ali."
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Creating sequence to later create reads.\n",
      "sequence = (\n",
      "\"AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC\"\n",
      "\"TTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAATACTTTAACCAA\"\n",
      "\"TATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACC\"\n",
      "\"ATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGACGCGTACAGGAAACACAGAAAAAAG\"\n",
      "\"CCCGCACCTGACAGTGCGGGCTTTTTTTTTCGACCAAAGGTAACGAGGTAACAACCATGCGAGTGTTGAA\"\n",
      "\"GTTCGGCGGTACATCAGTGGCAAATGCAGAACGTTTTCTGCGTGTTGCCGATATTCTGGAAAGCAATGCC\"\n",
      "\"AGGCAGGGGCAGGTGGCCACCGTCCTCTCTGCCCCCGCCAAAATCACCAACCACCTGGTGGCGATGATTG\"\n",
      "\"AAAAAACCATTAGCGGCCAGGATGCTTTACCCAATATCAGCGATGCCGAACGTATTTTTGCCGAACTTTT\"\n",
      "\"GACGGGACTCGCCGCCGCCCAGCCGGGGTTCCCGCTGGCGCAATTGAAAACTTTCGTCGATCAGGAATTT\"\n",
      "\"GCCCAAATAAAACATGTCCTGCATGGCATTAGTTTGTTGGGGCAGTGCCCGGATAGCATCAACGCTGCGC\"\n",
      ")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 23
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "len(sequence)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 2,
       "text": [
        "700"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Ouput to see what \"reversed( sequence )\" looks like.\n",
      "#for i in reversed( sequence ):\n",
      "#    print i"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Used in establishing values for the reverse strand of 'sequence'.\n",
      "def reverse_complement(seq):\n",
      "    matches = {\"A\": \"T\", \"T\": \"A\", \"G\": \"C\", \"C\": \"G\"}\n",
      "    return \"\".join(matches[i] for i in reversed(seq))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Creates output fastq file. Inserts into output file 10 sequences that are 35 bases long from the original sequence.\n",
      "#Each sequence is a shift to the RIGHT by 1 of the previous sequence.\n",
      "#'+' is an optional line. Not used here.\n",
      "#The character '!' represents the lowest quality while '~' is the highest. Here are the quality value characters in left-to-right increasing order of quality\n",
      "#This essentially creates 3'-> 5' reads of 1 strand.\n",
      "with open(\"test_SE_plus.fastq\", \"w\") as outfile:\n",
      "    for i in range(10):\n",
      "        outfile.write(\"@TEST_%d\\n\" % i)\n",
      "        outfile.write(sequence[i + 20:i + 55] + \"\\n\")\n",
      "        outfile.write(\"+\\n\")\n",
      "        outfile.write(\"~\" * 35 + \"\\n\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Creates output fastq file. reverse_complement() is used. The same type of file as that above is created, though with the\n",
      "#difference that it's created on the reverse compliment of the original sequence.\n",
      "#This essentially creates 3'-> 5' reads of the reverse strand in relation to the reads created above.\n",
      "with open(\"test_SE_minus.fastq\", \"w\") as outfile:\n",
      "    rev = reverse_complement(sequence)\n",
      "    for i in range(10):\n",
      "        outfile.write(\"@TEST_%d\\n\" % i)\n",
      "        outfile.write(rev[i + 20:i + 55] + \"\\n\")\n",
      "        outfile.write(\"+\\n\")\n",
      "        outfile.write(\"~\" * 35 + \"\\n\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Aligning reads created above.\n",
      "#We can execute paired reads because we have reads from the reverse strand, which can therefore be translated to the 5' end\n",
      "# of the initial strand established with 'sequence'.\n",
      "\n",
      "#Aligning short sequence \"plus\" file created above with wild type.\n",
      "!bowtie2 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" test_SE_plus.fastq -S test_SE_plus.sam\n",
      "\n",
      "#Aligning short sequence \"minus\" file created above with wild type.\n",
      "!bowtie2 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" test_SE_minus.fastq -S test_SE_minus.sam\n",
      "\n",
      "#Aligning paired-end reads \"plus\" and \"minus\" files created above with wild type.\n",
      "# -x indicates the basename of the index for the reference genome, which is in our case NC_000913_2\n",
      "#\n",
      "# 1000 is the argument \"<bt2-idx>\" within bowtie2 documentation. Probably shifting of start index within NC_000913_2 wild type reference genome.\n",
      "#\n",
      "# Paired-end sequencing enables both ends of the DNA fragment to be sequenced. Because the distance between each paired read\n",
      "# known, alignment algorithms can use this information to map the reads over repetitive regions more precisely.\n",
      "# This results in much better alignment of the reads, especially across difficult-to-sequence, repetitive regiosn of the\n",
      "# genome.\n",
      "!bowtie2 -X 1000 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" -1 test_SE_plus.fastq -2 test_SE_minus.fastq -S test_PE.sam\n",
      "\n",
      "#Aligning paired-end reads \"plus\" and \"minus\" files in the reverse order from the previous above command with wild type.\n",
      "!bowtie2 -X 1000 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" -2 test_SE_plus.fastq -1 test_SE_minus.fastq -S test_PE_rev.sam"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were unpaired; of these:\r\n",
        "    0 (0.00%) aligned 0 times\r\n",
        "    10 (100.00%) aligned exactly 1 time\r\n",
        "    0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were unpaired; of these:\r\n",
        "    0 (0.00%) aligned 0 times\r\n",
        "    10 (100.00%) aligned exactly 1 time\r\n",
        "    0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were paired; of these:\r\n",
        "    0 (0.00%) aligned concordantly 0 times\r\n",
        "    10 (100.00%) aligned concordantly exactly 1 time\r\n",
        "    0 (0.00%) aligned concordantly >1 times\r\n",
        "    ----\r\n",
        "    0 pairs aligned concordantly 0 times; of these:\r\n",
        "      0 (0.00%) aligned discordantly 1 time\r\n",
        "    ----\r\n",
        "    0 pairs aligned 0 times concordantly or discordantly; of these:\r\n",
        "      0 mates make up the pairs; of these:\r\n",
        "        0 (0.00%) aligned 0 times\r\n",
        "        0 (0.00%) aligned exactly 1 time\r\n",
        "        0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were paired; of these:\r\n",
        "    0 (0.00%) aligned concordantly 0 times\r\n",
        "    10 (100.00%) aligned concordantly exactly 1 time\r\n",
        "    0 (0.00%) aligned concordantly >1 times\r\n",
        "    ----\r\n",
        "    0 pairs aligned concordantly 0 times; of these:\r\n",
        "      0 (0.00%) aligned discordantly 1 time\r\n",
        "    ----\r\n",
        "    0 pairs aligned 0 times concordantly or discordantly; of these:\r\n",
        "      0 mates make up the pairs; of these:\r\n",
        "        0 (0.00%) aligned 0 times\r\n",
        "        0 (0.00%) aligned exactly 1 time\r\n",
        "        0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!samtools view -bS test_SE_plus.sam  > test_SE_plus.bam\n",
      "!samtools view -bS test_SE_minus.sam  > test_SE_minus.bam\n",
      "!samtools view -bS test_PE.sam  > test_PE.bam\n",
      "!samtools view -bS test_PE_rev.sam  > test_PE_rev.bam"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!samtools sort test_SE_plus.bam test_SE_plus_sorted\n",
      "!samtools sort test_SE_minus.bam test_SE_minus_sorted\n",
      "!samtools sort test_PE.bam test_PE_sorted\n",
      "!samtools sort test_PE_rev.bam test_PE_rev_sorted"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 8
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sequtil import makegff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 9
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "makegff.write_samfile_to_gff(\"test_SE_plus.bam\", \"test_SE_plus.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_SE_plus.bam\", \"test_SE_plus_5.gff\", five_prime=True)\n",
      "makegff.write_samfile_to_gff(\"test_SE_minus.bam\", \"test_SE_minus.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_SE_minus.bam\", \"test_SE_minus_5.gff\", five_prime=True)\n",
      "makegff.write_samfile_to_gff(\"test_PE.bam\", \"test_PE.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_PE.bam\", \"test_PE_5.gff\", five_prime=True)\n",
      "makegff.write_samfile_to_gff(\"test_PE_rev.bam\", \"test_PE_rev.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_PE_rev.bam\", \"test_PE_rev_5.gff\", five_prime=True)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stderr",
       "text": [
        "/home/pphaneuf/sequtil/sequtil/makegff.py:99: UserWarning: 5' only data should not have been processed as Paired-end.\n",
        "  warn(\"5' only data should not have been processed as Paired-end.\")\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Values starting @ 21 are index of start of reads (reads created started at 20 and ended at 55).\n",
      "#Values starting @ 1 are the number of reads (depth?) for this position.\n",
      "#'-' indicates forward strand.\n",
      "\n",
      "#Test: Test the start index of the read, the score and the direction of the read for single read.\n",
      "\n",
      "!cat test_SE_plus.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t21\t21\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t22\t22\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t23\t23\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t24\t24\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t25\t25\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t26\t26\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t27\t27\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t28\t28\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t29\t29\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t30\t30\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t31\t31\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t32\t32\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t33\t33\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t34\t34\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t35\t35\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t36\t36\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t37\t37\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t38\t38\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t39\t39\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t40\t40\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t41\t41\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t42\t42\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t43\t43\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t44\t44\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t45\t45\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t46\t46\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t47\t47\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t48\t48\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t49\t49\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t50\t50\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t51\t51\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t52\t52\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t53\t53\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t54\t54\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t55\t55\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t56\t56\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t57\t57\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t58\t58\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t59\t59\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t60\t60\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t61\t61\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t62\t62\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t63\t63\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t64\t64\t1\t+\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!cat test_SE_plus_5.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t21\t21\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t22\t22\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t23\t23\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t24\t24\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t25\t25\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t26\t26\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t27\t27\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t28\t28\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t29\t29\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t30\t30\t1\t+\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Values starting @ 637 are index of start of reads (created from forward reads started at 20 and ended at 55).\n",
      "#Values starting @ -1 are the number of reads (depth?) for this position. ???Why negative value?\n",
      "#'-' indicates backward strand.\n",
      "\n",
      "#Test: Test the start index of the read, the score and the direction of the read for single read.\n",
      "\n",
      "!cat test_SE_minus.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t637\t637\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t638\t638\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t639\t639\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t640\t640\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t641\t641\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t642\t642\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t643\t643\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t644\t644\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t645\t645\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t646\t646\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t647\t647\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t648\t648\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t649\t649\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t650\t650\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t651\t651\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t652\t652\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t653\t653\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t654\t654\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t655\t655\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t656\t656\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t657\t657\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t658\t658\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t659\t659\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t660\t660\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t661\t661\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t662\t662\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t663\t663\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t664\t664\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t665\t665\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t666\t666\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t667\t667\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t668\t668\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t669\t669\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t670\t670\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t671\t671\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t672\t672\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t673\t673\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t674\t674\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t675\t675\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t676\t676\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t677\t677\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t678\t678\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t679\t679\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t680\t680\t-1\t-\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Test: Test the start index of the read, the score and the direction of the read for paired-end read.\n",
      "\n",
      "!cat test_PE.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t21\t21\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t22\t22\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t23\t23\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t24\t24\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t25\t25\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t26\t26\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t27\t27\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t28\t28\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t29\t29\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t30\t30\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t31\t31\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t32\t32\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t33\t33\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t34\t34\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t35\t35\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t36\t36\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t37\t37\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t38\t38\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t39\t39\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t40\t40\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t41\t41\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t42\t42\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t43\t43\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t44\t44\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t45\t45\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t46\t46\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t47\t47\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t48\t48\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t49\t49\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t50\t50\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t51\t51\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t52\t52\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t53\t53\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t54\t54\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t55\t55\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t56\t56\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t57\t57\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t58\t58\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t59\t59\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t60\t60\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t61\t61\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t62\t62\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t63\t63\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t64\t64\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t637\t637\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t638\t638\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t639\t639\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t640\t640\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t641\t641\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t642\t642\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t643\t643\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t644\t644\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t645\t645\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t646\t646\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t647\t647\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t648\t648\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t649\t649\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t650\t650\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t651\t651\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t652\t652\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t653\t653\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t654\t654\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t655\t655\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t656\t656\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t657\t657\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t658\t658\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t659\t659\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t660\t660\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t661\t661\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t662\t662\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t663\t663\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t664\t664\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t665\t665\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t666\t666\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t667\t667\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t668\t668\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t669\t669\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t670\t670\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t671\t671\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t672\t672\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t673\t673\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t674\t674\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t675\t675\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t676\t676\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t677\t677\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t678\t678\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t679\t679\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t680\t680\t1\t+\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Test: Test the start index of the read, the score and the direction of the read for paired-end read.\n",
      "\n",
      "!cat test_PE_rev.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t21\t21\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t22\t22\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t23\t23\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t24\t24\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t25\t25\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t26\t26\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t27\t27\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t28\t28\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t29\t29\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t30\t30\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t31\t31\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t32\t32\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t33\t33\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t34\t34\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t35\t35\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t36\t36\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t37\t37\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t38\t38\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t39\t39\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t40\t40\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t41\t41\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t42\t42\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t43\t43\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t44\t44\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t45\t45\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t46\t46\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t47\t47\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t48\t48\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t49\t49\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t50\t50\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t51\t51\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t52\t52\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t53\t53\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t54\t54\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t55\t55\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t56\t56\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t57\t57\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t58\t58\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t59\t59\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t60\t60\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t61\t61\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t62\t62\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t63\t63\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t64\t64\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t637\t637\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t638\t638\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t639\t639\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t640\t640\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t641\t641\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t642\t642\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t643\t643\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t644\t644\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t645\t645\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t646\t646\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t647\t647\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t648\t648\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t649\t649\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t650\t650\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t651\t651\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t652\t652\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t653\t653\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t654\t654\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t655\t655\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t656\t656\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t657\t657\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t658\t658\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t659\t659\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t660\t660\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t661\t661\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t662\t662\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t663\t663\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t664\t664\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t665\t665\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t666\t666\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t667\t667\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t668\t668\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t669\t669\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t670\t670\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t671\t671\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t672\t672\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t673\t673\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t674\t674\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t675\t675\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t676\t676\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t677\t677\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t678\t678\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t679\t679\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t680\t680\t-1\t-\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!cat test_PE_5.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t21\t21\t1\t+\t.\t.\r\n",<commit_msg>added comments on compairing output between Ali's SAM file execute and my BAM file execution. These comments are the results of the testing Ali had asked for me to execute.<commit_after>{
 "metadata": {
  "name": "",
  "signature": "sha256:514f8df8cecf368538f54a4a24de29be6669404031c43e29322425f06cbab901"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "import pysam"
     ]
    },
    {
     "cell_type": "raw",
     "metadata": {},
     "source": [
      "samfile = pysam.Samfile(\"test.sam\", mode=\"w\", referencelengths=[100], referencenames=[\"testchr\"])\n",
      "read = pysam.AlignedRead()\n",
      "read.seq = \"AAAAAAAAAA\"\n",
      "read.pos = 2"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#This code executes manual unit testing of the sequtil by Ali."
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Creating sequence to later create reads.\n",
      "sequence = (\n",
      "\"AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC\"\n",
      "\"TTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAATACTTTAACCAA\"\n",
      "\"TATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACC\"\n",
      "\"ATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGACGCGTACAGGAAACACAGAAAAAAG\"\n",
      "\"CCCGCACCTGACAGTGCGGGCTTTTTTTTTCGACCAAAGGTAACGAGGTAACAACCATGCGAGTGTTGAA\"\n",
      "\"GTTCGGCGGTACATCAGTGGCAAATGCAGAACGTTTTCTGCGTGTTGCCGATATTCTGGAAAGCAATGCC\"\n",
      "\"AGGCAGGGGCAGGTGGCCACCGTCCTCTCTGCCCCCGCCAAAATCACCAACCACCTGGTGGCGATGATTG\"\n",
      "\"AAAAAACCATTAGCGGCCAGGATGCTTTACCCAATATCAGCGATGCCGAACGTATTTTTGCCGAACTTTT\"\n",
      "\"GACGGGACTCGCCGCCGCCCAGCCGGGGTTCCCGCTGGCGCAATTGAAAACTTTCGTCGATCAGGAATTT\"\n",
      "\"GCCCAAATAAAACATGTCCTGCATGGCATTAGTTTGTTGGGGCAGTGCCCGGATAGCATCAACGCTGCGC\"\n",
      ")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 23
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "len(sequence)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 2,
       "text": [
        "700"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Ouput to see what \"reversed( sequence )\" looks like.\n",
      "#for i in reversed( sequence ):\n",
      "#    print i"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Used in establishing values for the reverse strand of 'sequence'.\n",
      "def reverse_complement(seq):\n",
      "    matches = {\"A\": \"T\", \"T\": \"A\", \"G\": \"C\", \"C\": \"G\"}\n",
      "    return \"\".join(matches[i] for i in reversed(seq))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Creates output fastq file. Inserts into output file 10 sequences that are 35 bases long from the original sequence.\n",
      "#Each sequence is a shift to the RIGHT by 1 of the previous sequence.\n",
      "#'+' is an optional line. Not used here.\n",
      "#The character '!' represents the lowest quality while '~' is the highest. Here are the quality value characters in left-to-right increasing order of quality\n",
      "\n",
      "#This essentially creates 3'-> 5' reads of 1 strand.\n",
      "with open(\"test_SE_plus.fastq\", \"w\") as outfile:\n",
      "    for i in range(10):\n",
      "        outfile.write(\"@TEST_%d\\n\" % i)\n",
      "        outfile.write(sequence[i + 20:i + 55] + \"\\n\")\n",
      "        outfile.write(\"+\\n\")\n",
      "        outfile.write(\"~\" * 35 + \"\\n\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Creates output fastq file. reverse_complement() is used. The same type of file as that above is created, though with the\n",
      "#difference that it's created on the reverse compliment of the original sequence.\n",
      "\n",
      "#This essentially creates 3'-> 5' reads of the reverse strand in relation to the reads created above.\n",
      "with open(\"test_SE_minus.fastq\", \"w\") as outfile:\n",
      "    rev = reverse_complement(sequence)\n",
      "    for i in range(10):\n",
      "        outfile.write(\"@TEST_%d\\n\" % i)\n",
      "        outfile.write(rev[i + 20:i + 55] + \"\\n\")\n",
      "        outfile.write(\"+\\n\")\n",
      "        outfile.write(\"~\" * 35 + \"\\n\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Aligning reads created above.\n",
      "#We can execute paired reads because we have reads from the reverse strand, which can therefore be translated to the 5' end\n",
      "# of the initial strand established with 'sequence'.\n",
      "\n",
      "#Aligning short sequence \"plus\" file created above with wild type.\n",
      "!bowtie2 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" test_SE_plus.fastq -S test_SE_plus.sam\n",
      "\n",
      "#Aligning short sequence \"minus\" file created above with wild type.\n",
      "!bowtie2 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" test_SE_minus.fastq -S test_SE_minus.sam\n",
      "\n",
      "#Aligning paired-end reads \"plus\" and \"minus\" files created above with wild type.\n",
      "# -x indicates the basename of the index for the reference genome, which is in our case NC_000913_2\n",
      "#\n",
      "# 1000 is the argument \"<bt2-idx>\" within bowtie2 documentation. Probably shifting of start index within NC_000913_2 wild type reference genome.\n",
      "#\n",
      "# Paired-end sequencing enables both ends of the DNA fragment to be sequenced. Because the distance between each paired read\n",
      "# known, alignment algorithms can use this information to map the reads over repetitive regions more precisely.\n",
      "# This results in much better alignment of the reads, especially across difficult-to-sequence, repetitive regiosn of the\n",
      "# genome.\n",
      "!bowtie2 -X 1000 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" -1 test_SE_plus.fastq -2 test_SE_minus.fastq -S test_PE.sam\n",
      "\n",
      "#Aligning paired-end reads \"plus\" and \"minus\" files in the reverse order from the previous above command with wild type.\n",
      "!bowtie2 -X 1000 \"/home/pphaneuf/sequencing/NC_000913_2/NC_000913_2\" -2 test_SE_plus.fastq -1 test_SE_minus.fastq -S test_PE_rev.sam"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were unpaired; of these:\r\n",
        "    0 (0.00%) aligned 0 times\r\n",
        "    10 (100.00%) aligned exactly 1 time\r\n",
        "    0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were unpaired; of these:\r\n",
        "    0 (0.00%) aligned 0 times\r\n",
        "    10 (100.00%) aligned exactly 1 time\r\n",
        "    0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were paired; of these:\r\n",
        "    0 (0.00%) aligned concordantly 0 times\r\n",
        "    10 (100.00%) aligned concordantly exactly 1 time\r\n",
        "    0 (0.00%) aligned concordantly >1 times\r\n",
        "    ----\r\n",
        "    0 pairs aligned concordantly 0 times; of these:\r\n",
        "      0 (0.00%) aligned discordantly 1 time\r\n",
        "    ----\r\n",
        "    0 pairs aligned 0 times concordantly or discordantly; of these:\r\n",
        "      0 mates make up the pairs; of these:\r\n",
        "        0 (0.00%) aligned 0 times\r\n",
        "        0 (0.00%) aligned exactly 1 time\r\n",
        "        0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10 reads; of these:\r\n",
        "  10 (100.00%) were paired; of these:\r\n",
        "    0 (0.00%) aligned concordantly 0 times\r\n",
        "    10 (100.00%) aligned concordantly exactly 1 time\r\n",
        "    0 (0.00%) aligned concordantly >1 times\r\n",
        "    ----\r\n",
        "    0 pairs aligned concordantly 0 times; of these:\r\n",
        "      0 (0.00%) aligned discordantly 1 time\r\n",
        "    ----\r\n",
        "    0 pairs aligned 0 times concordantly or discordantly; of these:\r\n",
        "      0 mates make up the pairs; of these:\r\n",
        "        0 (0.00%) aligned 0 times\r\n",
        "        0 (0.00%) aligned exactly 1 time\r\n",
        "        0 (0.00%) aligned >1 times\r\n",
        "100.00% overall alignment rate\r\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!samtools view -bS test_SE_plus.sam  > test_SE_plus.bam\n",
      "!samtools view -bS test_SE_minus.sam  > test_SE_minus.bam\n",
      "!samtools view -bS test_PE.sam  > test_PE.bam\n",
      "!samtools view -bS test_PE_rev.sam  > test_PE_rev.bam"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[samopen] SAM header is present: 1 sequences.\r\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!samtools sort test_SE_plus.bam test_SE_plus_sorted\n",
      "!samtools sort test_SE_minus.bam test_SE_minus_sorted\n",
      "!samtools sort test_PE.bam test_PE_sorted\n",
      "!samtools sort test_PE_rev.bam test_PE_rev_sorted"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sequtil import makegff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "makegff.write_samfile_to_gff(\"test_SE_plus.bam\", \"test_SE_plus.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_SE_plus.bam\", \"test_SE_plus_5.gff\", five_prime=True)\n",
      "makegff.write_samfile_to_gff(\"test_SE_minus.bam\", \"test_SE_minus.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_SE_minus.bam\", \"test_SE_minus_5.gff\", five_prime=True)\n",
      "makegff.write_samfile_to_gff(\"test_PE.bam\", \"test_PE.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_PE.bam\", \"test_PE_5.gff\", five_prime=True)\n",
      "makegff.write_samfile_to_gff(\"test_PE_rev.bam\", \"test_PE_rev.gff\")\n",
      "makegff.write_samfile_to_gff(\"test_PE_rev.bam\", \"test_PE_rev_5.gff\", five_prime=True)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stderr",
       "text": [
        "/home/pphaneuf/sequtil/sequtil/makegff.py:99: UserWarning: 5' only data should not have been processed as Paired-end.\n",
        "  warn(\"5' only data should not have been processed as Paired-end.\")\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Values starting @ 21 are index of start of reads (reads created started at 20 and ended at 55).\n",
      "#Values starting @ 1 are the number of reads (depth?) for this position.\n",
      "#'-' indicates forward strand.\n",
      "\n",
      "#Test: Test the start index of the read, the score and the direction of the read for single read.\n",
      "\n",
      "#This output is the same as that created by Ali's with SAM files rather than BAM files.\n",
      "\n",
      "!cat test_SE_plus.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t21\t21\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t22\t22\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t23\t23\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t24\t24\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t25\t25\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t26\t26\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t27\t27\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t28\t28\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t29\t29\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t30\t30\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t31\t31\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t32\t32\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t33\t33\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t34\t34\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t35\t35\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t36\t36\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t37\t37\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t38\t38\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t39\t39\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t40\t40\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t41\t41\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t42\t42\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t43\t43\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t44\t44\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t45\t45\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t46\t46\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t47\t47\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t48\t48\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t49\t49\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t50\t50\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t51\t51\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t52\t52\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t53\t53\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t54\t54\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t55\t55\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t56\t56\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t57\t57\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t58\t58\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t59\t59\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t60\t60\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t61\t61\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t62\t62\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t63\t63\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t64\t64\t1\t+\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!cat test_SE_plus_5.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t21\t21\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t22\t22\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t23\t23\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t24\t24\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t25\t25\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t26\t26\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t27\t27\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t28\t28\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t29\t29\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_plus.bam\t30\t30\t1\t+\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Values starting @ 637 are index of start of reads (created from forward reads started at 20 and ended at 55).\n",
      "#Values starting @ -1 are the number of reads (depth?) for this position. ???Why negative value?\n",
      "#'-' indicates backward strand.\n",
      "\n",
      "#Test: Test the start index of the read, the score and the direction of the read for single read.\n",
      "\n",
      "#This output is the same as that created by Ali's with SAM files rather than BAM files.\n",
      "\n",
      "!cat test_SE_minus.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t637\t637\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t638\t638\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t639\t639\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t640\t640\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t641\t641\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t642\t642\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t643\t643\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t644\t644\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t645\t645\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t646\t646\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t647\t647\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t648\t648\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t649\t649\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t650\t650\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t651\t651\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t652\t652\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t653\t653\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t654\t654\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t655\t655\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t656\t656\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t657\t657\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t658\t658\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t659\t659\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t660\t660\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t661\t661\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t662\t662\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t663\t663\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t664\t664\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t665\t665\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t666\t666\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t667\t667\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t668\t668\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t669\t669\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t670\t670\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t671\t671\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t672\t672\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t673\t673\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t674\t674\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t675\t675\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t676\t676\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t677\t677\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t678\t678\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t679\t679\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_SE_minus.bam\t680\t680\t-1\t-\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Test: Test the start index of the read, the score and the direction of the read for paired-end read.\n",
      "\n",
      "#This output is the same as that created by Ali's with SAM files rather than BAM files.\n",
      "\n",
      "!cat test_PE.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t21\t21\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t22\t22\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t23\t23\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t24\t24\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t25\t25\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t26\t26\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t27\t27\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t28\t28\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t29\t29\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t30\t30\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t31\t31\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t32\t32\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t33\t33\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t34\t34\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t35\t35\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t36\t36\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t37\t37\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t38\t38\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t39\t39\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t40\t40\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t41\t41\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t42\t42\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t43\t43\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t44\t44\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t45\t45\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t46\t46\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t47\t47\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t48\t48\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t49\t49\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t50\t50\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t51\t51\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t52\t52\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t53\t53\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t54\t54\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t55\t55\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t56\t56\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t57\t57\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t58\t58\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t59\t59\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t60\t60\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t61\t61\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t62\t62\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t63\t63\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t64\t64\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t637\t637\t1\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t638\t638\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t639\t639\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t640\t640\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t641\t641\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t642\t642\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t643\t643\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t644\t644\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t645\t645\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t646\t646\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t647\t647\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t648\t648\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t649\t649\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t650\t650\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t651\t651\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t652\t652\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t653\t653\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t654\t654\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t655\t655\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t656\t656\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t657\t657\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t658\t658\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t659\t659\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t660\t660\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t661\t661\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t662\t662\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t663\t663\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t664\t664\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t665\t665\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t666\t666\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t667\t667\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t668\t668\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t669\t669\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t670\t670\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t671\t671\t10\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t672\t672\t9\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t673\t673\t8\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t674\t674\t7\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t675\t675\t6\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t676\t676\t5\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t677\t677\t4\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t678\t678\t3\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t679\t679\t2\t+\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t680\t680\t1\t+\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Test: Test the start index of the read, the score and the direction of the read for paired-end read.\n",
      "\n",
      "#This output is the same as that created by Ali's with SAM files rather than BAM files.\n",
      "\n",
      "!cat test_PE_rev.gff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t21\t21\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t22\t22\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t23\t23\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t24\t24\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t25\t25\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t26\t26\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t27\t27\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t28\t28\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t29\t29\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t30\t30\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t31\t31\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t32\t32\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t33\t33\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t34\t34\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t35\t35\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t36\t36\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t37\t37\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t38\t38\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t39\t39\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t40\t40\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t41\t41\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t42\t42\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t43\t43\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t44\t44\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t45\t45\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t46\t46\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t47\t47\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t48\t48\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t49\t49\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t50\t50\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t51\t51\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t52\t52\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t53\t53\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t54\t54\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t55\t55\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t56\t56\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t57\t57\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t58\t58\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t59\t59\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t60\t60\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t61\t61\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t62\t62\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t63\t63\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t64\t64\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t637\t637\t-1\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t638\t638\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t639\t639\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t640\t640\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t641\t641\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t642\t642\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t643\t643\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t644\t644\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t645\t645\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t646\t646\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t647\t647\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t648\t648\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t649\t649\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t650\t650\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t651\t651\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t652\t652\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t653\t653\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t654\t654\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t655\t655\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t656\t656\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t657\t657\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t658\t658\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t659\t659\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t660\t660\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t661\t661\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t662\t662\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t663\t663\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t664\t664\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t665\t665\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t666\t666\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t667\t667\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t668\t668\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t669\t669\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t670\t670\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t671\t671\t-10\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t672\t672\t-9\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t673\t673\t-8\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t674\t674\t-7\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t675\t675\t-6\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t676\t676\t-5\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t677\t677\t-4\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t678\t678\t-3\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t679\t679\t-2\t-\t.\t.\r\n",
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE_rev.bam\t680\t680\t-1\t-\t.\t.\r\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!cat test_PE_5.gff\n",
      "\n",
      "#This output is the same as that created by Ali's with SAM files rather than BAM files."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gi|49175990|ref|NC_000913.2|\t\ttest_PE.bam\t21\t21\t1\t+\t.\t.\r\n",
{'fraction_non_alphanumeric': 0.226608956987452, 'fraction_numerical': 0.16239195489397773, 'mean_word_length': 2.3473195477408537, 'pattern_counts': {'":': 380, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1863106', 'n_tokens_mistral': 45346, 'n_tokens_neox': 37779, 'n_words': 3170}