Repository 'ribo_tools'
hg clone https://toolshed.g2.bx.psu.edu/repos/rlegendre/ribo_tools

Changeset 0:01b945ba3697 (2017-09-27)
Commit message:
Uploaded
added:
ribo_tools/get_codon_frequency.py
ribo_tools/get_codon_frequency.xml
ribo_tools/kmer_analysis.py
ribo_tools/kmer_analysis.xml
ribo_tools/lightbox/README.markdown
ribo_tools/lightbox/css/lightbox.css
ribo_tools/lightbox/css/screen.css
ribo_tools/lightbox/img/close.png
ribo_tools/lightbox/img/demopage/donate.png
ribo_tools/lightbox/img/demopage/favicon.ico
ribo_tools/lightbox/img/demopage/image-1.jpg
ribo_tools/lightbox/img/demopage/image-2.jpg
ribo_tools/lightbox/img/demopage/image-3.jpg
ribo_tools/lightbox/img/demopage/image-4.jpg
ribo_tools/lightbox/img/demopage/image-5.jpg
ribo_tools/lightbox/img/demopage/image-6.jpg
ribo_tools/lightbox/img/demopage/thumb-1.jpg
ribo_tools/lightbox/img/demopage/thumb-2.jpg
ribo_tools/lightbox/img/demopage/thumb-3.jpg
ribo_tools/lightbox/img/demopage/thumb-4.jpg
ribo_tools/lightbox/img/demopage/thumb-5.jpg
ribo_tools/lightbox/img/demopage/thumb-6.jpg
ribo_tools/lightbox/img/loading.gif
ribo_tools/lightbox/img/next.png
ribo_tools/lightbox/img/prev.png
ribo_tools/lightbox/index.html
ribo_tools/lightbox/js/jquery-1.10.2.min.js
ribo_tools/lightbox/js/lightbox-2.6.min.js
ribo_tools/lightbox/js/modernizr.custom.js
ribo_tools/lightbox/js/stupidtable.js
ribo_tools/lightbox/js/stupidtable.min.js
ribo_tools/metagene_frameshift_analysis.py
ribo_tools/metagene_frameshift_analysis.xml
ribo_tools/metagene_readthrough.py
ribo_tools/metagene_readthrough.xml
ribo_tools/ribo_functions.py
ribo_tools/ribo_functions.pyc
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/get_codon_frequency.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/get_codon_frequency.py Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,736 @@\n+#!/usr/bin/env python2.7\n+# -*- coding: utf-8 -*-\n+\n+\'\'\'\n+    Created on sep. 2013\n+    @author: rachel legendre\n+    @copyright: rachel.legendre@igmors.u-psud.fr\n+    @license: GPL v3\n+\'\'\'\n+\n+from __future__ import division\n+import os, sys, optparse, tempfile, subprocess, re, shutil, commands, urllib, time\n+import itertools\n+from math import log10\n+from decimal import Decimal\n+from Bio import SeqIO\n+from Bio.Seq import Seq\n+from numpy import arange, std, array, linspace, average\n+#from matplotlib import pyplot as pl\n+import matplotlib\n+matplotlib.use(\'Agg\')\n+import matplotlib.pyplot as pl\n+from matplotlib import font_manager\n+from matplotlib import colors\n+import csv\n+from scipy import stats, errstate\n+from collections import OrderedDict\n+import ribo_functions\n+import HTSeq\n+# #libraries for debugg\n+#import pdb\n+import cPickle\n+\n+def stop_err(msg):\n+    sys.stderr.write("%s\\n" % msg)\n+    sys.stderr.write("Programme aborted at %s\\n" % time.asctime(time.localtime(time.time())))\n+    sys.exit()\n+\n+\n+def init_codon_dict():\n+    \n+    Codon_dict = OrderedDict([(\'AAA\', 0), (\'AAC\', 0), (\'AAG\', 0), (\'AAT\', 0), (\'ACA\', 0), (\'ACC\', 0), (\'ACG\', 0), (\'ACT\', 0), (\'AGA\', 0), (\'AGC\', 0), (\'AGG\', 0), (\'AGT\', 0), (\'ATA\', 0), (\'ATC\', 0), (\'ATG\', 0), (\'ATT\', 0), (\'CAA\', 0), (\'CAC\', 0), (\'CAG\', 0), (\'CAT\', 0), (\'CCA\', 0), (\'CCC\', 0), (\'CCG\', 0), (\'CCT\', 0), (\'CGA\', 0), (\'CGC\', 0), (\'CGG\', 0), (\'CGT\', 0), (\'CTA\', 0), (\'CTC\', 0), (\'CTG\', 0), (\'CTT\', 0), (\'GAA\', 0), (\'GAC\', 0), (\'GAG\', 0), (\'GAT\', 0), (\'GCA\', 0), (\'GCC\', 0), (\'GCG\', 0), (\'GCT\', 0), (\'GGA\', 0), (\'GGC\', 0), (\'GGG\', 0), (\'GGT\', 0), (\'GTA\', 0), (\'GTC\', 0), (\'GTG\', 0), (\'GTT\', 0), (\'TAA\', 0), (\'TAC\', 0), (\'TAG\', 0), (\'TAT\', 0), (\'TCA\', 0), (\'TCC\', 0), (\'TCG\', 0), (\'TCT\', 0), (\'TGA\', 0), (\'TGC\', 0), (\'TGG\', 0), (\'TGT\', 0), (\'TTA\', 0), (\'TTC\', 0), (\'TTG\', 0), (\'TTT\', 0)])\n+    return Codon_dict\n+\n+\n+\n+def get_codon_usage(bamfile, GFF, site, kmer, a_pos):\n+    \'\'\'\n+        Read GFF dict and get gene codon usage.\n+        Return dict of codons usage\n+    \'\'\'\n+    try:\n+        codon = init_codon_dict()\n+        multi_tag = "XS:i:" ## bowtie Tag\n+        tag = "IH:i:1" ## RUM tag\n+        \n+        for feature in GFF :\n+            if feature.type == \'gene\' :\n+                codon_dict = init_codon_dict()\n+                chrom = feature.iv.chrom\n+                start = feature.iv.start\n+                stop = feature.iv.end \n+                if start+50 < stop-50 :                \n+                    region = chrom + \':\' + str(start+50) + \'-\' + str(stop-50)\n+                    # #get all reads in this gene\n+                    reads = subprocess.check_output(["samtools", "view", bamfile, region])\n+                    head = subprocess.check_output(["samtools", "view", "-H", bamfile])\n+                    read_tab = reads.split(\'\\n\')        \n+                    for read in read_tab:\n+                        # # search mapper for eliminate multiple alignements\n+                        if \'bowtie\' in head:\n+                            multi_tag = "XS:i:"\n+                        elif \'bwa\' in  head:\n+                            multi_tag = "XT:A:R"\n+                        elif \'TopHat\' in  head:\n+                            tag = "NH:i:1"\n+                        else :\n+                            stop_err("No PG tag find in "+samfile+". Please use bowtie, bwa or Tophat for mapping")  \n+    \n+                        if len(read) == 0:\n+                            continue\n+                        len_read = len(read.split(\'\\t\')[9])        \n+                        # if it\'s read of good length\n+                        if len_read == kmer and (tag in read or multi_tag not in read):\n+                            feat = read.split(\'\\t\')\n+                            seq = feat[9]\n+                            # if it\'s a reverse read\n+                            if feat[1] == \'16\' :\n+                                if site == "A" :\n+                                # #get '..b'   \n+    parser.add_option("-s", "--site", dest="site", type="string",  default = "A" ,\n+                  help="Script can compute in site A, P or E (default is A-site)", metavar="A|P|E")      \n+\n+    parser.add_option("-r", "--rep", dest="rep", type="string", default = "no" ,\n+                  help="if replicate or not", metavar="yes|no")   \n+     \n+    parser.add_option("-x", "--hex_col1", dest="color1", type= "string",  default = "SkyBlue" ,\n+                  help="Color for first condition", metavar="STR")\n+    \n+    parser.add_option("-X", "--hex_col2", dest="color2", type= "string",  default = "Plum" ,\n+                  help="Color for second condition", metavar="STR")\n+\n+    parser.add_option("-q", "--quiet",\n+                  action="store_false", dest="verbose", default=True,\n+                  help="don\'t print status messages to stdout")\n+\n+    (options, args) = parser.parse_args()\n+    print "Begin codon frequency analysis at", time.asctime(time.localtime(time.time()))\n+\n+    try:\n+        authorized_site = ["A", "P", "E"]\n+        if options.site not in authorized_site :\n+            stop_err(options.site + \' is not a authorized ribosome site\')\n+        \n+        ## Check if colors exist\n+        if not colors.is_color_like(options.color1) :\n+            stop_err( options.color1+\' is not a proper color\' )\n+        if not colors.is_color_like(options.color2) :\n+            stop_err( options.color2+\' is not a proper color\' )\n+        \n+        \n+        #### NOT USE IN FINAL VERSION\n+        # # get codon list\n+        # codons = options.list_cod.upper().split(\',\')\n+        # check_codons_list(codons)\n+        GFF = HTSeq.GFF_Reader(options.gff)\n+        # # get html file and directory :\n+        (html, html_dir) = options.dirout.split(\',\')\n+        if not os.path.exists(html_dir):\n+            try:\n+                os.mkdir(html_dir)\n+            except Exception, e :\n+                stop_err(\'Error running make directory : \' + str(e)) \n+        # #RUN analysis\n+        # #If there are replicats\n+        if options.rep == "yes" :\n+            result = []\n+            # split name of each file options by ","\n+            cond1 = options.file1.split(\',\')\n+            cond2 = options.file2.split(\',\')\n+            # # calcul for each file\n+            for fh in itertools.chain(cond1, cond2):\n+                check_index_bam (fh)\n+                result.append(get_codon_usage(fh, GFF, options.site, options.kmer, options.asite))\n+            (cond1, cond2, chi_pval) = plot_codon_usage(result, html_dir, options.c1, options.c2, options.outfile,options.color1, options.color2)\n+            # t_pval = compute_FC_plot(cond1,cond2,codons,html_dir)\n+            plot_fc (cond1, cond2, options.site, html_dir)\n+                \n+        # #If there are no replicat\n+        elif options.rep == "no" :\n+            result = []\n+            # #calcul for each cond\n+            for fh in (options.file1, options.file2):\n+                check_index_bam (fh)\n+                result.append(get_codon_usage(fh, GFF, options.site, options.kmer,options.asite))\n+            (cond1, cond2, chi_pval) = plot_codon_usage(result, html_dir, options.c1, options.c2, options.outfile,options.color1, options.color2)\n+\n+            # t_pval = compute_FC_plot(cond1,cond2,codons,html_dir)\n+            plot_fc (cond1, cond2, options.site, html_dir)    \n+        else :\n+            sys.stderr.write("Please enter yes or no for --rep option. Programme aborted at %s" % time.asctime(time.localtime(time.time())))\n+            sys.exit()\n+   \n+        # write_html_file(html,chi_pval,t_pval,codons,options.c1, options.c2)\n+        write_html_file(html, chi_pval, options.c1, options.c2)\n+            \n+        print "Finish codon frequency analysis at", time.asctime(time.localtime(time.time()))        \n+    except Exception, e:\n+        stop_err(\'Error running codon frequency analysis (main program) : \' + str(e))\n+    \n+\n+if __name__=="__main__":\n+    __main__()\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/get_codon_frequency.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/get_codon_frequency.xml Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,101 @@
+<tool id="Codon_analysis" name="Codon_density">
+ <description>To compare Ribo-seq alignments between two sets of conditions, to determine codon occupancy</description>
+ <requirements>
+     <requirement type="package">samtools</requirement>
+     <requirement type="python-module">matplotlib</requirement>
+     <requirement type="python-module">numpy</requirement>
+     <requirement type="python-module">scipy</requirement>
+     <requirement type="python-module">Bio</requirement>
+ </requirements>
+ <command interpreter="python"> 
+ get_codon_frequency.py
+ --gff=$annot
+ --rep=$replicat_opt['rep']
+ --cond1 $cond1
+ --cond2 $cond2
+ --kmer=$kmer
+ --asite=$asite
+ --out $out
+ --site $site
+ --hex_col1 $color1
+ --hex_col2 $color2
+ --dirout $html_file,$html_file.files_path
+ #if str( $replicat_opt['rep'] ) == 'yes':
+ --file1=$file1,$file11
+ --file2=$file2,$file22
+ #else
+ --file1=$file1
+ --file2=$file2
+ #end if
+
+        
+ </command>
+
+ <inputs>
+ <param name="annot" type="data" label="Reference annotation file (GFF)" format="gff" />
+ <conditional name="replicat_opt">
+ <param name="rep" type="select" label="Replicate option">
+ <option value="yes">Yes (only two replicates by condition)</option>
+ <option value="no">No</option>
+ </param>
+ <when value="yes">
+ ## Use conditional balise : if rep =yes : 4 files, else 2 files 
+ <param name="file1" type="data" label="First replicate of first condition (Bam file)" format="bam" />
+ <param name="file11" type="data" label="Second replicate of first condition (Bam file)" format="bam" />
+ <param name="file2" type="data" label="First replicate of second condition (Bam file)" format="bam" />
+ <param name="file22" type="data" label="First replicate of second condition (Bam file)" format="bam" />
+ </when>
+ <when value="no">
+ <param name="file1" type="data" label="First Bam file" format="bam" />
+ <param name="file2" type="data" label="Second Bam File" format="bam" />
+ </when>
+ </conditional>
+ <param name="site" type="select" label="Please choose a ribosomal site for codon analysis">
+ <option value="A">A</option>
+ <option value="P">P</option>
+ <option value="E">E</option>
+ </param>
+ <param name="asite" type="integer" label="Off-set from the 5'end of the footprint to the A-site" value ="15"  />
+ <param name="kmer" type="integer" label="Lenght of the best phasing footprints" value ="28"  />
+ <param name="cond1" type="text" size="25" label="Condition one" help="Required even if no replicate" value="cond1"/>
+ <param name="cond2" type="text" size="25" label="Condition two" help="Required even if no replicate" value="cond2"/>
+ <param name="color1" type="text" size="50" label="Color for first condition" value ="SkyBlue" help="Enter standard name, hex color string, or rgb code. You can find all colors here : http://pythonhosted.org/ete2/reference/reference_svgcolors.html" />
+ <param name="color2" type="text" size="50" label="Color for second condition" value ="Plum" help="Enter standard name, hex color string, or rgb code. You can find all colors here : http://pythonhosted.org/ete2/reference/reference_svgcolors.html" />
+
+ </inputs>
+
+ <outputs>
+ <data format="csv" name="out" label="Codon analysis output file on ${on_string}"/>
+ <data format="html" name="html_file" label="Codon analysis results on ${on_string}"/>
+
+ </outputs>
+
+ <help>
+
+Summary
+-------   
+This tool uses Ribo-seq (BAM file) to determine whether codon occupancy differs between two sets of conditions. For each footprint, the codons at the chosen site are recorded and a histogram displaying all the normalised codon numbers is plotted for both sets of conditions. A second histogram groups together all the codons corresponding to a given amino acid. A chi-squared test is then carried out to determine whether the distribution of the codons used is the same in both sets of conditions.
+
+
+Output 
+------- 
+This tool provides an html file containing graphs and a statistical test result. An additional csv file with codon numbers is provided. 
+
+
+Dependances
+------------
+
+.. class:: warningmark
+
+This tool depends on Python (>=2.7) and following packages : numpy 1.8.0, Biopython 1.58, scipy 0.12.0 and matplotlib 1.3.1. Samtools is used for bam manipulation.
+
+
+
+
+
+
+
+
+
+ </help>
+</tool>
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/kmer_analysis.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/kmer_analysis.py Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,464 @@\n+#!/usr/bin/env python2.7.3\n+#-*- coding: utf-8 -*-\n+\'\'\'\n+    Created on Jun. 2014\n+    @author: rachel legendre\n+    @copyright: rachel.legendre@igmors.u-psud.fr\n+    @license: GPL v3\n+\'\'\'\n+\n+import os, sys, time, optparse, re, urllib, subprocess, tempfile, commands\n+import pysam\n+#from matplotlib import pyplot as pl\n+import matplotlib\n+matplotlib.use(\'Agg\')\n+import matplotlib.pyplot as pl\n+from numpy import arange\n+from collections import OrderedDict\n+import ribo_functions\n+#import cPickle\n+## suppress matplotlib warnings\n+import warnings\n+warnings.filterwarnings(\'ignore\')\n+\n+\n+total_mapped_read = 0 \n+\n+\n+def stop_err( msg ):\n+    sys.stderr.write( "%s\\n" % msg )\n+    sys.stderr.write( "Programme aborted at %s\\n" % time.asctime( time.localtime( time.time() ) ) )\n+    sys.exit()\n+    \n+    \n+def split_bam(bamfile,tmpdir):\n+    \'\'\'\n+        split bam by chromosome and write sam file in tmpdir\n+    \'\'\'\n+    try:\n+        #get header\n+        results = subprocess.check_output([\'samtools\', \'view\', \'-H\',bamfile])\n+        header = results.split(\'\\n\')\n+       \n+        #define genome size\n+        genome = []\n+        for line in header:\n+            result = re.search(\'SN\', line)\n+            if result :\n+                #print line    \n+                feat = line.split(\'\\t\')\n+                chrom = re.split(":", feat[1])\n+                #print feat[1]\n+                genome.append(chrom[1])\n+       \n+        #split sam by chrom\n+        n = 0\n+        for chrm in genome:\n+            with open(tmpdir+\'/\'+chrm+\'.sam\', \'w\') as f : \n+                #write header correctly for each chromosome\n+                f.write(header[0]+\'\\n\')\n+                expr = re.compile(chrm+\'\\t\')\n+                el =[elem for elem in header if expr.search(elem)][0]\n+                f.write(el+\'\\n\')            \n+                f.write(header[-2]+\'\\n\')\n+                #write all reads for each chromosome\n+                reads = subprocess.check_output(["samtools", "view", bamfile, chrm])\n+                f.write(reads)\n+                # calculate number of reads \n+                n += reads.count(chrm)\n+\n+        sys.stdout.write("%d reads are presents in your bam file\\n" % n)\n+    \n+    except Exception, e:\n+        stop_err( \'Error during bam file splitting : \' + str( e ) )\n+        \n+\n+       \n+def get_first_base(tmpdir, kmer): \n+    \'\'\'\n+        write footprint coverage file for each sam file in tmpdir and get kmer distribution\n+    \'\'\'\n+    global total_mapped_read\n+    \n+    ## tags by default\n+    multi_tag = "XS:i:"\n+    tag = "IH:i:1"\n+    \n+    ## init kmer dict\n+    KMER = OrderedDict({})\n+    \n+    try:\n+        file_array = (commands.getoutput(\'ls \'+tmpdir)).split(\'\\n\')\n+        ##write coverage for each sam file in tmpdir\n+        for samfile in file_array:\n+            with open(tmpdir+\'/\'+samfile, \'r\') as sam : \n+                ##get chromosome name\n+                chrom = samfile.split(".sam")[0]\n+        \n+                for line in sam:\n+                    #initialize dictionnary\n+                    if \'@SQ\\tSN:\' in line :\n+                        size = int(line.split(\'LN:\')[1])\n+                        genomeF = [0]*size\n+                        genomeR = [0]*size\n+                    # define multiple reads keys from mapper\n+                    elif \'@PG\\tID\' in line :\n+                        if \'bowtie\' in line:\n+                            multi_tag = "XS:i:"\n+                        elif \'bwa\' in  line:\n+                            multi_tag = "XT:A:R"\n+                        elif \'TopHat\' in  line:\n+                            tag = "NH:i:1"\n+                        else :\n+                            stop_err("No PG tag find in "+samfile+". Please use bowtie, bwa or Tophat for mapping")  \n+                        \n+                    # get footprint\n+                    elif re.search(\'^[^@].+\', line) :\n+                        len_read = len(line.split(\'\\t\')[9])\n+                        ##f'..b'er and phasing analysis at %s\\n" % time.asctime( time.localtime( time.time() ) ) )\n+\n+    try:\n+        \n+        if not os.path.exists(options.dirout):\n+            try:\n+                os.mkdir(options.dirout)\n+            except Exception, e :\n+                stop_err(\'Error running make directory : \' + str(e)) \n+        \n+        ##testing indexed bam file\n+        if os.path.isfile(options.bamfile+".bai") :\n+            pass\n+        else :\n+            cmd = "samtools index %s " % (options.bamfile)\n+            proc = subprocess.Popen( args=cmd, shell=True, stderr = subprocess.PIPE)\n+            returncode = proc.wait()\n+        \n+        tmpdir = tempfile.mkdtemp()\n+        ## identify GFF or GTF format from 9th column\n+        with open (options.gff,"r") as gffile :\n+            for line in gffile :\n+                if \'#\' in line :\n+                    ## skip header\n+                    gffile.next()\n+                elif \'gene_id\' in line :\n+                    ## launch gtf reader :\n+                    GFF = ribo_functions.store_gtf(options.gff)\n+                    break\n+                elif \'ID=\' in line :\n+                    ## launch gff reader \n+                    GFF = ribo_functions.store_gff(options.gff)\n+                    break\n+                else :\n+                    stop_err( \'Please check your annotation file is in correct format, GFF or GTF\' )\n+        #GFF = store_gff(options.gff)\n+        #GFF = ribo_functions.store_gtf(options.gff)\n+        ## check gff reading\n+        if not GFF[\'order\'] :\n+            stop_err( \'Incorrect GFF file\' )\n+        for gene in GFF[\'order\']:\n+            if not GFF[gene][\'exon\'] :\n+                del GFF[gene]\n+                GFF[\'order\'].remove(gene)  \n+        ## split bam\n+        split_bam(options.bamfile,tmpdir)\n+        ###################################\n+        ## First analysis with 28mer :\n+        ###################################\n+        ## compute coverage and distribution kmer\n+        kmer = get_first_base(tmpdir, 28)\n+        ## compute phasing\n+        whole_phasing = frame_analysis(tmpdir,GFF)\n+        ## save phasing\n+        results = {}\n+        results[28] = whole_phasing \n+        ## compute analysis with other kmer\n+        for keys in kmer.iterkeys() :\n+            if keys != 28 :\n+ \n+                ## If not enought reads in this kmer :\n+                if kmer[keys] > 100 :\n+                    ## remove all txt files in tmp directory\n+                    if os.system("rm "+tmpdir+"/*.txt") != 0 :\n+                        stop_err( \'Error during tmp directory cleaning\')\n+                    ## compute coverage and distribution kmer\n+                    tmp = get_first_base(tmpdir, keys)\n+                    ## compute phasing\n+                    whole_phasing = frame_analysis(tmpdir,GFF)\n+\n+                    results[keys] = whole_phasing\n+                 ## get report\n+        make_report(options.html_file, options.dirout, kmer, results)\n+        #=======================================================================\n+        # ############\n+        # #  tests\n+        # ############\n+        #  with open("kmer_dict",\'rb\') as km:\n+        #          kmer = cPickle.load(km)\n+        #  with open("results_dict",\'rb\') as res:\n+        #          results = cPickle.load(res)\n+        #  with open("kmer_dict",\'wb\') as km:\n+        #          cPickle.dump(kmer,km)  \n+        #  with open("results_dict",\'wb\') as res:\n+        #          cPickle.dump(results,res)  \n+        # make_report(options.html_file, options.dirout, kmer, results)\n+        #=======================================================================\n+        \n+        sys.stdout.write("Finish kmer and phasing analysis at %s\\n" % time.asctime( time.localtime( time.time() ) ) )\n+    \n+    except Exception, e:\n+        stop_err( \'Error running kmer and phasing analysis : \' + str( e ) )\n+    \n+\n+if __name__=="__main__":\n+    __main__()\n\\ No newline at end of file\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/kmer_analysis.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/kmer_analysis.xml Wed Sep 27 04:59:10 2017 -0400
b
@@ -0,0 +1,46 @@
+<tool id="kmer_analysis" name="Kmer">
+ <description>To calculate the proportion and phasing of each kmer</description>
+ <requirements>
+ <requirement type="package">samtools</requirement>
+     <requirement type="package">numpy</requirement>
+        <requirement type="package">matplotlib</requirement>
+        <requirement type="package">pysam</requirement>
+ </requirements>
+ <command interpreter="python"> 
+ kmer_analysis.py --gff $gff --bam $bamfile --dirout $output.files_path --out $output

