changeset 7:d59e3ce10e74 draft

Uploaded
author jjohnson
date Wed, 13 Dec 2017 11:15:34 -0500
parents f8e0e5e237a5
children 5c92d0be6514
files ensembl_cdna_translate.py ensembl_cdna_translate.xml macros.xml
diffstat 3 files changed, 269 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/ensembl_cdna_translate.py	Wed Nov 29 17:46:00 2017 -0500
+++ b/ensembl_cdna_translate.py	Wed Dec 13 11:15:34 2017 -0500
@@ -13,6 +13,7 @@
 """
 
 import argparse
+import re
 import sys
 from time import sleep
 
@@ -25,11 +26,11 @@
 
 server = "https://rest.ensembl.org"
 ext = "/info/assembly/homo_sapiens?"
-max_region = 5000000
+max_region = 4000000
 
 
 def ensembl_rest(ext, headers):
-    # if True: print >> sys.stderr, "%s" % ext
+    if True: print >> sys.stderr, "%s" % ext
     r = requests.get(server+ext, headers=headers)
     if r.status_code == 429:
         print >> sys.stderr, "response headers: %s\n" % r.headers
@@ -82,7 +83,7 @@
     return coord_systems
 
 
-def get_transcripts_bed(species, refseq, start, length,params=None):
+def get_transcripts_bed(species, refseq, start, length, strand='', params=None):
     bed = []
     param = params if params else ''
     req_header = {"Content-Type": "text/x-bed"}
@@ -90,8 +91,8 @@
     if not regions or regions[-1] < length:
         regions.append(length)
     for end in regions[1:]:
-        ext = "/overlap/region/%s/%s:%d-%d?feature=transcript;%s"\
-            % (species, refseq, start, end, param)
+        ext = "/overlap/region/%s/%s:%d-%d%s?feature=transcript;%s"\
+            % (species, refseq, start, end, strand, param)
         start = end + 1
         r = ensembl_rest(ext, req_header)
         if r.text:
@@ -115,8 +116,17 @@
     return get_seq(id, 'cds',params=params)
 
 
+def get_transcript_haplotypes(species,transcript):
+    ext = "/transcript_haplotypes/%s/%s?aligned_sequences=1" % (species,transcript)
+    req_header = {"Content-Type" : "application/json"}
+    r = ensembl_rest(ext, req_header)
+    decoded = r.json()
+
+
 def bed_from_line(line):
     fields = line.rstrip('\r\n').split('\t')
+    if len(fields) < 12:
+        return None
     (chrom, chromStart, chromEnd, name, score, strand,
      thickStart, thickEnd, itemRgb,
      blockCount, blockSizes, blockStarts) = fields[0:12]
@@ -127,6 +137,15 @@
                          blockCount=blockCount,
                          blockSizes=blockSizes.rstrip(','),
                          blockStarts=blockStarts.rstrip(','))
+    if len(fields) == 20:
+        bed_entry.second_name = fields[12]
+        bed_entry.cds_start_status = fields[13]
+        bed_entry.cds_end_status = fields[14]
+        bed_entry.exon_frames = fields[15]
+        bed_entry.biotype = fields[16]
+        bed_entry.gene_name = fields[17]
+        bed_entry.second_gene_name = fields[18]
+        bed_entry.gene_type = fields[19]
     return bed_entry
 
 
@@ -157,6 +176,14 @@
             self.blockStarts = [int(x) for x in blockStarts]
         else:
             self.blockStarts = blockStarts
+        self.second_name = None
+        self.cds_start_status = None
+        self.cds_end_status = None
+        self.exon_frames = None
+        self.biotype = None
+        self.gene_name = None
+        self.second_gene_name = None
+        self.gene_type = None
         self.seq = None
         self.pep = None
 
@@ -246,6 +273,9 @@
         '-s', '--species', default='human',
         help='Ensembl Species to retrieve')
     parser.add_argument(
+        '-R', '--regions', action='append', default=[],
+        help='Restrict Ensembl retrieval to regions e.g.: X,2:20000-25000,3:100-500+')
+    parser.add_argument(
         '-B', '--biotypes', action='append', default=[],
         help='Restrict Ensembl biotypes to retrieve')
     parser.add_argument(
@@ -295,6 +325,22 @@
     biotypes = ';'.join(['biotype=%s' % bt.strip() for biotype in args.biotypes for bt in biotype.split(',') if  bt.strip()]) 
     # print >> sys.stderr, "biotypes: %s" % biotypes
 
+    selected_regions = dict() # chrom:(start,end)
+    region_pat = '^([^:]+)(?::(\d*)(?:-(\d+)([+-])?)?)?'
+    if args.regions:
+        for entry in args.regions:
+           if not entry:
+               continue
+           regs = [x.strip() for x in entry.split(',') if x.strip()]
+           for reg in regs:
+               m = re.match(region_pat,reg)
+               if m:
+                   (chrom,start,end,strand) = m.groups()
+                   if chrom:
+                       if chrom not in selected_regions:
+                           selected_regions[chrom] = []
+                       selected_regions[chrom].append([start,end,strand])
+
     translations = dict()  # start : end : seq
 
     def unique_prot(tbed, seq):
@@ -364,11 +410,44 @@
                     aa_start = aa_end + 1
         return translate_count
 
+    def translate_region(species,ref,start,stop,strand):
+        translation_count = 0
+        regions = range(start, stop, max_region)
+        if not regions or regions[-1] < stop:
+            regions.append(stop)
+        for end in regions[1:]:
+            bedlines = get_transcripts_bed(species, ref, start, end, strand=strand, params=biotypes)
+            if args.verbose or args.debug:
+                print >> sys.stderr,\
+                    "%s\t%s\tstart: %d\tend: %d\tcDNA transcripts:%d"\
+                    % (species, ref, start, end, len(bedlines))
+            # start, end, seq
+            for i, bedline in enumerate(bedlines):
+                try:
+                    bed = bed_from_line(bedline)\
+                        if any([not args.raw, fa_wtr, bed_wtr])\
+                        else None
+                    if tx_wtr:
+                        tx_wtr.write(bedline if args.raw else str(bed))
+                        tx_wtr.write("\n")
+                        tx_wtr.flush()
+                    if bed:
+                        translation_count += translate_bed(bed)
+                except Exception as e:
+                    print >> sys.stderr,\
+                        "BED error (%s) : %s\n" % (e, bedline)
+            start = end + 1
+        return translation_count
+
     if input_rdr:
         translation_count = 0
         for i, bedline in enumerate(input_rdr):
             try:
                 bed = bed_from_line(bedline)
+                if bed is None:
+                    continue
+                if bed.biotype and biotypea and bed.biotype not in biotypea:
+                    continue
                 translation_count += translate_bed(bed)
             except:
                 print >> sys.stderr, "BED format error: %s\n" % bedline
@@ -378,48 +457,38 @@
     else:
         coord_systems = get_toplevel(species)
         if 'chromosome' in coord_systems:
+            ref_lengths = dict()
             for ref in sorted(coord_systems['chromosome'].keys()):
                 length = coord_systems['chromosome'][ref]
+                ref_lengths[ref] = length
                 if not any([tx_wtr, fa_wtr, bed_wtr]):
                     print >> sys.stderr,\
                         "%s\t%s\tlength: %d" % (species, ref, length)
-                    continue
-                if args.debug:
-                    print >> sys.stderr,\
-                        "Retrieving transcripts: %s\t%s\tlength: %d"\
-                        % (species, ref, length)
+            if selected_regions:
                 translation_count = 0
+                for ref in sorted(selected_regions.keys()):
+                    if ref in ref_lengths:
+                        for reg in selected_regions[ref]:
+                            (_start,_stop,_strand) = reg
+                            start = int(_start) if _start else 0
+                            stop = int(_stop) if _stop else ref_lengths[ref]
+                            strand = '' if not _strand else ':1' if _strand == '+' else  ':-1'
+                            translation_count += translate_region(species,ref,start,stop,strand)
+            else:
+                strand = ''
                 start = 0
-                regions = range(start, length, max_region)
-                if not regions or regions[-1] < length:
-                    regions.append(length)
-                for end in regions[1:]:
-                    bedlines = get_transcripts_bed(species, ref, start, end, params=biotypes)
-                    if args.verbose or args.debug:
+                for ref in sorted(ref_lengths.keys()):
+                    length = ref_lengths[ref]
+                    translation_count = 0
+                    if args.debug:
                         print >> sys.stderr,\
-                            "%s\t%s\tstart: %d\tend: %d\tcDNA transcripts:%d"\
-                            % (species, ref, start, end, len(bedlines))
-                    # start, end, seq
-                    for i, bedline in enumerate(bedlines):
-                        try:
-                            bed = bed_from_line(bedline)\
-                                if any([not args.raw, fa_wtr, bed_wtr])\
-                                else None
-                            if tx_wtr:
-                                tx_wtr.write(bedline if args.raw else str(bed))
-                                tx_wtr.write("\n")
-                                tx_wtr.flush()
-                            if bed:
-                                translation_count += translate_bed(bed)
-                        except Exception as e:
-                            print >> sys.stderr,\
-                                "BED error (%s) : %s\n" % (e, bedline)
-                    start = end + 1
-
-                if args.debug or (args.verbose and any([fa_wtr, bed_wtr])):
-                    print >> sys.stderr,\
-                        "%s\t%s\tlength: %d\tcDNA translations:%d"\
-                        % (species, ref, length, translation_count)
+                            "Retrieving transcripts: %s\t%s\tlength: %d"\
+                            % (species, ref, length)
+                    translation_count += translate_region(species,ref,start,length,strand)
+                    if args.debug or (args.verbose and any([fa_wtr, bed_wtr])):
+                        print >> sys.stderr,\
+                            "%s\t%s\tlength: %d\tcDNA translations:%d"\
+                            % (species, ref, length, translation_count)
 
 
 if __name__ == "__main__":
--- a/ensembl_cdna_translate.xml	Wed Nov 29 17:46:00 2017 -0500
+++ b/ensembl_cdna_translate.xml	Wed Dec 13 11:15:34 2017 -0500
@@ -1,5 +1,8 @@
 <tool id="ensembl_cdna_translate" name="Ensembl cDNA Translations" version="0.1.0">
     <description>using Ensembl REST API</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
     <requirements>
         <requirement type="package" version="0.4.10">requests-cache</requirement>
         <requirement type="package" version="1.62">biopython</requirement>
@@ -8,16 +11,19 @@
         <exit_code range="1:" />
     </stdio>
     <command><![CDATA[
-        #if $input:
-            cat '$input' 
+        #if $features.feature_src == 'history_bed':
+            cat '$features.input' 
         #else
             python '$__tool_directory__/ensembl_cdna_translate.py'  
             #if $species:
                 --species '$species'
             #end if
-            $transcript_raw
-            #if $biotypes:
-                --biotypes '$biotypes'
+            $features.transcript_raw
+            #if $features.biotypes:
+                --biotypes '$features.biotypes'
+            #end if
+            #if $features.regions:
+                --regions '$features.regions'
             #end if
             #if str($output_choice).find('transcript_bed') >= 0:
                 --transcripts 
@@ -45,6 +51,9 @@
             #if str($output_choice).find('translation_fasta') >= 0: 
                 --fasta '$translation_fasta'
             #end if
+            ###if $features.biotypes:
+            ##    --biotypes '$features.biotypes'
+            ###end if
         #end if
        
     ]]></command>
@@ -52,125 +61,40 @@
         <param name="species" type="text" value="" label="Ensembl species" >
             <help>
             </help>
-            <option value="homo_sapiens">homo_sapiens  (Human) taxon_id: 9606</option>
-            <option value="mus_musculus">mus_musculus  (Mouse) taxon_id: 10090</option>
-            <option value="ailuropoda_melanoleuca">ailuropoda_melanoleuca  (Panda) taxon_id: 9646</option>
-            <option value="anas_platyrhynchos">anas_platyrhynchos  (Duck) taxon_id: 8839</option>
-            <option value="anolis_carolinensis">anolis_carolinensis  (Anole lizard) taxon_id: 28377</option>
-            <option value="astyanax_mexicanus">astyanax_mexicanus  (Cave fish) taxon_id: 7994</option>
-            <option value="bos_taurus">bos_taurus  (Cow) taxon_id: 9913</option>
-            <option value="caenorhabditis_elegans">caenorhabditis_elegans  (Caenorhabditis elegans) taxon_id: 6239</option>
-            <option value="callithrix_jacchus">callithrix_jacchus  (Marmoset) taxon_id: 9483</option>
-            <option value="canis_familiaris">canis_familiaris  (Dog) taxon_id: 9615</option>
-            <option value="carlito_syrichta">carlito_syrichta  (Tarsier) taxon_id: 1868482</option>
-            <option value="cavia_aperea">cavia_aperea  (Brazilian guinea pig) taxon_id: 37548</option>
-            <option value="cavia_porcellus">cavia_porcellus  (Guinea Pig) taxon_id: 10141</option>
-            <option value="chinchilla_lanigera">chinchilla_lanigera  (Long-tailed chinchilla) taxon_id: 34839</option>
-            <option value="chlorocebus_sabaeus">chlorocebus_sabaeus  (Vervet-AGM) taxon_id: 60711</option>
-            <option value="choloepus_hoffmanni">choloepus_hoffmanni  (Sloth) taxon_id: 9358</option>
-            <option value="ciona_intestinalis">ciona_intestinalis  (C.intestinalis) taxon_id: 7719</option>
-            <option value="ciona_savignyi">ciona_savignyi  (C.savignyi) taxon_id: 51511</option>
-            <option value="cricetulus_griseus_chok1gshd">cricetulus_griseus_chok1gshd  (Chinese hamster CHOK1GS) taxon_id: 10029</option>
-            <option value="cricetulus_griseus_crigri">cricetulus_griseus_crigri  (Chinese hamster CriGri) taxon_id: 10029</option>
-            <option value="danio_rerio">danio_rerio  (Zebrafish) taxon_id: 7955</option>
-            <option value="dasypus_novemcinctus">dasypus_novemcinctus  (Armadillo) taxon_id: 9361</option>
-            <option value="dipodomys_ordii">dipodomys_ordii  (Kangaroo rat) taxon_id: 10020</option>
-            <option value="drosophila_melanogaster">drosophila_melanogaster  (Fruitfly) taxon_id: 7227</option>
-            <option value="echinops_telfairi">echinops_telfairi  (Lesser hedgehog tenrec) taxon_id: 9371</option>
-            <option value="equus_caballus">equus_caballus  (Horse) taxon_id: 9796</option>
-            <option value="erinaceus_europaeus">erinaceus_europaeus  (Hedgehog) taxon_id: 9365</option>
-            <option value="felis_catus">felis_catus  (Cat) taxon_id: 9685</option>
-            <option value="ficedula_albicollis">ficedula_albicollis  (Flycatcher) taxon_id: 59894</option>
-            <option value="fukomys_damarensis">fukomys_damarensis  (Damara mole rat) taxon_id: 885580</option>
-            <option value="gadus_morhua">gadus_morhua  (Cod) taxon_id: 8049</option>
-            <option value="gallus_gallus">gallus_gallus  (Chicken) taxon_id: 9031</option>
-            <option value="gasterosteus_aculeatus">gasterosteus_aculeatus  (Stickleback) taxon_id: 69293</option>
-            <option value="gorilla_gorilla">gorilla_gorilla  (Gorilla) taxon_id: 9595</option>
-            <option value="heterocephalus_glaber_female">heterocephalus_glaber_female  (Naked mole-rat female) taxon_id: 10181</option>
-            <option value="heterocephalus_glaber_male">heterocephalus_glaber_male  (Naked mole-rat male) taxon_id: 10181</option>
-            <option value="ictidomys_tridecemlineatus">ictidomys_tridecemlineatus  (Squirrel) taxon_id: 43179</option>
-            <option value="jaculus_jaculus">jaculus_jaculus  (Lesser Egyptian jerboa) taxon_id: 51337</option>
-            <option value="latimeria_chalumnae">latimeria_chalumnae  (Coelacanth) taxon_id: 7897</option>
-            <option value="lepisosteus_oculatus">lepisosteus_oculatus  (Spotted gar) taxon_id: 7918</option>
-            <option value="loxodonta_africana">loxodonta_africana  (Elephant) taxon_id: 9785</option>
-            <option value="macaca_mulatta">macaca_mulatta  (Macaque) taxon_id: 9544</option>
-            <option value="meleagris_gallopavo">meleagris_gallopavo  (Turkey) taxon_id: 9103</option>
-            <option value="mesocricetus_auratus">mesocricetus_auratus  (Golden Hamster) taxon_id: 10036</option>
-            <option value="microcebus_murinus">microcebus_murinus  (Mouse Lemur) taxon_id: 30608</option>
-            <option value="microtus_ochrogaster">microtus_ochrogaster  (Prairie vole) taxon_id: 79684</option>
-            <option value="monodelphis_domestica">monodelphis_domestica  (Opossum) taxon_id: 13616</option>
-            <option value="mus_caroli">mus_caroli  (Ryukyu mouse) taxon_id: 10089</option>
-            <option value="mus_musculus_129s1svimj">mus_musculus_129s1svimj  (Mouse 129S1/SvImJ) taxon_id: 10090</option>
-            <option value="mus_musculus_aj">mus_musculus_aj  (Mouse A/J) taxon_id: 10090</option>
-            <option value="mus_musculus_akrj">mus_musculus_akrj  (Mouse AKR/J) taxon_id: 10090</option>
-            <option value="mus_musculus_balbcj">mus_musculus_balbcj  (Mouse BALB/cJ) taxon_id: 10090</option>
-            <option value="mus_musculus_c3hhej">mus_musculus_c3hhej  (Mouse C3H/HeJ) taxon_id: 10090</option>
-            <option value="mus_musculus_c57bl6nj">mus_musculus_c57bl6nj  (Mouse C57BL/6NJ) taxon_id: 10090</option>
-            <option value="mus_musculus_casteij">mus_musculus_casteij  (Mouse CAST/EiJ) taxon_id: 10091</option>
-            <option value="mus_musculus_cbaj">mus_musculus_cbaj  (Mouse CBA/J) taxon_id: 10090</option>
-            <option value="mus_musculus_dba2j">mus_musculus_dba2j  (Mouse DBA/2J) taxon_id: 10090</option>
-            <option value="mus_musculus_fvbnj">mus_musculus_fvbnj  (Mouse FVB/NJ) taxon_id: 10090</option>
-            <option value="mus_musculus_lpj">mus_musculus_lpj  (Mouse LP/J) taxon_id: 10090</option>
-            <option value="mus_musculus_nodshiltj">mus_musculus_nodshiltj  (Mouse NOD/ShiLtJ) taxon_id: 10090</option>
-            <option value="mus_musculus_nzohlltj">mus_musculus_nzohlltj  (Mouse NZO/HlLtJ) taxon_id: 10090</option>
-            <option value="mus_musculus_pwkphj">mus_musculus_pwkphj  (Mouse PWK/PhJ) taxon_id: 39442</option>
-            <option value="mus_musculus_wsbeij">mus_musculus_wsbeij  (Mouse WSB/EiJ) taxon_id: 10092</option>
-            <option value="mus_pahari">mus_pahari  (Shrew mouse) taxon_id: 10093</option>
-            <option value="mus_spretus_spreteij">mus_spretus_spreteij  (Algerian mouse) taxon_id: 10096</option>
-            <option value="mustela_putorius_furo">mustela_putorius_furo  (Ferret) taxon_id: 9669</option>
-            <option value="myotis_lucifugus">myotis_lucifugus  (Microbat) taxon_id: 59463</option>
-            <option value="nannospalax_galili">nannospalax_galili  (Upper Galilee mountains blind mole rat) taxon_id: 1026970</option>
-            <option value="nomascus_leucogenys">nomascus_leucogenys  (Gibbon) taxon_id: 61853</option>
-            <option value="notamacropus_eugenii">notamacropus_eugenii  (Wallaby) taxon_id: 9315</option>
-            <option value="ochotona_princeps">ochotona_princeps  (Pika) taxon_id: 9978</option>
-            <option value="octodon_degus">octodon_degus  (Degu) taxon_id: 10160</option>
-            <option value="oreochromis_niloticus">oreochromis_niloticus  (Tilapia) taxon_id: 8128</option>
-            <option value="ornithorhynchus_anatinus">ornithorhynchus_anatinus  (Platypus) taxon_id: 9258</option>
-            <option value="oryctolagus_cuniculus">oryctolagus_cuniculus  (Rabbit) taxon_id: 9986</option>
-            <option value="oryzias_latipes">oryzias_latipes  (Medaka) taxon_id: 8090</option>
-            <option value="otolemur_garnettii">otolemur_garnettii  (Bushbaby) taxon_id: 30611</option>
-            <option value="ovis_aries">ovis_aries  (Sheep) taxon_id: 9940</option>
-            <option value="pan_troglodytes">pan_troglodytes  (Chimpanzee) taxon_id: 9598</option>
-            <option value="papio_anubis">papio_anubis  (Olive baboon) taxon_id: 9555</option>
-            <option value="pelodiscus_sinensis">pelodiscus_sinensis  (Chinese softshell turtle) taxon_id: 13735</option>
-            <option value="peromyscus_maniculatus_bairdii">peromyscus_maniculatus_bairdii  (Northern American deer mouse) taxon_id: 230844</option>
-            <option value="petromyzon_marinus">petromyzon_marinus  (Lamprey) taxon_id: 7757</option>
-            <option value="poecilia_formosa">poecilia_formosa  (Amazon molly) taxon_id: 48698</option>
-            <option value="pongo_abelii">pongo_abelii  (Orangutan) taxon_id: 9601</option>
-            <option value="procavia_capensis">procavia_capensis  (Hyrax) taxon_id: 9813</option>
-            <option value="pteropus_vampyrus">pteropus_vampyrus  (Megabat) taxon_id: 132908</option>
-            <option value="rattus_norvegicus">rattus_norvegicus  (Rat) taxon_id: 10116</option>
-            <option value="saccharomyces_cerevisiae">saccharomyces_cerevisiae  (Saccharomyces cerevisiae) taxon_id: 4932</option>
-            <option value="sarcophilus_harrisii">sarcophilus_harrisii  (Tasmanian devil) taxon_id: 9305</option>
-            <option value="sorex_araneus">sorex_araneus  (Shrew) taxon_id: 42254</option>
-            <option value="sus_scrofa">sus_scrofa  (Pig) taxon_id: 9823</option>
-            <option value="taeniopygia_guttata">taeniopygia_guttata  (Zebra Finch) taxon_id: 59729</option>
-            <option value="takifugu_rubripes">takifugu_rubripes  (Fugu) taxon_id: 31033</option>
-            <option value="tetraodon_nigroviridis">tetraodon_nigroviridis  (Tetraodon) taxon_id: 99883</option>
-            <option value="tupaia_belangeri">tupaia_belangeri  (Tree Shrew) taxon_id: 37347</option>
-            <option value="tursiops_truncatus">tursiops_truncatus  (Dolphin) taxon_id: 9739</option>
-            <option value="vicugna_pacos">vicugna_pacos  (Alpaca) taxon_id: 30538</option>
-            <option value="xenopus_tropicalis">xenopus_tropicalis  (Xenopus) taxon_id: 8364</option>
-            <option value="xiphophorus_maculatus">xiphophorus_maculatus  (Platyfish) taxon_id: 8083</option>
+            <expand macro="species_options" />
+        </param>
+        <conditional name="features">
+            <param name="feature_src" type="select" label="Features to translate">
+                <option value="ensembl_rest">Retrieve from Ensembl</option>
+                <option value="history_bed">Use Ensembl BED file</option>
+            </param>
+            <when value="ensembl_rest">
+                <param name="transcript_raw" type="boolean" truevalue="--raw" falsevalue="" checked="true" 
+                    label="Keep extra columns from ensembl BED"/>
+                <param name="biotypes" type="text" value="" optional="true" label="Restrict Feature retrieval to these biotypes" >
+                    <expand macro="biotypes_help" />
+                </param>
+                <param name="regions" type="text" value="" optional="true" label="Restrict Feature retrieval to comma-separated list of regions" >
+                    <help>Each region is specifed as: chr or chr:pos or chr:from-to</help>
+                    <validator type="regex" message="">^(\w+(:\d+(-\d+)?)?(,\w+(:\d+(-\d+)?)?)*)?$</validator>
+                </param>
+            </when>
+            <when value="history_bed">
+                <param name="input" type="data" format="bed" optional="true" label="A BED file with 12 columns" 
+                    help="thickStart and thickEnd define protein coding region, blocks define exon regions"/>
+                <param name="biotypes" type="text" value="" optional="true" label="Restrict Feature translation to these biotypes" >
+                    <expand macro="biotypes_help" />
+                </param>
+            </when>
+        </conditional>
+        <!--
+        <conditional name="translations">
+        </conditional>
+        -->
 
-        </param>
-        <param name="biotypes" type="text" value="" optional="true" label="Restrict to these biotypes" >
-            <help><![CDATA[
-Example biotypes: 
-protein_coding, non_coding, pseudogene, nonsense_mediated_decay, non_stop_decay, 
-translated_processed_pseudogene, transcribed_processed_pseudogene, transcribed_unitary_pseudogene, transcribed_unprocessed_pseudogene, 
-polymorphic_pseudogene, processed_pseudogene, unprocessed_pseudogene, unitary_pseudogene, processed_transcript, 
-retained_intron, ccds_gene, sense_overlapping, sense_intronic, cdna_update, antisense, 
-LRG_gene, IG_C_gene, IG_D_gene, IG_J_gene, IG_LV_gene IG_V_gene, TR_C_gene, TR_D_gene, TR_J_gene, TR_V_gene, 
-IG_pseudogene, IG_C_pseudogene, IG_D_pseudogene, IG_J_pseudogene, IG_V_pseudogene, TR_J_pseudogene, TR_V_pseudogene, TEC, 
-ribozyme, RNase_P_RNA, guide_RNA, macro_lncRNA, bidirectional_promoter_lncRNA, 3prime_overlapping_ncRNA, antisense_RNA, vaultRNA, Y_RNA, SRP_RNA, RNase_MRP_RNA, IG_C_pseudogene, lncRNA, lincRNA, miRNA, snRNA, sRNA, telomerase_RNA, Mt_tRNA, Mt_rRNA, scaRNA, misc_RNA, rRNA, tRNA, scRNA, snoRNA, other
-            ]]></help>
-        </param>
-        <param name="input" type="data" format="bed" optional="true" label="A BED file with 12 columns, thickStart and thickEnd define protein coding region"/>
+
         <param name="translate_all" type="boolean" truevalue="--all" falsevalue="" checked="false" 
             label="Report all translations (Default is non reference protein sequences)"/>
-        <param name="transcript_raw" type="boolean" truevalue="--raw" falsevalue="" checked="true" 
-            label="Keep extra columns from ensembl BED"/>
         <param name="output_choice" type="select" multiple="true" display="checkboxes" label="Outputs">
             <option value="transcript_bed">transcripts.bed</option>
             <option value="translation_bed">translation.bed</option>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Wed Dec 13 11:15:34 2017 -0500
@@ -0,0 +1,116 @@
+<macros>
+    <xml name="species_options">
+            <option value="homo_sapiens">homo_sapiens  (Human) taxon_id: 9606</option>
+            <option value="mus_musculus">mus_musculus  (Mouse) taxon_id: 10090</option>
+            <option value="ailuropoda_melanoleuca">ailuropoda_melanoleuca  (Panda) taxon_id: 9646</option>
+            <option value="anas_platyrhynchos">anas_platyrhynchos  (Duck) taxon_id: 8839</option>
+            <option value="anolis_carolinensis">anolis_carolinensis  (Anole lizard) taxon_id: 28377</option>
+            <option value="astyanax_mexicanus">astyanax_mexicanus  (Cave fish) taxon_id: 7994</option>
+            <option value="bos_taurus">bos_taurus  (Cow) taxon_id: 9913</option>
+            <option value="caenorhabditis_elegans">caenorhabditis_elegans  (Caenorhabditis elegans) taxon_id: 6239</option>
+            <option value="callithrix_jacchus">callithrix_jacchus  (Marmoset) taxon_id: 9483</option>
+            <option value="canis_familiaris">canis_familiaris  (Dog) taxon_id: 9615</option>
+            <option value="carlito_syrichta">carlito_syrichta  (Tarsier) taxon_id: 1868482</option>
+            <option value="cavia_aperea">cavia_aperea  (Brazilian guinea pig) taxon_id: 37548</option>
+            <option value="cavia_porcellus">cavia_porcellus  (Guinea Pig) taxon_id: 10141</option>
+            <option value="chinchilla_lanigera">chinchilla_lanigera  (Long-tailed chinchilla) taxon_id: 34839</option>
+            <option value="chlorocebus_sabaeus">chlorocebus_sabaeus  (Vervet-AGM) taxon_id: 60711</option>
+            <option value="choloepus_hoffmanni">choloepus_hoffmanni  (Sloth) taxon_id: 9358</option>
+            <option value="ciona_intestinalis">ciona_intestinalis  (C.intestinalis) taxon_id: 7719</option>
+            <option value="ciona_savignyi">ciona_savignyi  (C.savignyi) taxon_id: 51511</option>
+            <option value="cricetulus_griseus_chok1gshd">cricetulus_griseus_chok1gshd  (Chinese hamster CHOK1GS) taxon_id: 10029</option>
+            <option value="cricetulus_griseus_crigri">cricetulus_griseus_crigri  (Chinese hamster CriGri) taxon_id: 10029</option>
+            <option value="danio_rerio">danio_rerio  (Zebrafish) taxon_id: 7955</option>
+            <option value="dasypus_novemcinctus">dasypus_novemcinctus  (Armadillo) taxon_id: 9361</option>
+            <option value="dipodomys_ordii">dipodomys_ordii  (Kangaroo rat) taxon_id: 10020</option>
+            <option value="drosophila_melanogaster">drosophila_melanogaster  (Fruitfly) taxon_id: 7227</option>
+            <option value="echinops_telfairi">echinops_telfairi  (Lesser hedgehog tenrec) taxon_id: 9371</option>
+            <option value="equus_caballus">equus_caballus  (Horse) taxon_id: 9796</option>
+            <option value="erinaceus_europaeus">erinaceus_europaeus  (Hedgehog) taxon_id: 9365</option>
+            <option value="felis_catus">felis_catus  (Cat) taxon_id: 9685</option>
+            <option value="ficedula_albicollis">ficedula_albicollis  (Flycatcher) taxon_id: 59894</option>
+            <option value="fukomys_damarensis">fukomys_damarensis  (Damara mole rat) taxon_id: 885580</option>
+            <option value="gadus_morhua">gadus_morhua  (Cod) taxon_id: 8049</option>
+            <option value="gallus_gallus">gallus_gallus  (Chicken) taxon_id: 9031</option>
+            <option value="gasterosteus_aculeatus">gasterosteus_aculeatus  (Stickleback) taxon_id: 69293</option>
+            <option value="gorilla_gorilla">gorilla_gorilla  (Gorilla) taxon_id: 9595</option>
+            <option value="heterocephalus_glaber_female">heterocephalus_glaber_female  (Naked mole-rat female) taxon_id: 10181</option>
+            <option value="heterocephalus_glaber_male">heterocephalus_glaber_male  (Naked mole-rat male) taxon_id: 10181</option>
+            <option value="ictidomys_tridecemlineatus">ictidomys_tridecemlineatus  (Squirrel) taxon_id: 43179</option>
+            <option value="jaculus_jaculus">jaculus_jaculus  (Lesser Egyptian jerboa) taxon_id: 51337</option>
+            <option value="latimeria_chalumnae">latimeria_chalumnae  (Coelacanth) taxon_id: 7897</option>
+            <option value="lepisosteus_oculatus">lepisosteus_oculatus  (Spotted gar) taxon_id: 7918</option>
+            <option value="loxodonta_africana">loxodonta_africana  (Elephant) taxon_id: 9785</option>
+            <option value="macaca_mulatta">macaca_mulatta  (Macaque) taxon_id: 9544</option>
+            <option value="meleagris_gallopavo">meleagris_gallopavo  (Turkey) taxon_id: 9103</option>
+            <option value="mesocricetus_auratus">mesocricetus_auratus  (Golden Hamster) taxon_id: 10036</option>
+            <option value="microcebus_murinus">microcebus_murinus  (Mouse Lemur) taxon_id: 30608</option>
+            <option value="microtus_ochrogaster">microtus_ochrogaster  (Prairie vole) taxon_id: 79684</option>
+            <option value="monodelphis_domestica">monodelphis_domestica  (Opossum) taxon_id: 13616</option>
+            <option value="mus_caroli">mus_caroli  (Ryukyu mouse) taxon_id: 10089</option>
+            <option value="mus_musculus_129s1svimj">mus_musculus_129s1svimj  (Mouse 129S1/SvImJ) taxon_id: 10090</option>
+            <option value="mus_musculus_aj">mus_musculus_aj  (Mouse A/J) taxon_id: 10090</option>
+            <option value="mus_musculus_akrj">mus_musculus_akrj  (Mouse AKR/J) taxon_id: 10090</option>
+            <option value="mus_musculus_balbcj">mus_musculus_balbcj  (Mouse BALB/cJ) taxon_id: 10090</option>
+            <option value="mus_musculus_c3hhej">mus_musculus_c3hhej  (Mouse C3H/HeJ) taxon_id: 10090</option>
+            <option value="mus_musculus_c57bl6nj">mus_musculus_c57bl6nj  (Mouse C57BL/6NJ) taxon_id: 10090</option>
+            <option value="mus_musculus_casteij">mus_musculus_casteij  (Mouse CAST/EiJ) taxon_id: 10091</option>
+            <option value="mus_musculus_cbaj">mus_musculus_cbaj  (Mouse CBA/J) taxon_id: 10090</option>
+            <option value="mus_musculus_dba2j">mus_musculus_dba2j  (Mouse DBA/2J) taxon_id: 10090</option>
+            <option value="mus_musculus_fvbnj">mus_musculus_fvbnj  (Mouse FVB/NJ) taxon_id: 10090</option>
+            <option value="mus_musculus_lpj">mus_musculus_lpj  (Mouse LP/J) taxon_id: 10090</option>
+            <option value="mus_musculus_nodshiltj">mus_musculus_nodshiltj  (Mouse NOD/ShiLtJ) taxon_id: 10090</option>
+            <option value="mus_musculus_nzohlltj">mus_musculus_nzohlltj  (Mouse NZO/HlLtJ) taxon_id: 10090</option>
+            <option value="mus_musculus_pwkphj">mus_musculus_pwkphj  (Mouse PWK/PhJ) taxon_id: 39442</option>
+            <option value="mus_musculus_wsbeij">mus_musculus_wsbeij  (Mouse WSB/EiJ) taxon_id: 10092</option>
+            <option value="mus_pahari">mus_pahari  (Shrew mouse) taxon_id: 10093</option>
+            <option value="mus_spretus_spreteij">mus_spretus_spreteij  (Algerian mouse) taxon_id: 10096</option>
+            <option value="mustela_putorius_furo">mustela_putorius_furo  (Ferret) taxon_id: 9669</option>
+            <option value="myotis_lucifugus">myotis_lucifugus  (Microbat) taxon_id: 59463</option>
+            <option value="nannospalax_galili">nannospalax_galili  (Upper Galilee mountains blind mole rat) taxon_id: 1026970</option>
+            <option value="nomascus_leucogenys">nomascus_leucogenys  (Gibbon) taxon_id: 61853</option>
+            <option value="notamacropus_eugenii">notamacropus_eugenii  (Wallaby) taxon_id: 9315</option>
+            <option value="ochotona_princeps">ochotona_princeps  (Pika) taxon_id: 9978</option>
+            <option value="octodon_degus">octodon_degus  (Degu) taxon_id: 10160</option>
+            <option value="oreochromis_niloticus">oreochromis_niloticus  (Tilapia) taxon_id: 8128</option>
+            <option value="ornithorhynchus_anatinus">ornithorhynchus_anatinus  (Platypus) taxon_id: 9258</option>
+            <option value="oryctolagus_cuniculus">oryctolagus_cuniculus  (Rabbit) taxon_id: 9986</option>
+            <option value="oryzias_latipes">oryzias_latipes  (Medaka) taxon_id: 8090</option>
+            <option value="otolemur_garnettii">otolemur_garnettii  (Bushbaby) taxon_id: 30611</option>
+            <option value="ovis_aries">ovis_aries  (Sheep) taxon_id: 9940</option>
+            <option value="pan_troglodytes">pan_troglodytes  (Chimpanzee) taxon_id: 9598</option>
+            <option value="papio_anubis">papio_anubis  (Olive baboon) taxon_id: 9555</option>
+            <option value="pelodiscus_sinensis">pelodiscus_sinensis  (Chinese softshell turtle) taxon_id: 13735</option>
+            <option value="peromyscus_maniculatus_bairdii">peromyscus_maniculatus_bairdii  (Northern American deer mouse) taxon_id: 230844</option>
+            <option value="petromyzon_marinus">petromyzon_marinus  (Lamprey) taxon_id: 7757</option>
+            <option value="poecilia_formosa">poecilia_formosa  (Amazon molly) taxon_id: 48698</option>
+            <option value="pongo_abelii">pongo_abelii  (Orangutan) taxon_id: 9601</option>
+            <option value="procavia_capensis">procavia_capensis  (Hyrax) taxon_id: 9813</option>
+            <option value="pteropus_vampyrus">pteropus_vampyrus  (Megabat) taxon_id: 132908</option>
+            <option value="rattus_norvegicus">rattus_norvegicus  (Rat) taxon_id: 10116</option>
+            <option value="saccharomyces_cerevisiae">saccharomyces_cerevisiae  (Saccharomyces cerevisiae) taxon_id: 4932</option>
+            <option value="sarcophilus_harrisii">sarcophilus_harrisii  (Tasmanian devil) taxon_id: 9305</option>
+            <option value="sorex_araneus">sorex_araneus  (Shrew) taxon_id: 42254</option>
+            <option value="sus_scrofa">sus_scrofa  (Pig) taxon_id: 9823</option>
+            <option value="taeniopygia_guttata">taeniopygia_guttata  (Zebra Finch) taxon_id: 59729</option>
+            <option value="takifugu_rubripes">takifugu_rubripes  (Fugu) taxon_id: 31033</option>
+            <option value="tetraodon_nigroviridis">tetraodon_nigroviridis  (Tetraodon) taxon_id: 99883</option>
+            <option value="tupaia_belangeri">tupaia_belangeri  (Tree Shrew) taxon_id: 37347</option>
+            <option value="tursiops_truncatus">tursiops_truncatus  (Dolphin) taxon_id: 9739</option>
+            <option value="vicugna_pacos">vicugna_pacos  (Alpaca) taxon_id: 30538</option>
+            <option value="xenopus_tropicalis">xenopus_tropicalis  (Xenopus) taxon_id: 8364</option>
+            <option value="xiphophorus_maculatus">xiphophorus_maculatus  (Platyfish) taxon_id: 8083</option>
+    </xml>
+    <xml name="biotypes_help">
+            <help><![CDATA[
+Example biotypes: 
+protein_coding, non_coding, pseudogene, nonsense_mediated_decay, non_stop_decay, 
+translated_processed_pseudogene, transcribed_processed_pseudogene, transcribed_unitary_pseudogene, transcribed_unprocessed_pseudogene, 
+polymorphic_pseudogene, processed_pseudogene, unprocessed_pseudogene, unitary_pseudogene, processed_transcript, 
+retained_intron, ccds_gene, sense_overlapping, sense_intronic, cdna_update, antisense, 
+LRG_gene, IG_C_gene, IG_D_gene, IG_J_gene, IG_LV_gene IG_V_gene, TR_C_gene, TR_D_gene, TR_J_gene, TR_V_gene, 
+IG_pseudogene, IG_C_pseudogene, IG_D_pseudogene, IG_J_pseudogene, IG_V_pseudogene, TR_J_pseudogene, TR_V_pseudogene, TEC, 
+ribozyme, RNase_P_RNA, guide_RNA, macro_lncRNA, bidirectional_promoter_lncRNA, 3prime_overlapping_ncRNA, antisense_RNA, vaultRNA, Y_RNA, SRP_RNA, RNase_MRP_RNA, IG_C_pseudogene, lncRNA, lincRNA, miRNA, snRNA, sRNA, telomerase_RNA, Mt_tRNA, Mt_rRNA, scaRNA, misc_RNA, rRNA, tRNA, scRNA, snoRNA, other
+            ]]></help>
+    </xml>
+</macros>