Module Expr Str Import alias Import alias Import alias Import alias identifier Import alias identifier Import alias identifier ImportFrom alias identifier ImportFrom alias FunctionDef arguments args NameParam defaults NameLoad body Expr Str If UnaryOpNot NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr keyword Str keyword SubscriptLoad Call NameLoad Index Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign NameStore ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore ListLoad Expr Call AttributeLoad NameLoad attr Str For NameStore NameLoad body If Call AttributeLoad NameLoad attr Str body Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse If Call AttributeLoad NameLoad attr Str body Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr NameLoad Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse Raise Call NameLoad BinOpMod Str NameLoad For NameStore NameLoad body If CompareNotEq Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Num body Assign NameStore BinOpAdd NameLoad Str Assign NameStore NameLoad orelse If CompareNotEq Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Num body Assign NameStore BinOpAdd NameLoad Str Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpAdd Call AttributeLoad Str attr ListLoad NameLoad NameLoad Str Assign NameStore Str Expr Call AttributeLoad NameLoad attr If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore TupleLoad NameLoad NameLoad Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad For NameStore NameLoad body AugAssignAdd NameStore Num Print Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad For NameStore NameLoad body AugAssignAdd NameStore Num Print Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad For NameStore NameLoad body AugAssignAdd NameStore Num Print Str NameLoad Assign NameStore Dict Expr Call AttributeLoad NameLoad attr Str Assign SubscriptStore NameLoad Index NameLoad Dict Str Str Call NameLoad NameLoad Call NameLoad NameLoad BinOpAdd Call NameLoad NameLoad Call NameLoad NameLoad Call NameLoad NameLoad ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str Str Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str BinOpAdd BinOpAdd BinOpAdd NameLoad Str NameLoad Str Expr Call SubscriptLoad NameLoad Index Str Call AttributeLoad NameLoad attr keyword SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str keyword SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str BinOpAdd BinOpAdd BinOpAdd NameLoad Str NameLoad Str Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Num Str Call NameLoad TupleLoad Num Num Str Num Num Num Num Str Call AttributeLoad NameLoad attr Num Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Num Num Call AttributeLoad NameLoad attr Num Num Num Num Call AttributeLoad NameLoad attr NameLoad NameLoad Call AttributeLoad NameLoad attr Num Num Num Num Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr
N/A N/A gtf2Overlap.py
=============================================

:Author: Nick Ilott
:Release: $Id$
:Date: |today|
:Tags: Python

Purpose
-------

Take two gtf files, merge transcripts, intersect them and draw a venn
diagram of the overlap.  This is a crude way if assessing the overlap
between two gtf files. Results in a locus intersection. The
intersection keeps all records in gtf-a that intersect gtf-b

Usage
-----

Example::

   python gtf2Overlap.py --help

Type::

   python gtf2Overlap.py --help

for command line help.