+ </command>
+
+ <inputs>
+ <param name="gff" type="data" label="Reference annotation file (GFF))" format="gff" />
+ <param name="bamfile" type="data" label="Bam file" format="bam" />
+ </inputs>
+
+ <outputs>
+ <data format="html" name="output" label="Kmer report on ${on_string}"/>
+
+ </outputs>
+
+ <help>
+
+Summary
+-------
+The kmer tool computes the distribution of footprints length from Bam file and determines the proportion of footprints beginning in each frame, for all annotated genes in the `GFF3`_ file.
+
+
+.. _GFF3: http://gmod.org/wiki/GFF3
+
+Output 
+------- 
+This tool provides an html report detailing the proportions and phasing of the kmers. 
+
+
+Dependances
+------------
+
+.. class:: warningmark
+
+This tool depends on Python (>=2.7) and following packages : numpy 1.8.0 and matplotlib 1.3.1. Samtools and pysam are used for bam manipulation.
+
+ </help>
+</tool>
\ No newline at end of file
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/README.markdown
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/README.markdown Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,15 @@
+## Lightbox2
+by Lokesh Dhakar | [lokeshdhakar.com](http://www.lokeshdhakar.com) | [twitter.com/lokesh](http://twitter.com/lokesh)
+
+### Information and support
+For examples, downloads, and information on using Lightbox, visit the Lightbox2 homepage:
+[http://lokeshdhakar.com/projects/lightbox2/](http://lokeshdhakar.com/projects/lightbox2/)
+
+For personal support issues and feature requests, visit the Lightbox forums:
+[http://lokeshdhakar.com/forums/](http://lokeshdhakar.com/forums/)
+
+### License
+Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
+
+* Free for use in both personal and commercial projects.
+* Attribution requires leaving author name, author homepage link, and the license info intact.
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/css/lightbox.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/css/lightbox.css Wed Sep 27 04:59:10 2017 -0400
b
@@ -0,0 +1,202 @@
+/* line 7, ../sass/lightbox.sass */
+body:after {
+  content: url(../img/close.png) url(../img/loading.gif) url(../img/prev.png) url(../img/next.png);
+  display: none;
+}
+
+/* line 11, ../sass/lightbox.sass */
+.lightboxOverlay {
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 9999;
+  background-color: black;
+  filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
+  opacity: 0.8;
+  display: none;
+}
+
+/* line 20, ../sass/lightbox.sass */
+.lightbox {
+  position: absolute;
+  left: 0;
+  width: 100%;
+  z-index: 10000;
+  text-align: center;
+  line-height: 0;
+  font-weight: normal;
+}
+/* line 28, ../sass/lightbox.sass */
+.lightbox .lb-image {
+  display: block;
+  height: auto;
+  -webkit-border-radius: 3px;
+  -moz-border-radius: 3px;
+  -ms-border-radius: 3px;
+  -o-border-radius: 3px;
+  border-radius: 3px;
+}
+/* line 32, ../sass/lightbox.sass */
+.lightbox a img {
+  border: none;
+}
+
+/* line 35, ../sass/lightbox.sass */
+.lb-outerContainer {
+  position: relative;
+  background-color: white;
+  *zoom: 1;
+  width: 250px;
+  height: 250px;
+  margin: 0 auto;
+  -webkit-border-radius: 4px;
+  -moz-border-radius: 4px;
+  -ms-border-radius: 4px;
+  -o-border-radius: 4px;
+  border-radius: 4px;
+}
+/* line 38, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
+.lb-outerContainer:after {
+  content: "";
+  display: table;
+  clear: both;
+}
+
+/* line 44, ../sass/lightbox.sass */
+.lb-container {
+  padding: 4px;
+}
+
+/* line 47, ../sass/lightbox.sass */
+.lb-loader {
+  position: absolute;
+  top: 43%;
+  left: 0%;
+  height: 25%;
+  width: 100%;
+  text-align: center;
+  line-height: 0;
+}
+
+/* line 56, ../sass/lightbox.sass */
+.lb-cancel {
+  display: block;
+  width: 32px;
+  height: 32px;
+  margin: 0 auto;
+  background: url(../img/loading.gif) no-repeat;
+}
+
+/* line 63, ../sass/lightbox.sass */
+.lb-nav {
+  position: absolute;
+  top: 0;
+  left: 0;
+  height: 100%;
+  width: 100%;
+  z-index: 10;
+}
+
+/* line 71, ../sass/lightbox.sass */
+.lb-container > .nav {
+  left: 0;
+}
+
+/* line 74, ../sass/lightbox.sass */
+.lb-nav a {
+  outline: none;
+}
+
+/* line 77, ../sass/lightbox.sass */
+.lb-prev, .lb-next {
+  width: 49%;
+  height: 100%;
+  cursor: pointer;
+  /* Trick IE into showing hover */
+  display: block;
+}
+
+/* line 84, ../sass/lightbox.sass */
+.lb-prev {
+  left: 0;
+  float: left;
+}
+/* line 87, ../sass/lightbox.sass */
+.lb-prev:hover {
+  background: url(../img/prev.png) left 48% no-repeat;
+}
+
+/* line 90, ../sass/lightbox.sass */
+.lb-next {
+  right: 0;
+  float: right;
+}
+/* line 93, ../sass/lightbox.sass */
+.lb-next:hover {
+  background: url(../img/next.png) right 48% no-repeat;
+}
+
+/* line 96, ../sass/lightbox.sass */
+.lb-dataContainer {
+  margin: 0 auto;
+  padding-top: 5px;
+  *zoom: 1;
+  width: 100%;
+  -moz-border-radius-bottomleft: 4px;
+  -webkit-border-bottom-left-radius: 4px;
+  border-bottom-left-radius: 4px;
+  -moz-border-radius-bottomright: 4px;
+  -webkit-border-bottom-right-radius: 4px;
+  border-bottom-right-radius: 4px;
+}
+/* line 38, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
+.lb-dataContainer:after {
+  content: "";
+  display: table;
+  clear: both;
+}
+
+/* line 103, ../sass/lightbox.sass */
+.lb-data {
+  padding: 0 4px;
+  color: #bbbbbb;
+}
+/* line 106, ../sass/lightbox.sass */
+.lb-data .lb-details {
+  width: 85%;
+  float: left;
+  text-align: left;
+  line-height: 1.1em;
+}
+/* line 111, ../sass/lightbox.sass */
+.lb-data .lb-caption {
+  font-size: 13px;
+  font-weight: bold;
+  line-height: 1em;
+}
+/* line 115, ../sass/lightbox.sass */
+.lb-data .lb-number {
+  display: block;
+  clear: left;
+  padding-bottom: 1em;
+  font-size: 12px;
+  color: #999999;
+}
+/* line 121, ../sass/lightbox.sass */
+.lb-data .lb-close {
+  display: block;
+  float: right;
+  width: 30px;
+  height: 30px;
+  background: url(../img/close.png) top right no-repeat;
+  text-align: right;
+  outline: none;
+  filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
+  opacity: 0.7;
+}
+/* line 130, ../sass/lightbox.sass */
+.lb-data .lb-close:hover {
+  cursor: pointer;
+  filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
+  opacity: 1;
+}
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/css/screen.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/css/screen.css Wed Sep 27 04:59:10 2017 -0400
b
b'@@ -0,0 +1,522 @@\n+/* line 17, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+html, body, div, span, applet, object, iframe,\n+h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n+a, abbr, acronym, address, big, cite, code,\n+del, dfn, em, img, ins, kbd, q, s, samp,\n+small, strike, strong, sub, sup, tt, var,\n+b, u, i, center,\n+dl, dt, dd, ol, ul, li,\n+fieldset, form, label, legend,\n+table, caption, tbody, tfoot, thead, tr, th, td,\n+article, aside, canvas, details, embed,\n+figure, figcaption, footer, header, hgroup,\n+menu, nav, output, ruby, section, summary,\n+time, mark, audio, video {\n+  margin: 0;\n+  padding: 0;\n+  border: 0;\n+  font: inherit;\n+  font-size: 100%;\n+  vertical-align: baseline;\n+}\n+\n+/* line 22, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+html {\n+  line-height: 1;\n+}\n+\n+/* line 24, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+ol, ul {\n+  list-style: none;\n+}\n+\n+/* line 26, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+table {\n+  border-collapse: collapse;\n+  border-spacing: 0;\n+}\n+\n+/* line 28, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+caption, th, td {\n+  text-align: left;\n+  font-weight: normal;\n+  vertical-align: middle;\n+}\n+\n+/* line 30, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+q, blockquote {\n+  quotes: none;\n+}\n+/* line 103, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+q:before, q:after, blockquote:before, blockquote:after {\n+  content: "";\n+  content: none;\n+}\n+\n+/* line 32, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+a img {\n+  border: none;\n+}\n+\n+/* line 116, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */\n+article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {\n+  display: block;\n+}\n+\n+/* Typography\n+ *----------------------------------------------- */\n+/* line 10, ../sass/screen.sass */\n+body,\n+input,\n+textarea {\n+  color: #cccccc;\n+  font-size: 18px;\n+  font-family: "Karla", "lucida grande", sans-serif;\n+}\n+\n+/* line 17, ../sass/screen.sass */\n+h1,\n+h2,\n+h3,\n+h4,\n+h5,\n+h6 {\n+  line-height: 1.2em;\n+  color: #fdf485;\n+}\n+\n+/* line 26, ../sass/screen.sass */\n+h1 {\n+  font-size: 72px;\n+  line-height: 1em;\n+}\n+\n+/* line 30, ../sass/screen.sass */\n+h2 {\n+  font-size: 48px;\n+  line-height: 1.2em;\n+  margin-bottom: 0.3em;\n+}\n+\n+/* line 35, ../sass/screen.sass */\n+h3 {\n+  font-size: 18px;\n+  text-transform: uppercase;\n+  letter-spacing: 0.1em;\n+  color: #e5d404;\n+  margin-bottom: 0.3em;\n+}\n+\n+/* line 42, ../sass/screen.sass */\n+h4 {\n+  font-size: 18px;\n+}\n+\n+/* line 45, ../sass/screen.sass */\n+p {\n+  line-height: 1.4em;\n+  margin-bottom: 1em;\n+}\n+\n+/* line 49, ../sass/screen.sass */\n+ol {\n+  list-style-type: decimal;\n+}\n+\n+/* line 52, ../sass/screen.sass */\n+ul, ol {\n+  margin: 0 0 1.25em 0;\n+}\n+\n+/* line 55, ../sass/screen.sass */\n+li {\n+  padding-bottom: 0.8em;\n+  margin-bottom: 0.8em;\n+  border-bottom: 2px solid #515151;\n+  line-height: 1.3em;\n+}\n+/* line 60, ../sass/screen.sass */\n+li.last-list-item {\n+  border-bottom: none;\n+}\n+\n+/* line 63, ../sass/screen.sass */\n+dt {\n+  font-weight: bold;\n+}\n+\n+/* line 66, ../sass/screen.sass */\n+dd {\n+  margin-bottom: 1.625em;\n+}\n+\n+/* line 69, ../sass/screen.sass */\n+strong {\n+  font-weight: bold;\n+}\n+\n+/* line 72, ../sass/screen.sass */\n+i {\n+  font-style: italic;\n+}\n+\n+/* line 75, ../sass/screen.sass */\n+pre {\n+  padding: 10px;\n+  margin-t'..b' {\n+  content: "";\n+  display: table;\n+  clear: both;\n+}\n+\n+/* line 184, ../sass/screen.sass */\n+.example-image-link {\n+  display: inline-block;\n+  margin: 0 10px 20px 10px;\n+  line-height: 0;\n+  -webkit-border-radius: 4px;\n+  -moz-border-radius: 4px;\n+  -ms-border-radius: 4px;\n+  -o-border-radius: 4px;\n+  border-radius: 4px;\n+  border: 4px solid #5e5e5e;\n+  -webkit-transition: all 0.1s ease-out;\n+  -moz-transition: all 0.1s ease-out;\n+  -o-transition: all 0.1s ease-out;\n+  transition: all 0.1s ease-out;\n+}\n+/* line 191, ../sass/screen.sass */\n+.example-image-link:hover {\n+  border: 4px solid #00bfa8;\n+}\n+\n+/* line 194, ../sass/screen.sass */\n+.example-image {\n+  -webkit-border-radius: 2px;\n+  -moz-border-radius: 2px;\n+  -ms-border-radius: 2px;\n+  -o-border-radius: 2px;\n+  border-radius: 2px;\n+}\n+\n+/* -- Download -- */\n+/* line 199, ../sass/screen.sass */\n+.download-section {\n+  text-align: center;\n+}\n+\n+/* line 202, ../sass/screen.sass */\n+.download-button {\n+  display: block;\n+  max-width: 300px;\n+  margin: 0 auto 20px auto;\n+  padding-top: 20px;\n+  padding-bottom: 10px;\n+  background-color: #2b2b2b;\n+  border: 4px solid #444444;\n+  -webkit-border-radius: 4px;\n+  -moz-border-radius: 4px;\n+  -ms-border-radius: 4px;\n+  -o-border-radius: 4px;\n+  border-radius: 4px;\n+  -webkit-transition: all 0.1s ease-out;\n+  -moz-transition: all 0.1s ease-out;\n+  -o-transition: all 0.1s ease-out;\n+  transition: all 0.1s ease-out;\n+  *zoom: 1;\n+}\n+/* line 38, ../../../../.rvm/gems/ruby-1.9.3-p392/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */\n+.download-button:after {\n+  content: "";\n+  display: table;\n+  clear: both;\n+}\n+/* line 213, ../sass/screen.sass */\n+.download-button:hover {\n+  border-color: #00bfa8;\n+  background-color: #444444;\n+}\n+/* line 216, ../sass/screen.sass */\n+.download-button .file {\n+  font-size: 36px;\n+  color: white;\n+  line-height: 1em;\n+}\n+/* line 220, ../sass/screen.sass */\n+.download-button .version {\n+  font-size: 24px;\n+  color: #00bfa8;\n+}\n+\n+/* -- Sharing -- */\n+/* line 226, ../sass/screen.sass */\n+.sharing {\n+  position: fixed;\n+  top: 20px;\n+  right: 0;\n+}\n+\n+/* -- Donate -- */\n+/* line 233, ../sass/screen.sass */\n+.donate-button-form {\n+  text-align: center;\n+}\n+\n+/* line 235, ../sass/screen.sass */\n+.donate-button {\n+  border: 4px solid rgba(0, 0, 0, 0);\n+  -webkit-border-radius: 4px;\n+  -moz-border-radius: 4px;\n+  -ms-border-radius: 4px;\n+  -o-border-radius: 4px;\n+  border-radius: 4px;\n+  -webkit-transition: all 0.1s ease-out;\n+  -moz-transition: all 0.1s ease-out;\n+  -o-transition: all 0.1s ease-out;\n+  transition: all 0.1s ease-out;\n+}\n+/* line 239, ../sass/screen.sass */\n+.donate-button:hover {\n+  background-color: #444444;\n+  border-color: #00bfa8;\n+}\n+\n+/* -- Responsive design -------------------------------------------------------------- */\n+@media only screen and (max-width: 640px) {\n+  /* line 247, ../sass/screen.sass */\n+  body {\n+    margin: 80px 10px 40px 10px;\n+    font-size: 14px;\n+  }\n+\n+  /* line 250, ../sass/screen.sass */\n+  h1 {\n+    font-size: 48px;\n+  }\n+\n+  /* line 252, ../sass/screen.sass */\n+  h2 {\n+    font-size: 26px;\n+  }\n+\n+  /* line 254, ../sass/screen.sass */\n+  h3 {\n+    font-size: 16px;\n+  }\n+\n+  /* line 256, ../sass/screen.sass */\n+  ol {\n+    list-style-position: inside;\n+  }\n+\n+  /* line 258, ../sass/screen.sass */\n+  code,\n+  kbd,\n+  pre,\n+  pre code {\n+    font-size: 11px;\n+  }\n+\n+  /* line 263, ../sass/screen.sass */\n+  .sub-point {\n+    font-size: 12px;\n+  }\n+  /* line 265, ../sass/screen.sass */\n+  .sub-point code {\n+    font-size: 9px;\n+  }\n+\n+  /* line 267, ../sass/screen.sass */\n+  .lead {\n+    font-size: 16px;\n+  }\n+\n+  /* line 269, ../sass/screen.sass */\n+  .section {\n+    padding-bottom: 20px;\n+    margin-bottom: 20px;\n+  }\n+\n+  /* line 272, ../sass/screen.sass */\n+  .author {\n+    margin-top: -5px;\n+    padding-left: 30px;\n+  }\n+\n+  /* line 275, ../sass/screen.sass */\n+  .author-links {\n+    font-size: 12px;\n+  }\n+}\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/close.png
b
Binary file ribo_tools/lightbox/img/close.png has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/donate.png
b
Binary file ribo_tools/lightbox/img/demopage/donate.png has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/favicon.ico
b
Binary file ribo_tools/lightbox/img/demopage/favicon.ico has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/image-1.jpg
b
Binary file ribo_tools/lightbox/img/demopage/image-1.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/image-2.jpg
b
Binary file ribo_tools/lightbox/img/demopage/image-2.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/image-3.jpg
b
Binary file ribo_tools/lightbox/img/demopage/image-3.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/image-4.jpg
b
Binary file ribo_tools/lightbox/img/demopage/image-4.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/image-5.jpg
b
Binary file ribo_tools/lightbox/img/demopage/image-5.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/image-6.jpg
b
Binary file ribo_tools/lightbox/img/demopage/image-6.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/thumb-1.jpg
b
Binary file ribo_tools/lightbox/img/demopage/thumb-1.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/thumb-2.jpg
b
Binary file ribo_tools/lightbox/img/demopage/thumb-2.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/thumb-3.jpg
b
Binary file ribo_tools/lightbox/img/demopage/thumb-3.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/thumb-4.jpg
b
Binary file ribo_tools/lightbox/img/demopage/thumb-4.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/thumb-5.jpg
b
Binary file ribo_tools/lightbox/img/demopage/thumb-5.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/demopage/thumb-6.jpg
b
Binary file ribo_tools/lightbox/img/demopage/thumb-6.jpg has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/loading.gif
b
Binary file ribo_tools/lightbox/img/loading.gif has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/next.png
b
Binary file ribo_tools/lightbox/img/next.png has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/img/prev.png
b
Binary file ribo_tools/lightbox/img/prev.png has changed
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/index.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/index.html Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,179 @@\n+<!DOCTYPE html>\n+<html lang="en-us">\n+<head>\n+\t<meta charset="utf-8">\n+\n+\t<title>Lightbox 2</title>\n+\n+\t<meta name="description" lang="en" content="Lightbox 2 is a script used to overlay images on the current page. It\'s a snap to setup and works on all modern browsers."/>\n+\t<meta name="author" content="Lokesh Dhakar">\n+\t<meta name="viewport" content="width=device-width,initial-scale=1">\n+\n+\t<script src="js/modernizr.custom.js"></script>\n+\n+\t<link rel="shortcut icon" href="img/demopage/favicon.ico">\n+\t<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Karla:400,700">\n+\t<link rel="stylesheet" href="css/screen.css" media="screen"/>\n+\t<link rel="stylesheet" href="css/lightbox.css" media="screen"/>\n+</head>\n+<body>\n+\n+<div class="wrapper">\n+\n+\t<section id="intro" class="section intro-section">\n+\t\t<header>\n+\t\t\t<h1 class="logo">Lightbox<em class="version">2</em></h1>\n+\t\t</header>\n+\t\t<p class="author">\n+\t\t\tby Lokesh Dhakar<br />\n+\t\t\t<span class="author-links">\n+\t\t\t\t<a href="https://twitter.com/intent/user?screen_name=lokesh">Follow me on Twitter</a>\n+\t\t\t</span>\n+\t\t</p>\n+\t\t<p class="lead">\n+\t\t\tLightbox is small javascript library used to overlay images on top of the current page. It\'s a <em>snap to setup</em> and works on <em>all modern browsers</em>.\n+\t\t</p>\n+\t</section>\n+\n+\t<section id="examples" class="section examples-section">\n+\t\t<header>\n+\t\t\t<h2 class="section-header">Examples</h2>\n+\t\t</header>\n+\n+\t\t<h3>Single images</h3>\n+\t\t<div class="image-row">\n+\t\t\t<a class="example-image-link" href="img/demopage/image-1.jpg" data-lightbox="example-1"><img class="example-image" src="img/demopage/thumb-1.jpg" alt="thumb-1" width="150" height="150"/></a>\n+\t\t\t<a class="example-image-link" href="img/demopage/image-2.jpg" data-lightbox="example-2" title="Optional caption."><img class="example-image" src="img/demopage/thumb-2.jpg" alt="thumb-1" width="150" height="150"/></a>\n+\t\t</div>\n+\n+\t\t<h3 style="clear: both;">An image set</h3>\n+\n+\t\t<div class="image-row">\n+\t\t\t<div class="image-set">\n+\t\t\t\t<a class="example-image-link" href="img/demopage/image-3.jpg" data-lightbox="example-set" title="Click on the right side of the image to move forward."><img class="example-image" src="img/demopage/thumb-3.jpg" alt="Plants: image 1 0f 4 thumb" width="150" height="150"/></a>\n+\t\t\t\t<a class="example-image-link" href="img/demopage/image-4.jpg" data-lightbox="example-set" title="Or press the right arrow on your keyboard."><img class="example-image" src="img/demopage/thumb-4.jpg" alt="Plants: image 2 0f 4 thumb" width="150" height="150"/></a>\n+\t\t\t\t<a class="example-image-link" href="img/demopage/image-5.jpg" data-lightbox="example-set" title="The script preloads the next image in the set as you\'re viewing."><img class="example-image" src="img/demopage/thumb-5.jpg" alt="Plants: image 3 0f 4 thumb" width="150" height="150"/></a>\n+\t\t\t\t<a class="example-image-link" href="img/demopage/image-6.jpg" data-lightbox="example-set" title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="img/demopage/thumb-6.jpg" alt="Plants: image 4 0f 4 thumb" width="150" height="150"/></a>\n+\t\t\t</div>\n+\t\t</div>\n+\t</section>\n+\n+\t<section id="download" class="section download-section">\n+\t\t<header>\n+\t\t\t<h2 class="section-header">Download</h2>\n+\t\t</header>\n+\n+\t\t<a href="releases/lightbox2.6.zip" class="download-button">\n+\t\t\t<div class="file">\n+\t\t\t\tLightbox\n+\t\t\t\t<div class="version">\n+\t\t\t\t\tv2.6\n+\t\t\t\t</div>\n+\t\t\t</div>\n+\t\t</a>\n+\n+\t\t<p>\n+\t\t\tLightbox2 is open-source.<br/>View and fork the code on <a href="https://github.com/lokesh/lightbox2">Github</a>.\n+\t\t</p>\n+\t</section>\n+\n+\t<section id="how-to-use" class="section how-to-use-section">\n+\t\t<header>\n+\t\t\t<h2 class="section-header">How to use</h2>\n+\t\t\t<h2 class="section-subheader">Step-by-step instructions</h2>\n+\t\t</header>\n+\t\t<h3>Part 1 - Get setup</h3>\n+\t\t<ol>\n+\t\t\t<li>Download and unzip the latest version of Lightbox from above.</li>\n+\t\t\t<li>Look inside the <code>js</c'..b' the images. For example:\n+<pre><code>&lt;a href=&quot;img/image-2.jpg&quot; data-lightbox=&quot;roadtrip&quot;&gt;image #2&lt;/a&gt;\n+&lt;a href=&quot;img/image-3.jpg&quot; data-lightbox=&quot;roadtrip&quot;&gt;image #3&lt;/a&gt;\n+&lt;a href=&quot;img/image-4.jpg&quot; data-lightbox=&quot;roadtrip&quot;&gt;image #4&lt;/a&gt;\n+</code></pre></li>\n+<li class="last-list-item"><div class="sub-point">For you long time Lightbox users, don\'t fret, you can still enable Lightbox by using <code>rel="lightbox"</code>. The new <code>data-lightbox</code> approach is preferred though as it is valid html.</div></li>\n+\t</li>\n+\t\t</ul>\n+\t</section>\n+\n+\n+\t<section id="questions" class="section questions-section">\n+\t\t<header>\n+\t\t\t<h2 class="section-header">Help</h2>\n+\t\t</header>\n+\t\t<h3>Bugs</h3>\n+\t\t<p>If you find a bug, create an <a href="https://github.com/lokesh/lightbox2/issues">issue on Github</a>. Include your operating system and browser version along with detailed steps to reproduce the bug.</p>\n+\n+\t\t<h3>Feature requests</h3>\n+\t\t<p>If you want a feature added, please create an <a href="https://github.com/lokesh/lightbox2/issues">issue on Github</a>. Someone else or I might be able to help out. No guarantees.</p>\n+\n+\t\t<h3>Support questions</h3>\n+\t\t<p>If you have a question that is not a bug or a feature request, your best chance of getting an answer is by following these steps:</p>\n+\t\t<ol class="simple-list">\n+\t\t\t<li><a href="http://lokeshdhakar.com/forums">Search the Lightbox forums</a>. <br /><span class="sub-point">You will not be able to post new questions in the forum as posting has been disabled. The forum is having spam problems and the forum will eventually be phased out.</span></li>\n+\t\t\t<li><a href="http://stackoverflow.com/">Search Stackoverflow</a>.</li>\n+\t\t\t<li><a href="http://stackoverflow.com/questions/ask">Create a new question on Stackoverflow</a>.</li>\n+\t\t</ol>\n+\t</section>\n+\n+\t<section id="doante" class="section donate-section last">\n+\t\t<header>\n+\t\t\t<h2 class="section-header">Donate</h2>\n+\t\t</header>\n+\t\t<p>\n+\t\t\tLightbox is completely free to use. If you\'re using Lightbox on a commercial project and are feeling generous, consider a donation. Thanks!\n+\t\t</p>\n+\t\t<form class="donate-button-form" name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">\n+\t\t\t<fieldset>\n+\t\t\t\t<input type="hidden" name="cmd" value="_xclick">\n+\t\t\t\t<input type="hidden" name="business" value="lokesh.dhakar@gmail.com">\n+\t\t\t\t<input type="hidden" name="item_name" value="Donation for Lightbox">\n+\t\t\t\t<input type="hidden" name="no_note" value="1">\n+\t\t\t\t<input type="hidden" name="currency_code" value="USD">\n+\t\t\t\t<input type="hidden" name="tax" value="0">\n+\t\t\t\t<input type="hidden" name="bn" value="PP-DonationsBF">\n+\t\t\t\t<input type="image" src="img/demopage/donate.png" name="submit" class="donate-button" alt="Make payments with PayPal - it\'s fast, free and secure!">\n+\t\t\t</fieldset>\n+\t\t</form>\n+\t</section>\n+\n+\t<section id="sharing" class="sharing">\n+\t\t<a href="https://twitter.com/share" class="twitter-share-button" data-via="lokesh" data-size="large">Tweet</a>\n+\t\t<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\'://platform.twitter.com/widgets.js\';fjs.parentNode.insertBefore(js,fjs);}}(document, \'script\', \'twitter-wjs\');</script>\n+\t</section>\n+\n+\n+\t<script src="js/jquery-1.10.2.min.js"></script>\n+\t<script src="js/lightbox-2.6.min.js"></script>\n+\n+\t<script>\n+\tvar _gaq = _gaq || [];\n+\t_gaq.push([\'_setAccount\', \'UA-2196019-1\']);\n+\t_gaq.push([\'_trackPageview\']);\n+\n+\t(function() {\n+\t\tvar ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n+\t\tga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n+\t\tvar s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n+\t})();\n+\t</script>\n+\n+</div>\n+\n+</body>\n+</html>\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/js/jquery-1.10.2.min.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/js/jquery-1.10.2.min.js Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,6 @@\n+/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license\n+//@ sourceMappingURL=jquery-1.10.2.min.map\n+*/\n+(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,T=/\\S+/g,C=/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,N=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]*))$/,k=/^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,E=/^[\\],:{}\\s]*$/,S=/(?:^|:|,)(?:\\s*\\[)+/g,A=/\\\\(?:["\\\\\\/bfnrt]|u[\\da-fA-F]{4})/g,j=/"[^"\\\\\\r\\n]*"|true|false|null|-?(?:\\d+\\.|)\\d+(?:[eE][+-]?\\d+|)/g,D=/^-ms-/,L=/-([\\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"construc'..b'"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/js/lightbox-2.6.min.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/js/lightbox-2.6.min.js Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,1 @@
+(function(){var b,d,c;b=jQuery;c=(function(){function b(){this.fadeDuration=500;this.fitImagesInViewport=true;this.resizeDuration=700;this.showImageNumberLabel=true;this.wrapAround=false}b.prototype.albumLabel=function(b,c){return"Image "+b+" of "+c};return b})();d=(function(){function c(b){this.options=b;this.album=[];this.currentImageIndex=void 0;this.init()}c.prototype.init=function(){this.enable();return this.build()};c.prototype.enable=function(){var c=this;return b('body').on('click','a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]',function(d){c.start(b(d.currentTarget));return false})};c.prototype.build=function(){var c=this;b("<div id='lightboxOverlay' class='lightboxOverlay'></div><div id='lightbox' class='lightbox'><div class='lb-outerContainer'><div class='lb-container'><img class='lb-image' src='' /><div class='lb-nav'><a class='lb-prev' href='' ></a><a class='lb-next' href='' ></a></div><div class='lb-loader'><a class='lb-cancel'></a></div></div></div><div class='lb-dataContainer'><div class='lb-data'><div class='lb-details'><span class='lb-caption'></span><span class='lb-number'></span></div><div class='lb-closeContainer'><a class='lb-close'></a></div></div></div></div>").appendTo(b('body'));this.$lightbox=b('#lightbox');this.$overlay=b('#lightboxOverlay');this.$outerContainer=this.$lightbox.find('.lb-outerContainer');this.$container=this.$lightbox.find('.lb-container');this.containerTopPadding=parseInt(this.$container.css('padding-top'),10);this.containerRightPadding=parseInt(this.$container.css('padding-right'),10);this.containerBottomPadding=parseInt(this.$container.css('padding-bottom'),10);this.containerLeftPadding=parseInt(this.$container.css('padding-left'),10);this.$overlay.hide().on('click',function(){c.end();return false});this.$lightbox.hide().on('click',function(d){if(b(d.target).attr('id')==='lightbox'){c.end()}return false});this.$outerContainer.on('click',function(d){if(b(d.target).attr('id')==='lightbox'){c.end()}return false});this.$lightbox.find('.lb-prev').on('click',function(){if(c.currentImageIndex===0){c.changeImage(c.album.length-1)}else{c.changeImage(c.currentImageIndex-1)}return false});this.$lightbox.find('.lb-next').on('click',function(){if(c.currentImageIndex===c.album.length-1){c.changeImage(0)}else{c.changeImage(c.currentImageIndex+1)}return false});return this.$lightbox.find('.lb-loader, .lb-close').on('click',function(){c.end();return false})};c.prototype.start=function(c){var f,e,j,d,g,n,o,k,l,m,p,h,i;b(window).on("resize",this.sizeOverlay);b('select, object, embed').css({visibility:"hidden"});this.$overlay.width(b(document).width()).height(b(document).height()).fadeIn(this.options.fadeDuration);this.album=[];g=0;j=c.attr('data-lightbox');if(j){h=b(c.prop("tagName")+'[data-lightbox="'+j+'"]');for(d=k=0,m=h.length;k<m;d=++k){e=h[d];this.album.push({link:b(e).attr('href'),title:b(e).attr('title')});if(b(e).attr('href')===c.attr('href')){g=d}}}else{if(c.attr('rel')==='lightbox'){this.album.push({link:c.attr('href'),title:c.attr('title')})}else{i=b(c.prop("tagName")+'[rel="'+c.attr('rel')+'"]');for(d=l=0,p=i.length;l<p;d=++l){e=i[d];this.album.push({link:b(e).attr('href'),title:b(e).attr('title')});if(b(e).attr('href')===c.attr('href')){g=d}}}}f=b(window);o=f.scrollTop()+f.height()/10;n=f.scrollLeft();this.$lightbox.css({top:o+'px',left:n+'px'}).fadeIn(this.options.fadeDuration);this.changeImage(g)};c.prototype.changeImage=function(f){var d,c,e=this;this.disableKeyboardNav();d=this.$lightbox.find('.lb-image');this.sizeOverlay();this.$overlay.fadeIn(this.options.fadeDuration);b('.lb-loader').fadeIn('slow');this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();this.$outerContainer.addClass('animating');c=new Image();c.onload=function(){var m,g,h,i,j,k,l;d.attr('src',e.album[f].link);m=b(c);d.width(c.width);d.height(c.height);if(e.options.fitImagesInViewport){l=b(window).width();k=b(window).height();j=l-e.containerLeftPadding-e.containerRightPadding-20;i=k-e.containerTopPadding-e.containerBottomPadding-110;if((c.width>j)||(c.height>i)){if((c.width/j)>(c.height/i)){h=j;g=parseInt(c.height/(c.width/h),10);d.width(h);d.height(g)}else{g=i;h=parseInt(c.width/(c.height/g),10);d.width(h);d.height(g)}}}return e.sizeContainer(d.width(),d.height())};c.src=this.album[f].link;this.currentImageIndex=f};c.prototype.sizeOverlay=function(){return b('#lightboxOverlay').width(b(document).width()).height(b(document).height())};c.prototype.sizeContainer=function(f,g){var b,d,e,h,c=this;h=this.$outerContainer.outerWidth();e=this.$outerContainer.outerHeight();d=f+this.containerLeftPadding+this.containerRightPadding;b=g+this.containerTopPadding+this.containerBottomPadding;this.$outerContainer.animate({width:d,height:b},this.options.resizeDuration,'swing');setTimeout(function(){c.$lightbox.find('.lb-dataContainer').width(d);c.$lightbox.find('.lb-prevLink').height(b);c.$lightbox.find('.lb-nextLink').height(b);c.showImage()},this.options.resizeDuration)};c.prototype.showImage=function(){this.$lightbox.find('.lb-loader').hide();this.$lightbox.find('.lb-image').fadeIn('slow');this.updateNav();this.updateDetails();this.preloadNeighboringImages();this.enableKeyboardNav()};c.prototype.updateNav=function(){this.$lightbox.find('.lb-nav').show();if(this.album.length>1){if(this.options.wrapAround){this.$lightbox.find('.lb-prev, .lb-next').show()}else{if(this.currentImageIndex>0){this.$lightbox.find('.lb-prev').show()}if(this.currentImageIndex<this.album.length-1){this.$lightbox.find('.lb-next').show()}}}};c.prototype.updateDetails=function(){var b=this;if(typeof this.album[this.currentImageIndex].title!=='undefined'&&this.album[this.currentImageIndex].title!==""){this.$lightbox.find('.lb-caption').html(this.album[this.currentImageIndex].title).fadeIn('fast')}if(this.album.length>1&&this.options.showImageNumberLabel){this.$lightbox.find('.lb-number').text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn('fast')}else{this.$lightbox.find('.lb-number').hide()}this.$outerContainer.removeClass('animating');this.$lightbox.find('.lb-dataContainer').fadeIn(this.resizeDuration,function(){return b.sizeOverlay()})};c.prototype.preloadNeighboringImages=function(){var c,b;if(this.album.length>this.currentImageIndex+1){c=new Image();c.src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){b=new Image();b.src=this.album[this.currentImageIndex-1].link}};c.prototype.enableKeyboardNav=function(){b(document).on('keyup.keyboard',b.proxy(this.keyboardAction,this))};c.prototype.disableKeyboardNav=function(){b(document).off('.keyboard')};c.prototype.keyboardAction=function(g){var d,e,f,c,b;d=27;e=37;f=39;b=g.keyCode;c=String.fromCharCode(b).toLowerCase();if(b===d||c.match(/x|o|c/)){this.end()}else if(c==='p'||b===e){if(this.currentImageIndex!==0){this.changeImage(this.currentImageIndex-1)}}else if(c==='n'||b===f){if(this.currentImageIndex!==this.album.length-1){this.changeImage(this.currentImageIndex+1)}}};c.prototype.end=function(){this.disableKeyboardNav();b(window).off("resize",this.sizeOverlay);this.$lightbox.fadeOut(this.options.fadeDuration);this.$overlay.fadeOut(this.options.fadeDuration);return b('select, object, embed').css({visibility:"visible"})};return c})();b(function(){var e,b;b=new c();return e=new d(b)})}).call(this);
\ No newline at end of file
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/js/modernizr.custom.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/js/modernizr.custom.js Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,4 @@
+/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
+ * Build: http://modernizr.com/download/#-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes
+ */
+;window.Modernizr=function(a,b,c){function A(a){j.cssText=a}function B(a,b){return A(m.join(a+";")+(b||""))}function C(a,b){return typeof a===b}function D(a,b){return!!~(""+a).indexOf(b)}function E(a,b){for(var d in a){var e=a[d];if(!D(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function F(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:C(f,"function")?f.bind(d||b):f}return!1}function G(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return C(b,"string")||C(b,"undefined")?E(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),F(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),y={}.hasOwnProperty,z;!C(y,"undefined")&&!C(y.call,"undefined")?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e});for(var H in q)z(q,H)&&(v=H.toLowerCase(),e[v]=q[H](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)z(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},A(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.hasEvent=x,e.testProp=function(a){return E([a])},e.testAllProps=G,e.testStyles=w,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document);
\ No newline at end of file
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/js/stupidtable.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/js/stupidtable.js Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,152 @@
+// Stupid jQuery table plugin.
+
+// Call on a table
+// sortFns: Sort functions for your datatypes.
+(function($) {
+
+  $.fn.stupidtable = function(sortFns) {
+    return this.each(function() {
+      var $table = $(this);
+      sortFns = sortFns || {};
+
+      // ==================================================== //
+      //                  Utility functions                   //
+      // ==================================================== //
+
+      // Merge sort functions with some default sort functions.
+      sortFns = $.extend({}, $.fn.stupidtable.default_sort_fns, sortFns);
+
+      // Return the resulting indexes of a sort so we can apply
+      // this result elsewhere. This returns an array of index numbers.
+      // return[0] = x means "arr's 0th element is now at x"
+      var sort_map = function(arr, sort_function) {
+        var map = [];
+        var index = 0;
+        var sorted = arr.slice(0).sort(sort_function);
+        for (var i=0; i<arr.length; i++) {
+            index = $.inArray(arr[i], sorted);
+
+            // If this index is already in the map, look for the next index.
+            // This handles the case of duplicate entries.
+            while ($.inArray(index, map) != -1) {
+                index++;
+            }
+            map.push(index);
+        }
+
+        return map;
+      };
+
+      // Apply a sort map to the array.
+      var apply_sort_map = function(arr, map) {
+        var clone = arr.slice(0),
+            newIndex = 0;
+        for (var i=0; i<map.length; i++) {
+          newIndex = map[i];
+          clone[newIndex] = arr[i];
+        }
+        return clone;
+      };
+
+      // ==================================================== //
+      //                  Begin execution!                    //
+      // ==================================================== //
+
+      // Do sorting when THs are clicked
+      $table.on("click", "th", function() {
+        var trs = $table.children("tbody").children("tr");
+        var $this = $(this);
+        var th_index = 0;
+        var dir = $.fn.stupidtable.dir;
+
+        $table.find("th").slice(0, $this.index()).each(function() {
+          var cols = $(this).attr("colspan") || 1;
+          th_index += parseInt(cols,10);
+        });
+
+        // Determine (and/or reverse) sorting direction, default `asc`
+        var sort_dir = $this.data("sort-default") || dir.ASC;
+        if ($this.data("sort-dir"))
+           sort_dir = $this.data("sort-dir") === dir.ASC ? dir.DESC : dir.ASC;
+
+        // Choose appropriate sorting function. 
+        var type = $this.data("sort") || null;
+
+        // Prevent sorting if no type defined
+        if (type === null) {
+          return;
+        }
+
+        // Trigger `beforetablesort` event that calling scripts can hook into;
+        // pass parameters for sorted column index and sorting direction
+        $table.trigger("beforetablesort", {column: th_index, direction: sort_dir});
+        // More reliable method of forcing a redraw
+        $table.css("display");
+
+        // Run sorting asynchronously on a timout to force browser redraw after
+        // `beforetablesort` callback. Also avoids locking up the browser too much.
+        setTimeout(function() {
+          // Gather the elements for this column
+          var column = [];
+          var sortMethod = sortFns[type];
+
+          // Push either the value of the `data-order-by` attribute if specified
+          // or just the text() value in this column to column[] for comparison.
+          trs.each(function(index,tr) {
+            var $e = $(tr).children().eq(th_index);
+            var sort_val = $e.data("sort-value");
+            var order_by = typeof(sort_val) !== "undefined" ? sort_val : $e.text();
+            column.push(order_by);
+          });
+
+          // Create the sort map. This column having a sort-dir implies it was
+          // the last column sorted. As long as no data-sort-desc is specified,
+          // we're free to just reverse the column.
+          var theMap;
+          if (sort_dir == dir.ASC)
+            theMap = sort_map(column, sortMethod);
+          else
+            theMap = sort_map(column, function(a, b) { return -sortMethod(a, b); });
+
+          // Reset siblings
+          $table.find("th").data("sort-dir", null).removeClass("sorting-desc sorting-asc");
+          $this.data("sort-dir", sort_dir).addClass("sorting-"+sort_dir);
+
+          var sortedTRs = $(apply_sort_map(trs, theMap));
+          $table.children("tbody").remove();
+          $table.append("<tbody />").append(sortedTRs);
+
+          // Trigger `aftertablesort` event. Similar to `beforetablesort`
+          $table.trigger("aftertablesort", {column: th_index, direction: sort_dir});
+          // More reliable method of forcing a redraw
+          $table.css("display");
+        }, 10);
+      });
+    });
+  };
+
+  // Enum containing sorting directions
+  $.fn.stupidtable.dir = {ASC: "asc", DESC: "desc"};
+
+  $.fn.stupidtable.default_sort_fns = {
+    "int": function(a, b) {
+      return parseInt(a, 10) - parseInt(b, 10);
+    },
+    "float": function(a, b) {
+      return parseFloat(a) - parseFloat(b);
+    },
+    "string": function(a, b) {
+      if (a < b) return -1;
+      if (a > b) return +1;
+      return 0;
+    },
+    "string-ins": function(a, b) {
+      a = a.toLowerCase();
+      b = b.toLowerCase();
+      if (a < b) return -1;
+      if (a > b) return +1;
+      return 0;
+    }
+  };
+
+})(jQuery);
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/lightbox/js/stupidtable.min.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/lightbox/js/stupidtable.min.js Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,1 @@
+(function(d){d.fn.stupidtable=function(b){return this.each(function(){var a=d(this);b=b||{};b=d.extend({},d.fn.stupidtable.default_sort_fns,b);var n=function(a,b){for(var f=[],c=0,e=a.slice(0).sort(b),h=0;h<a.length;h++){for(c=d.inArray(a[h],e);-1!=d.inArray(c,f);)c++;f.push(c)}return f},q=function(a,b){for(var d=a.slice(0),c=0,e=0;e<b.length;e++)c=b[e],d[c]=a[e];return d};a.on("click","th",function(){var m=a.children("tbody").children("tr"),g=d(this),f=0,c=d.fn.stupidtable.dir;a.find("th").slice(0, g.index()).each(function(){var a=d(this).attr("colspan")||1;f+=parseInt(a,10)});var e=g.data("sort-default")||c.ASC;g.data("sort-dir")&&(e=g.data("sort-dir")===c.ASC?c.DESC:c.ASC);var h=g.data("sort")||null;null!==h&&(a.trigger("beforetablesort",{column:f,direction:e}),a.css("display"),setTimeout(function(){var l=[],p=b[h];m.each(function(a,b){var c=d(b).children().eq(f),e=c.data("sort-value"),c="undefined"!==typeof e?e:c.text();l.push(c)});var k;k=e==c.ASC?n(l,p):n(l,function(a,b){return-p(a,b)}); a.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc");g.data("sort-dir",e).addClass("sorting-"+e);k=d(q(m,k));a.children("tbody").remove();a.append("<tbody />").append(k);a.trigger("aftertablesort",{column:f,direction:e});a.css("display")},10))})})};d.fn.stupidtable.dir={ASC:"asc",DESC:"desc"};d.fn.stupidtable.default_sort_fns={"int":function(b,a){return parseInt(b,10)-parseInt(a,10)},"float":function(b,a){return parseFloat(b)-parseFloat(a)},string:function(b,a){return b<a?-1: b>a?1:0},"string-ins":function(b,a){b=b.toLowerCase();a=a.toLowerCase();return b<a?-1:b>a?1:0}}})(jQuery);
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/metagene_frameshift_analysis.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/metagene_frameshift_analysis.py Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,880 @@\n+#!/usr/bin/env python2.7\n+#-*- coding: utf-8 -*-\n+\'\'\'\n+    Created on sep. 2013\n+    @author: rachel legendre\n+    @copyright: rachel.legendre@igmors.u-psud.fr\n+    @license: GPL v3\n+\'\'\'\n+\n+\n+import os, sys, optparse, tempfile, subprocess, re, shutil, commands, urllib, time, csv\n+import math\n+from numpy import arange\n+#from matplotlib import pyplot as pl\n+import matplotlib\n+matplotlib.use(\'Agg\')\n+import matplotlib.pyplot as pl\n+import itertools\n+from Bio import SeqIO\n+from Bio.Seq import Seq\n+from Bio.Alphabet import IUPAC\n+from PIL import Image\n+import ribo_functions\n+##libraries for debugg\n+#import cPickle\n+#import pdb\n+\n+\n+##Setting\n+MIN_COV_REQUIREMENT = 500\n+total_mapped_read = 0 \n+_MAX = 30\n+whole_phasing_table = [[],[],[]]\n+\n+\n+def stop_err( msg ):\n+    sys.stderr.write( "%s\\n" % msg )\n+    sys.stderr.write( "Programme aborted at %s\\n" % time.asctime(time.localtime(time.time())))\n+    sys.exit()\n+\n+\n+def split_bam(bamfile,tmpdir):\n+    \'\'\'\n+        split bam by chromosome and write sam file in tmpdir\n+    \'\'\'\n+    try:\n+        #get header\n+        results = subprocess.check_output([\'samtools\', \'view\', \'-H\',bamfile])\n+        header = results.split(\'\\n\')\n+       \n+        #define genome size\n+        genome = []\n+        for line in header:\n+            result = re.search(\'SN\', line)\n+            if result :\n+                #print line    \n+                feat = line.split(\'\\t\')\n+                chrom = re.split(":", feat[1])\n+                #print feat[1]\n+                genome.append(chrom[1])\n+       \n+        #split sam by chrom\n+        n = 0\n+        for chrm in genome:\n+            with open(tmpdir+\'/\'+chrm+\'.sam\', \'w\') as f : \n+                #write header correctly for each chromosome\n+                f.write(header[0]+\'\\n\')\n+                expr = re.compile(chrm+\'\\t\')\n+                el =[elem for elem in header if expr.search(elem)][0]\n+                f.write(el+\'\\n\')            \n+                f.write(header[-2]+\'\\n\')\n+                #write all reads for each chromosome\n+                reads = subprocess.check_output(["samtools", "view", bamfile, chrm])\n+                f.write(reads)\n+                # calculate number of reads \n+                n += reads.count(chrm)\n+\n+        sys.stdout.write("%d reads are present in your bam file\\n" % n)\n+    \n+    except Exception, e:\n+        stop_err( \'Error during bam file splitting : \' + str( e ) )\n+    \n+    \n+    \n+def get_first_base(tmpdir, kmer, frame):\n+    \'\'\'\n+        write footprint coverage file for each sam file in tmpdir\n+    \'\'\'\n+    global total_mapped_read\n+    ## tags by default\n+    multi_tag = "XS:i:"\n+    tag = "IH:i:1"\n+    \n+    try:\n+        ### compute position of P-site according to frame (P-site -> +15 starting from 5\' end of footprint)\n+        p_site_pos = 16-frame\n+        \n+        file_array = (commands.getoutput(\'ls \'+tmpdir)).split(\'\\n\')\n+        ##write coverage for each sam file in tmpdir\n+        for samfile in file_array:\n+            with open(tmpdir+\'/\'+samfile, \'r\') as sam : \n+                ##get chromosome name\n+                chrom = samfile.split(".sam")[0]\n+        \n+                for line in sam:\n+                    #initialize dictionnary\n+                    if \'@SQ\' in line :\n+                        size = int(line.split(\'LN:\')[1])\n+                        genomeF = [0]*size\n+                        genomeR = [0]*size\n+                    # define multiple reads keys from mapper\n+                    elif \'@PG\\tID\' in line :\n+                        if \'bowtie\' in line:\n+                            multi_tag = "XS:i:"\n+                        elif \'bwa\' in  line:\n+                            multi_tag = "XT:A:R"\n+                        elif \'TopHat\' in  line:\n+                            tag = "NH:i:1"\n+                        else :\n+                            stop_err("No PG tag find in "+samfile+". Please use bowtie, bwa or Tophat for mapping")   \n+                        \n+   '..b'NT")    \n+\n+    parser.add_option("-p", "--frame", dest="frame", type="int", default = 1 ,\n+                  help="Script can compute in frame 1, 2 or 3", metavar="1|2|3")               \n+    \n+    parser.add_option("-q", "--quiet",\n+                  action="store_false", dest="verbose", default=True,\n+                  help="don\'t print status messages to stdout")\n+                    \n+    (options, args) = parser.parse_args()\n+    sys.stdout.write("Begin frame analysis at %s\\n" % time.asctime( time.localtime(time.time())))\n+    # Create temp dir\n+    try:\n+        tmp_dir = tempfile.mkdtemp()\n+        (html_file, subfolder ) = options.dirout.split(",")\n+        \n+        ##testing indexed bam file\n+        if os.path.isfile(options.bamfile+".bai") :\n+            pass\n+        else :\n+            cmd = "samtools index %s " % (options.bamfile)\n+            proc = subprocess.Popen( args=cmd, shell=True, stderr = subprocess.PIPE)\n+            returncode = proc.wait()\n+\n+        if not os.path.exists(subfolder):\n+            try:\n+                os.mkdir(subfolder)\n+            except Exception, e :\n+                stop_err(\'Error running make directory : \' + str(e)) \n+        \n+        ## check frame arg\n+        if options.frame not in [1,2,3]:\n+            stop_err( \'Please enter a good value for frame argument : must be 1, 2 or 3\' )\n+        \n+        ##RUN analysis\n+        split_bam(options.bamfile,tmp_dir)\n+        get_first_base (tmp_dir,options.kmer,options.frame)\n+        ## identify GFF or GTF format from 9th column\n+        with open (options.gff,"r") as gffile :\n+            for line in gffile :\n+                if \'#\' in line :\n+                    ## skip header\n+                    gffile.next()\n+                elif \'gene_id\' in line :\n+                    ## launch gtf reader :\n+                    GFF = ribo_functions.store_gtf(options.gff)\n+                    break\n+                elif \'ID=\' in line :\n+                    ## launch gff reader \n+                    GFF = ribo_functions.store_gff(options.gff)\n+                    break\n+                else :\n+                    stop_err( \'Please check your annotation file is in correct format, GFF or GTF\' )\n+\n+        ## check gff reading\n+        if not GFF[\'order\'] :\n+            stop_err( \'Incorrect GFF file\')\n+        for gene in GFF[\'order\']:\n+            if not GFF[gene][\'exon\'] :\n+                del GFF[gene]\n+                GFF[\'order\'].remove(gene) \n+                \n+        #### cPickles for Test ####\n+        #if os.path.isfile("/home/rlegendre/Documents/FrameShift/OutOfFrameWithIntron/pyt_dict") :\n+        #    with open("/home/rlegendre/Documents/FrameShift/OutOfFrameWithIntron/pyt_dict",\'rb\') as fp:\n+        #        GFF = cPickle.load(fp)\n+        #else :\n+        #    split_bam(options.bamfile,tmp_dir)\n+        #    get_first_base (tmp_dir)\n+        #    GFF = store_gff(options.gfffile)\n+        #    GFF = frame_analysis (tmp_dir,options.outfile,options.cutoff,GFF,subfolder)\n+        #    with open("/home/rlegendre/OutOfFrameWithIntron/pyt_dict",\'wb\') as fp:\n+        #        cPickle.dump(GFF,fp)\n+        #    \n+        #### cPickles for Test ####\n+       \n+        GFF = frame_analysis (tmp_dir,subfolder,options.cutoff,GFF, options.box, options.orf_length)\n+        plot_subprofile (GFF,subfolder,options.fasta)\n+        write_html_page(html_file,subfolder,GFF)\n+        \n+        ##paste jquery script in result directory :\n+        jq_src = os.path.join(os.path.dirname(__file__),\'lightbox\')\n+        shutil.copytree(jq_src,os.path.join(subfolder,\'lightbox\'))\n+        \n+        \n+    \n+        sys.stdout.write("Finish frame analysis at %s\\n" % time.asctime( time.localtime(time.time())))\n+    except Exception, e:\n+        stop_err( \'Error running metagene analysis : \' + str( e ) )\n+            \n+    if os.path.exists( tmp_dir ):\n+         shutil.rmtree( tmp_dir )\n+\n+\n+\n+if __name__=="__main__":\n+    __main__()\n\\ No newline at end of file\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/metagene_frameshift_analysis.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/metagene_frameshift_analysis.xml Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,77 @@
+<tool id="frameshift_analysis" name="Frame">
+ <description>To analyse Ribo-seq alignments for the extraction of translational ambiguities</description>
+ <requirements>
+     <requirement type="package">samtools</requirement>
+     <requirement type="python-module">matplotlib</requirement>
+     <requirement type="python-module">numpy</requirement>
+     <requirement type="python-module">PIL</requirement>
+     <requirement type="python-module">Bio</requirement>
+ </requirements>
+ <command interpreter="python"> 
+ metagene_frameshift_analysis.py --gff $reference --bam $mapping --cutoff $cutoff --kmer $kmer --fasta $fasta --dirout $output,$output.files_path --box $boxplot --orf_length $orf --frame $frame > $log
+
+ </command>
+
+ <inputs>
+ <param name="reference" type="data" label="Reference annotation file (GFF)" format="gff" />
+ <param name="mapping" type="data" label="Bam file" format="bam" />
+ <param name="fasta" type="data" label="Reference genome in Fasta format" format="fasta" />
+ <param name="kmer" type="integer" label="Length of the best phasing footprints" value ="28"  />
+ <param name="frame" type="integer" label="Frame where footprints show best phasing. Must be 1, 2 or 3" value ="1"  />
+ <param name="cutoff" type="integer" label="Cutoff for frame proportion in coding phase (default = 60 %)" value ="60"  />
+ <param name="orf" type="integer" label="Approximate size of the segment (in bp)" value ="300"  />
+ </inputs>
+
+ <outputs>
+ <data format="tabular" name="log" label="[RP]Stat File on ${on_string}"/>
+ <data format="html" name="output" label="[RP]Dual coding results on ${on_string}"/>
+ <data format="png" name="boxplot" label="[RP]Boxplot on ${on_string}"/>
+
+ </outputs>
+
+ <help>
+Summary
+-------    
+This tool uses Ribo-seq data (BAM file) to extract out-of-frame footprints in all genes from a reference annotation file (`GFF3`_). Subprofiles are plotted for each gene with dual coding events.
+
+
+*- GFF3 file*: This file must have nine tabulated-delimited columns: Chromosome, source, feature, start, stop, score, strand, phasing, note. The gene ID is retrieved from the note field, using the "ID=" tag.
+
+*- Fasta file*: Reference fasta file. Care should be taken with the chromosome nomenclature used, which must be compatible with the GFF3 annotation file.
+
+*- BAM file*: This file should be sorted and may contain either multiple or unaligned footprints
+
+*- Kmer*: Length of the best-phased footprints. It can be calculated by running kmer_analysis 
+
+*- Frame*: Frame for which the phasing of the footprints is best. It can be calculated by running kmer_analysis 
+
+*- Cutoff*: An integer value for selecting all genes for which fewer than 60 % (default) of the footprints are in the coding frame.
+
+*- Orf*: Approximate size of the segment.
+
+
+.. _GFF3: http://gmod.org/wiki/GFF3
+
+
+Output 
+------- 
+This tool generates 3 output files:
+
+*- html file*: for the detection and visualisation of translational ambiguities.
+
+*- Stat file*: this file provides statistics for the treated footprints and phasing.
+
+*- Boxplot*: Proportion of footprints in the three frames, for all genes.
+
+
+Dependances
+------------
+
+.. class:: warningmark
+
+This tool depends on Python (>=2.7) and following packages : numpy 1.8.0, Biopython 1.58, matplotlib 1.3.1. Samtools is used for bam manipulation.
+
+
+ </help>
+</tool>
+
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/metagene_readthrough.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/metagene_readthrough.py Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,1056 @@\n+#!/usr/bin/env python2.7.3\n+#-*- coding: utf-8 -*-\n+\n+\'\'\'\n+    Created on Dec. 2013\n+    @author: rachel legendre\n+    @copyright:  rachel.legendre@igmors.u-psud.fr\n+    @license: GPL v3\n+\'\'\'\n+\n+import os, sys, time, optparse, shutil, re, urllib, subprocess, tempfile\n+from urllib import unquote\n+from Bio import SeqIO\n+import csv\n+import pysam\n+import HTSeq\n+#from matplotlib import pyplot as pl\n+import matplotlib\n+from jinja2.nodes import Pos\n+matplotlib.use(\'Agg\')\n+import matplotlib.pyplot as pl\n+from numpy import arange\n+from matplotlib import ticker as t\n+from PIL import Image\n+import ribo_functions\n+## suppress matplotlib warnings\n+import warnings\n+\n+\n+\n+def stop_err( msg ):\n+    sys.stderr.write( "%s\\n" % msg )\n+    sys.stderr.write( "Programme aborted at %s\\n" % time.asctime(time.localtime(time.time())))\n+    sys.exit()\n+    \n+        \n+def compute_rpkm(length,count_gene,count_tot) :\n+    \n+    try : \n+        rpkm = "{0:.4f}".format(count_gene*1000000.0/(count_tot*length))\n+    except ArithmeticError :\n+        stop_err( \'Illegal division by zero during computing RPKM\')\n+    return float(rpkm)\n+\n+ \n+def find_stop(seq) :\n+    \'\'\'\n+        Find stop codon in a sequence and return position of first nucleotide in stop\n+    \'\'\'\n+    stop_codon = [\'TAA\',\'TAG\',\'TGA\']\n+    for nt in range(0,len(seq)-3,3) :\n+        codon = seq[nt:nt+3]\n+        if codon in stop_codon :\n+            return nt\n+                \n+    return -1\n+\n+\n+def check_met(seq):\n+    \'\'\'\n+        Boolean function for testing presence or absence of methionine in 5 codons following stop codon \n+    \'\'\'\n+    met = \'ATG\'\n+    for pos in range(0,15,3) :\n+        codon = seq[pos:pos+3]\n+        if codon in met :\n+            return True\n+                \n+    return False\n+\n+\n+\'\'\'\n+    feature.iv is a GenomicInterval object :\n+    A GenomicInterval object has the following slots, some of which \n+    are calculated from the other:\n+  \n+    chrom: The name of a sequence (i.e., chromosome, contig, or \n+      the like). \n+    start: The start of the interval. Even on the reverse strand,\n+      this is always the smaller of the two values \'start\' and \'end\'.\n+      Note that all positions should be given as 0-based value!\n+    end: The end of the interval. Following Python convention for \n+      ranges, this in one more than the coordinate of the last base\n+      that is considered part of the sequence.\n+    strand: The strand, as a single character, \'+\' or \'-\'. \'.\' indicates\n+      that the strand is irrelevant. (Alternatively, pass a Strand object.)\n+    length: The length of the interval, i.e., end - start\n+    start_d: The "directional start" position. This is the position of the\n+     first base of the interval, taking the strand into account. Hence, \n+     this is the same as \'start\' except when strand == \'-\', in which \n+     case it is end-1.\n+    end_d: The "directional end": Usually, the same as \'end\', but for \n+     strand==\'-1\', it is start-1.\n+  \n+\'\'\'\n+def check_overlapping(gff_reader,chrm,start,stop,strand, name):\n+    \n+    #### probleme avec les genes completement inclu...\n+    \n+    iv2 = HTSeq.GenomicInterval(chrm,start,stop,strand)\n+    for feature in gff_reader:\n+        if feature.type == "gene" :\n+            if feature.iv.overlaps(iv2) and feature.attr.get(\'gene_name\') != name :\n+                ## if its a reverse gene, we replace start of extension by start of previous gene\n+                if strand == \'-\' :\n+                    return (feature.iv.end+3,stop)\n+                ## else we replace stop of extension by start of following gene\n+                else :\n+                    return (start,feature.iv.start-3)\n+    ## if no overlap are find, we return -1\n+    return (start,stop)\n+\n+\n+def pass_length(start,stop) :\n+    \n+    if (stop-start) > 25 :\n+        return True\n+    else :\n+        return False\n+\n+\n+def check_homo_coverage(gene,GFF,start,stop, aln) :\n+    \n+    chrom = GFF[gene][\'chrom\']\n+    ## compute number of '..b'\n+        <h1>Readthrough analyse results</h1>\n+            %s\n+    </body>\n+</html> """ % (gene_table)\n+         \n+        html_file = open(html,"w")\n+        html_file.write(html_str)\n+        html_file.close()    \n+        \n+        \n+    except Exception, e :\n+        stop_err(\'Error during html page creation : \' + str( e ) )\n+        \n+        \n+def __main__():\n+\n+    #Parse command line options\n+    parser = optparse.OptionParser()\n+    parser.add_option("-g", "--gff", dest="gff", type= "string",\n+                  help="GFF annotation file", metavar="FILE")\n+                    \n+    parser.add_option("-f", "--fasta", dest="fasta", type= "string",\n+                  help="Fasta file ", metavar="FILE")\n+            \n+    parser.add_option("-b", "--bam", dest="bamfile", type= "string",\n+                  help="Bam Ribo-Seq alignments ", metavar="FILE")\n+                    \n+    parser.add_option("-d", "--dirout", dest="dirout", type= "string",\n+                  help="write report in this html file and in associated directory", metavar="STR,STR")\n+      \n+    parser.add_option("-k", "--kmer", dest="kmer", type= "int",default = 28 ,\n+                  help="Longer of your phasing reads (Default is 28)", metavar="INT") \n+    \n+    parser.add_option("-e", "--extend", dest="extend", type= "int",default = 300 ,\n+                  help="Lenght of extension after stop in number of base pairs (depends on your organisme)", metavar="INT")     \n+                    \n+    parser.add_option("-q", "--quiet",\n+                  action="store_false", dest="verbose", default=True,\n+                  help="don\'t print status messages to stdout")\n+                    \n+    (options, args) = parser.parse_args()\n+    sys.stdout.write("Begin readthrough analysis at %s\\n" % time.asctime( time.localtime(time.time())))\n+\n+    try:\n+        (html_file, subfolder ) = options.dirout.split(",")\n+        if not os.path.exists(subfolder):\n+            try:\n+                os.mkdir(subfolder)\n+            except Exception, e :\n+                stop_err(\'Error running make directory : \' + str(e)) \n+        ## identify GFF or GTF format from 9th column\n+        with open (options.gff,"r") as gffile :\n+            for line in gffile :\n+                if \'#\' in line :\n+                    ## skip header\n+                    gffile.next()\n+                elif \'gene_id\' in line :\n+                    ## launch gtf reader :\n+                    GFF = ribo_functions.store_gtf(options.gff)\n+                    break\n+                elif \'ID=\' in line :\n+                    ## launch gff reader \n+                    GFF = ribo_functions.store_gff(options.gff)\n+                    break\n+                else :\n+                    stop_err( \'Please check your annotation file is in correct format, GFF or GTF\' )\n+            \n+        #GFF = store_gff(options.gff)\n+        #GFF = ribo_functions.store_gtf(options.gff)\n+        ## check gff reading\n+        if not GFF[\'order\'] :\n+            stop_err( \'Incorrect GFF file\' )\n+        for gene in GFF[\'order\']:\n+            if not GFF[gene][\'exon\'] :\n+                del GFF[gene]\n+                GFF[\'order\'].remove(gene)              \n+\n+        clean_file = ribo_functions.cleaning_bam(options.bamfile)\n+        compute_analysis(clean_file, GFF, options.fasta, options.gff, subfolder, options.extend, options.kmer)\n+        if os.path.exists( clean_file ):\n+            os.remove( clean_file )\n+        \n+        write_html_page(html_file,subfolder)\n+        ##paste jquery script in result directory :\n+        jq_src = os.path.join(os.path.dirname(__file__),\'lightbox\')\n+        shutil.copytree(jq_src,os.path.join(subfolder,\'lightbox\'))\n+        \n+        \n+        sys.stdout.write("Finish readthrough analysis at %s\\n" % time.asctime( time.localtime(time.time())))\n+    except Exception, e:\n+        stop_err( \'Error running metagene readthrough analysis : \' + str( e ) )\n+    \n+\n+if __name__=="__main__":\n+    __main__()\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/metagene_readthrough.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/metagene_readthrough.xml Wed Sep 27 04:59:10 2017 -0400
[
@@ -0,0 +1,63 @@
+<tool id="readthrough_analysis" name="Stop_supp">
+ <description>To analyse Ribo-seq alignments for the detection of stop codon readthrough events</description>
+ <requirements>
+     <requirement type="package">samtools</requirement>
+     <requirement type="python-module">HTseq</requirement>
+     <requirement type="python-module">pysam</requirement>
+     <requirement type="python-module">csv</requirement>
+     <requirement type="python-module">Bio</requirement>
+ </requirements>
+ <command interpreter="python"> 
+ metagene_readthrough.py --gff $gff --fasta $fasta --bam $mapping --dirout=$output,$output.files_path --extend $ext
+
+ </command>
+
+ <inputs>
+ <param name="gff" type="data" label="Reference annotation file (GFF)" format="gff" />
+ <param name="fasta" type="data" label="Reference genome in Fasta format" format="fasta" />
+ <param name="mapping" type="data" label="Bam File" format="bam" />
+ <param name="ext" type="integer" label="Length of 3’ UTR extension downstream the annotated stop codon (in bp)" value="300" />
+ </inputs>
+            
+ <outputs>
+ <data format="html"  name="output" label="[RP]Readthrough results on  ${on_string}"/>
+ </outputs>
+        
+ <help>
+Summary
+-------          
+This tool uses Ribo-seq data (BAM file) to extract genes displaying potential stop codon readthrough events from a reference annotation file (`GFF3`_).
+
+C-terminal protein extensions were identified as previously described (Dunn J.G. et al, 2013). Only uniquely mapped footprints with a size in the 25 to 34 range are considered.
+A gene is considered to display readthrough if:
+
+ i) It is covered by more than 128 footprints.
+
+ ii) There are footprints after the stop codon.
+
+ iii) There are footprints overlapping the next in-frame stop codon.
+
+ iv) There is no methionine codon in the next five codons downstream from the official stop codon of the CDS.
+
+ v) Coverage is homogeneous within the extension.
+
+Stop codon readthrough was estimated by calculating the ratio of the number of footprints in the C-terminal extension to that in the CDS. Ribosome density footprints were estimated in RPKM (reads per kilobase per million). We controlled for variability due to stop codon peaks, by excluding footprints mapping to stop codons from the calculation of RPKM.
+
+.. _GFF3: http://gmod.org/wiki/GFF3
+
+
+Output 
+------- 
+This tool produces an html file with plots for each gene displaying readthrough.
+
+
+Dependances
+------------
+
+.. class:: warningmark
+
+This tool depends on Python (>=2.7) and following packages : numpy 1.8.0, Biopython 1.58, matplotlib 1.3.1, HTSeq and pysam. Samtools is used for bam manipulation.
+
+ </help>
+</tool>
+
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/ribo_functions.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ribo_tools/ribo_functions.py Wed Sep 27 04:59:10 2017 -0400
[
b'@@ -0,0 +1,372 @@\n+#!/usr/bin/env python2.7\n+\n+\'\'\'\n+    Created on Jan. 2014\n+    @author: rachel legendre\n+    @copyright:  rachel.legendre@igmors.u-psud.fr\n+    @license: GPL v3\n+\'\'\'\n+\n+import sys, subprocess, re, commands, time, urllib,  tempfile\n+from copy import copy\n+\n+\n+def stop_err( msg ):\n+    sys.stderr.write( "%s\\n" % msg )\n+    sys.stderr.write( "Programme aborted at %s\\n" % time.asctime(time.localtime(time.time())))\n+    sys.exit()\n+\n+def split_bam(bamfile,tmpdir):\n+    \'\'\'\n+        split bam by chromosome and write sam file in tmpdir\n+    \'\'\'\n+    try:\n+        #get header\n+        results = subprocess.check_output([\'samtools\', \'view\', \'-H\',bamfile])\n+        header = results.split(\'\\n\')\n+       \n+        #define genome size\n+        genome = []\n+        for line in header:\n+            result = re.search(\'SN\', line)\n+            if result :\n+                #print line    \n+                feat = line.split(\'\\t\')\n+                chrom = re.split(":", feat[1])\n+                #print feat[1]\n+                genome.append(chrom[1])\n+       \n+        #split sam by chrom\n+        n = 0\n+        for chrm in genome:\n+            with open(tmpdir+\'/\'+chrm+\'.sam\', \'w\') as f : \n+                #write header correctly for each chromosome\n+                f.write(header[0]+\'\\n\')\n+                expr = re.compile(chrm+\'\\t\')\n+                el =[elem for elem in header if expr.search(elem)][0]\n+                f.write(el+\'\\n\')            \n+                f.write(header[-2]+\'\\n\')\n+                #write all reads for each chromosome\n+                reads = subprocess.check_output(["samtools", "view", bamfile, chrm])\n+                f.write(reads)\n+                # calculate number of reads \n+                n += reads.count(chrm)\n+\n+        sys.stdout.write("%d reads are presents in your bam file\\n" % n)\n+    \n+    except Exception, e:\n+        stop_err( \'Error during bam file splitting : \' + str( e ) )\n+    \n+    \n+    \n+def get_first_base(tmpdir, kmer, frame):\n+    \'\'\'\n+        write footprint coverage file for each sam file in tmpdir\n+    \'\'\'\n+    global total_mapped_read\n+    ## tags by default\n+    multi_tag = "XS:i:"\n+    tag = "IH:i:1"\n+    \n+    try:\n+        ### compute position of P-site according to frame (P-site -> +15 starting from 5\' end of footprint)\n+        p_site_pos = 16-frame\n+        \n+        file_array = (commands.getoutput(\'ls \'+tmpdir)).split(\'\\n\')\n+        ##write coverage for each sam file in tmpdir\n+        for samfile in file_array:\n+            with open(tmpdir+\'/\'+samfile, \'r\') as sam : \n+                ##get chromosome name\n+                chrom = samfile.split(".sam")[0]\n+        \n+                for line in sam:\n+                    #initialize dictionnary\n+                    if \'@SQ\' in line :\n+                        size = int(line.split(\'LN:\')[1])\n+                        genomeF = [0]*size\n+                        genomeR = [0]*size\n+                    # define multiple reads keys from mapper\n+                    elif \'@PG\\tID\' in line :\n+                        if \'bowtie\' in line:\n+                            multi_tag = "XS:i:"\n+                        elif \'bwa\' in  line:\n+                            multi_tag = "XT:A:R"\n+                        elif \'TopHat\' in  line:\n+                            tag = "NH:i:1"\n+                        else :\n+                            stop_err("No PG tag find in "+samfile+". Please use bowtie, bwa or Tophat for mapping")   \n+                        \n+                    # get footprint\n+                    elif re.search(\'^[^@].+\', line) :\n+                        #print line.rstrip()\n+                        read_pos = int(line.split(\'\\t\')[3])\n+                        read_sens = int(line.split(\'\\t\')[1])\n+                        len_read = len(line.split(\'\\t\')[9])\n+                        read_qual = int(line.split(\'\\t\')[4])\n+                        if len_read == kmer and (tag in line or multi_tag not in line) and read_qual > 20 '..b'name "RPS16B"; gene_biotype "protein_coding"; transcript_name "RPS16B";\n+## exon_id "YDL083C.1";\n+##IV      protein_coding  CDS     307766  307789  .       -       0       gene_id "YDL083C"; transcript_id "YDL083C"; exon_number "1"; gene_name "RPS16B"; gene_biotype "protein_coding"; transcript_name "RPS16B";\n+## protein_id "YDL083C";\n+##IV      protein_coding  start_codon     307787  307789  .       -       0       gene_id "YDL083C"; transcript_id "YDL083C"; exon_number "1"; gene_name "RPS16B"; gene_biotype "protein_coding"; transcript_name "\n+##RPS16B";\n+##IV      protein_coding  exon    306926  307333  .       -       .       gene_id "YDL083C"; transcript_id "YDL083C"; exon_number "2"; gene_name "RPS16B"; gene_biotype "protein_coding"; transcript_name "RPS16B";\n+## exon_id "YDL083C.2";\n+##IV      protein_coding  CDS     306929  307333  .       -       0       gene_id "YDL083C"; transcript_id "YDL083C"; exon_number "2"; gene_name "RPS16B"; gene_biotype "protein_coding"; transcript_name "RPS16B";\n+## protein_id "YDL083C";\n+##IV      protein_coding  stop_codon      306926  306928  .       -       0       gene_id "YDL083C"; transcript_id "YDL083C"; exon_number "2"; gene_name "RPS16B"; gene_biotype "protein_coding"; transcript_name "\n+##RPS16B";\n+def __reverse_coordinates__(GFF):\n+    \n+    for gene in GFF[\'order\']:\n+        ## for reverse gene\n+        if GFF[gene][\'strand\'] == "-":\n+            ## if this gene have many exon and the stop of gene is the stop of first (and not last) exon, we reverse exon coordinates\n+            if GFF[gene][\'stop\'] == GFF[gene][\'exon\'][1][\'stop\'] and GFF[gene][\'exon_number\'] > 1 :\n+                tmp = copy(GFF[gene][\'exon\'])\n+                exon_number = GFF[gene][\'exon_number\']\n+                rev_index = exon_number+1\n+                for z in range(1,exon_number+1):\n+                    rev_index -= 1\n+                    GFF[gene][\'exon\'][z] = tmp[rev_index]\n+\n+                ## check start\n+                if GFF[gene][\'start\'] != GFF[gene][\'exon\'][1][\'start\'] and GFF[gene][\'start\']:\n+                    GFF[gene][\'exon\'][1][\'start\'] = GFF[gene][\'start\']\n+\n+    return GFF\n+    \n+\n+def cleaning_bam(bam):\n+    \'\'\'\n+        Remove reads unmapped, non uniquely mapped and reads with length lower than 25 and upper than 32, and mapping quality upper than 12\n+    \'\'\'\n+    try :\n+        header = subprocess.check_output([\'samtools\', \'view\', \'-H\', bam], stderr= subprocess.PIPE)\n+        #header = results.split(\'\\n\')\n+        ## tags by default\n+        multi_tag = "XS:i:"\n+        tag = "IH:i:1"\n+        # check mapper for define multiple tag\n+        if \'bowtie\' in header:\n+            multi_tag = "XS:i:"\n+        elif \'bwa\' in  header:\n+            multi_tag = "XT:A:R"\n+        elif \'TopHat\' in  header:\n+            tag = "NH:i:1"\n+        else :\n+            stop_err("No PG tag find in "+samfile+". Please use bowtie, bwa or Tophat for mapping") \n+            \n+        tmp_sam = tempfile.mktemp()\n+        cmd = "samtools view %s > %s" % (bam, tmp_sam) \n+        proc = subprocess.Popen( args=cmd, shell=True, stderr = subprocess.PIPE)\n+        returncode = proc.wait()\n+        \n+        \n+        with open(tempfile.mktemp(),\'w\') as out :\n+            out.write(header)\n+            with open(tmp_sam,\'r\') as sam :\n+                for line in sam :\n+                    if (multi_tag not in line or tag in line) and line.split(\'\\t\')[1] != \'4\' and int(line.split(\'\\t\')[4]) > 12 :\n+                        if len(line.split(\'\\t\')[9]) < 32 and len(line.split(\'\\t\')[9]) > 25 :\n+                            out.write(line)\n+        bamfile = tempfile.mktemp()+\'.bam\'   \n+        cmd = "samtools view -hSb %s > %s" % (out.name,bamfile)\n+        proc = subprocess.Popen( args=cmd, shell=True, stderr = subprocess.PIPE)\n+        returncode = proc.wait()\n+        \n+        return bamfile\n+    \n+    except Exception,e:\n+        stop_err( \'Error during cleaning bam : \' + str( e ) ) \n+    \n\\ No newline at end of file\n'
b
diff -r 000000000000 -r 01b945ba3697 ribo_tools/ribo_functions.pyc
b
Binary file ribo_tools/ribo_functions.pyc has changed