Command line options
--------------------

 N/A os N/A sys N/A random N/A CGAT.Experiment E N/A CGAT.GTF GTF N/A CGAT.IOTools IOTools rpy2.robjects r R rpy2.robjects.vectors FloatVector main N/A N/A argv N/A None N/A N/A script main.

    parses command line options in sys.argv, unless *argv* is given.
     N/A N/A argv N/A N/A argv N/A sys argv N/A parser N/A N/A E OptionParser version %prog version: $Id: cgat_script_template.py 2871 2010-03-03 10:20:44Z andreas $ usage N/A N/A globals N/A __doc__ N/A N/A N/A parser add_option -a --first-gtf-file dest gtf_a type string help supply a gtf file - will compress uncompressed files N/A N/A N/A parser add_option -b --second-gtf-file dest gtf_b type string help supply a second gtf file - will compress uncompressed files N/A N/A N/A parser add_option -s --scripts-dir dest scripts_dir type string help supply a location for accessory scripts N/A N/A N/A parser add_option --no-venn dest no_venn action store_true help set if no venn is to be drawn N/A N/A options args N/A N/A E Start parser argv argv N/A gtf_files N/A N/A options gtf_a N/A options gtf_b N/A merged_files N/A N/A prefices N/A N/A N/A N/A E info merging gtf files N/A gtf gtf_files N/A N/A N/A N/A gtf endswith .gtf.gz N/A N/A outfile N/A N/A N/A IOTools snip gtf .gtf.gz .merged.gtf.gz N/A N/A N/A prefices append N/A N/A IOTools snip gtf .gtf.gz N/A N/A N/A merged_files append outfile N/A statement N/A zcat %s | python %s/gtf2gtf.py --method=merge-transcripts --log=%s.log | gzip > %s N/A gtf N/A options scripts_dir outfile outfile N/A N/A N/A P execute statement N/A N/A N/A N/A gtf endswith .gtf N/A N/A outfile N/A N/A N/A IOTools snip gtf .gtf .merged.gtf.gz N/A N/A N/A prefices append N/A N/A IOTools snip gtf .gtf N/A N/A N/A merged_files append outfile N/A statement N/A cat %s | python %s/gtf2gtf.py --method=merge-transcripts --log=%s.log | gzip  > %s N/A gtf N/A options scripts_dir outfile outfile N/A N/A N/A E execute statement N/A N/A N/A ValueError N/A cannot perform merge on %s: is not a gtf file gtf N/A prefix prefices N/A N/A N/A N/A N/A N/A options gtf_a find prefix -1 N/A N/A gtf_a N/A prefix .merged.gtf.gz N/A prefix_a prefix N/A N/A N/A N/A N/A N/A options gtf_b find prefix -1 N/A N/A gtf_b N/A prefix .merged.gtf.gz N/A prefix_b prefix N/A N/A N/A E info intersecting gtf files N/A scriptsdir N/A options scripts_dir N/A intersection_out N/A N/A N/A _vs_ join N/A prefix_a prefix_b .intersection.gtf.gz N/A statement intersectBed -a %(gtf_a)s -b %(gtf_b)s -s -wa
                 | python %(scriptsdir)s/gtf2gtf.py --method=merge-transcripts --log=log | gzip > %(intersection_out)s N/A N/A N/A P run N/A N/A N/A options no_venn N/A N/A N/A N/A E info N/A producing venn diagram for %s vs %s... N/A N/A options gtf_a N/A options gtf_b N/A intersection_file intersection_out N/A gtf_a_merged gtf_a N/A gtf_b_merged gtf_b N/A gtf_pair N/A gtf_a_merged gtf_b_merged N/A count_gtf_merged_a 0 N/A count_gtf_merged_b 0 N/A count_intersection 0 N/A gtf_iterator_a N/A N/A GTF iterator N/A N/A IOTools openFile N/A gtf_pair N/A 0 N/A gtf_iterator_b N/A N/A GTF iterator N/A N/A IOTools openFile N/A gtf_pair N/A 1 N/A gtf_iterator_intersection N/A N/A GTF iterator N/A N/A IOTools openFile intersection_file N/A N/A N/A E info N/A counting entries in %s gtf_a N/A entry gtf_iterator_a N/A N/A count_gtf_merged_a 1 N/A counts for gtf-a:  count_gtf_merged_a N/A N/A N/A E info N/A counting entries in %s gtf_b N/A entry gtf_iterator_b N/A N/A count_gtf_merged_b 1 N/A counts for gtf-b:  count_gtf_merged_b N/A N/A N/A E info N/A counting entries in %s intersection_file N/A entry gtf_iterator_intersection N/A N/A count_intersection 1 N/A counts for intersection:  count_intersection N/A result N/A N/A N/A N/A E info assembling count lists N/A N/A result N/A gtf_pair N/A gtf-b gtf-a N/A map str N/A xrange count_gtf_merged_b N/A N/A map str N/A xrange count_intersection N/A map str N/A N/A N/A random random N/A i N/A range count_intersection count_gtf_merged_a N/A R_source N/A N/A N/A os path join N/A N/A N/A os path abspath N/A options scripts_dir venn_diagram.R N/A N/A N/A R source R_source N/A prefix_a N/A N/A N/A N/A prefix_a replace . _ replace - _ N/A prefix_b N/A N/A N/A N/A prefix_b replace . _ replace - _ N/A N/A R N/A prefix.a <- "%s" prefix_a N/A N/A R N/A prefix.b <- "%s" prefix_b N/A N/A N/A E info N/A drawing venn diagram to %s N/A N/A N/A prefix_a _vs_ prefix_b .overlap.png N/A N/A N/A R N/A venn.diagram2 N/A N/A R list A N/A N/A result N/A gtf_pair N/A gtf-a B N/A N/A result N/A gtf_pair N/A gtf-b N/A N/A N/A prefix_a _vs_ prefix_b .overlap.png N/A cat.cex main.fontfamily cat.pos cat.fontfamily main.cex height width cex fontfamily lwd fill category.names margin 1.5 Arial N/A FloatVector N/A 0 0 Arial 1.8 1000 1000 2 Arial N/A N/A R c 1 1 N/A N/A R c N/A N/A R rgb 0 0 0.5 0.5 N/A N/A R rgb 0.5 0 0 0.5 N/A N/A R c prefix_a prefix_b N/A N/A R c 0.1 0.1 0.1 0.1 N/A N/A N/A E Stop N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main N/A sys argv