Commit message:
Uploaded |
added:
test-data/._translated_bed_sequences.fa test-data/Extract_Genomic_DNA.bed test-data/translated_bed_sequences.fa tool_dependencies.xml translate_bed_sequences.py translate_bed_sequences.xml |
b |
diff -r 000000000000 -r d328db400280 test-data/._translated_bed_sequences.fa |
b |
Binary file test-data/._translated_bed_sequences.fa has changed |
b |
diff -r 000000000000 -r d328db400280 test-data/Extract_Genomic_DNA.bed --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Extract_Genomic_DNA.bed Wed Feb 05 09:27:54 2014 -0500 |
b |
b'@@ -0,0 +1,7 @@\n+15\t40902459\t40907576\tJUNC00019210\t1\t+\t40902459\t40907576\t255,0,0\t2\t36,38\t0,5079\tCTCATATGAAAATAGTGAGAAAGTCAGAAATGGAAGGTAAGTATGTTACTATAATTCCTGCTAAATCTGCTTTTTAAAAAATTTTACTGTAGCTATCTAACCAGACAACTAATATAACTTATTGTCTATCTTATTGCTTAAAAAATATATGATGGGCCATGCATAGTGGTTCACACCTGTGATCCCGACACTTTGGCAGTCTGAGGTGGGAGGATCGCTTGAGCCCAGGAGTTCAAGACCAACCTGGATAGCATAGTGAGATTCTGTCTCTACAAAAAATAAAAAATTAGCCAGGTGTGGGGGTGCATTCCTGTAGCCCCAGCTACTCAGGAGGCTGAGGTGAGAGGATCACTTGAGTCCAGAAGATTGAGACTGCAGTGATTGCACCAGTGCACTCCAGCCTGGGCAACAGAGCAAGACTCTGTCTCAAAAACAAAAAAAGTATACCTTGAGTCTTGGGAGTAGAGAGTAGAGTGGATAGTAAGTAAATTTATTTATTTATTTATTTTGAGACGGATTTTCACTGTTGTTCCCCAGGCTGCAGTGCAATGGTGCCATCTCAGCTGCAACTTCTGCCTCCTGGGTTTAAGCGATTCTCCTGCCTCAGCCTCCCAGGTAGCCGGGATTACAGGCATGCACCACCACACCCAGCTAATTTTTGTATTTTTAGTAGAGACAGGGTTTCACCATATTGGCCAGGCTGGTCTCGAACCCCTGGCCTCAAGTGATCCGCCTGCCTTGGCCTCAAAATGCTAGGATTACAGGCGTGAGCCACCACGTCCAGCAGTTAATAATTTTTTTAAATGTTGTTAATGTCCTTAAGTAATTTTTTAAAAATTTTATTGTATTTTTTTTTTTTTTGAGACAGAGTCTTGCTTGCCCTGTCGCCCAGGCTAGAGTGCAGTGGTGCGATCTCGGCTAACTGCAATCTCTGCCTCCCAGGTTCAAGCAATTCTCCTACCTCAGCCTCCTGAGTAGCTGGGATTACATGTGCACGCCACCACACCTGGCTAATTTTTGTATTTTTAGTAGAGACAGGGTTTCACCGTGTTGGTCAGGTTGATCTCGAACTCCTGACCTCGTGGTCCACCCGTCTCGGCCTCCCAAAGTTCTGGGATTACAGGCATGAGCCACCGGGCCCAGCTGTCCTTAAGTAATTTTTCTAATGCTTTATCAGTGTATCCTTGGACAAATTTAATTTTAATTTTATTTTTAGAAACAGAAACAGGAGAAAATCTTCTTTTGATACAGTAAGTAATATTCAAATTATATTTAAAAAGTTATAAATTAATATTATTTTTATTTCTTATTTTTGTGTTCCTTTTGTGGAATACTTAGGATTAATTCAGAAAACCAGTTATTTGCAGAATTTAGTATACTGCTATATCTGATTAATATGGCCATTGTACTGTTTATAGTTTTAATAGTGATGAAACAATATAATATATAAACCTTTATATTTATTAACTAATATAAAACAATAGATAGCAAGTCTTTAGTTTTTTTATTAAATTAATCTTTCTTATAATATTATTACATAGAAAGGCAAATACCAGTAGCTCTTCAACAAATGAAAAGATGGTTATCTTTATTCATCATAAGAGAAGTACAGATTTGATTATATTGAGATATTTTTGGCTGGACGTGGTGGCTCATGCCTGTAATCCGAGCACTTTGGGAGGCCGAGGCTGGTGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGATGAAACCCCATCTCTACTAAAAAAATACAAAAAATTGGCCGGGCACAGTGGCTTACGCCTGTAAACCAAGCACTTAGGGAGGCTGAGGCGGGTAGATCACGAGGTCAGGAGATCGAGACCATCCTGGCCAACGTGGTGAAACCCCATCTCTACTAAGAATACAAAAATTAGCCAGGTGTTGTGGTGGGCGCCTGTAGTCCCAGCTACTCAGGAGGTTGAGGTAGGAGAATCACTTGAATCTGGGAGGTAGAGGTTGCAGTGAGCCGAGATCATGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAAACAAAAAAAACCCCAAAAAATTAGCCAGGTATGGTGGCACTGTGCCTGTAATCCCAGCTACTCAGGAGGCCAAGGCACGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCTGAGATCATGCCCCTGCACTCCAACCTGGGCAGCAGAGCGAGACTCTGTCTCCAAAAAAGAGGTTTTTTTGCTGTTGTTGTTGTTTGTTTGTTGTTTAGACGGCATCTTCCTCTGTCGCCAGGCTGGAGTGCAATGGTACGATCTTGGCTCTCTGCAACCTCCGCCTCCTGGGTTCAAGTGATTCTCCTGCTTCAGCCTCCCGAGTAGCTGGGACTACAGGCGCCTGCCACCACGCCTGGCTAATTTTGTTGTATTTTTAGTAGACACGGGGTTTCACCATGTTGGCCAGAATTGTCTTGGTCTCTTGACCTCGTGATCCGCCCACTTTGGCCTCCTAAAGTGCTGGGATTACAGGCGTGAGCCACTGTGCCTGGCCTAAAAAAGAGATATTTTTATCCAGTCAGTTAAGGAAATAGGTAAAAAGTCACTCCGTGCTAGTGGGAGTATAATTTGTAGAAGGCAACTTGGTAATATCGTTCAGAATTTTAAATGCACATGCCCTTTGACTTCAGTTTTATGTCTGGAAATTATCTCACCAATATACGTGTAAATGTTTGAAATGATGAATAGATAAGGTTATTCACAGCAGCGTTTATTATAATAGTAAACGTTGTGAAAGGTCCTGAAGGTCCATCAGTAAGGGCCTGGTTAAATAAATTGTACATTTTCCATATAATTGACTATGCAGCCGGAAAAAAAATTTTATGCTAAATAGAGAAATCTCTAAGCTATATTACTTAAGATAAAAAGCAAGACGCAAAACAAAGTATATCATGTATTACCACTTGGGTAAAACAGGGAAGAAGAAAAGCGTGTGTGTGTGTGTGTATCTTCTCGTGTGTGTACATGTATAATGTATGTATATGTAGTGACTTATGCATATATATGCATAATATCTCTGGAAGAAACTAGTAAGATTGCCTACAGAGAAAAGAACCTTGCTATAGGTTACATGTTGGCTTTGTGGTTTATTAATTTAAAACCATATGAAAGTATTACCTATTACATTCTTAAAATTGTTGAAACGAAGAAATGGAAGTAATAGTAGTCATGGTTTAGAAAAGGTACAGAATCAACTCCAACAGAACTTAAAGGAAAAATAATTTTTTAAATAAAAAGGTACAGAAGTATATACATTGAAAAGTAAAAATTATTCCCTCTTTCCCTCTTCTTTCTTTTTTGTGAGACGGGGTTTCGCTCTTGTTGGCCAGACTGGAGTATAATGGCATGATCTTGGCTCACTGCAACCTCAGCCTCCTGGGTTCAAGCAATTCTCCTGCCTCAGCCTCCTGAGTAGCTAGGACTACAGGTGTGCACCACTACACCTGGCTAATTTATTTTATTTTTATTATTTTATTTTATTTTATTTTATTTTGAGATAGAGTCTCGCTCCGTCACCCAGGCTGGAGTGCAGTGGCGCCATCTCGGCCCACTGCAAGCTCCGCCTCCTGGTTTCACGCCATTCTCCTGCCTCAGCCTCCCTAGTAGCTGGGACTACAGGCGCCTGCCACCACGCCTGGCTCATTTTTTTGTATTTTTAGTAGAGACAGGGTTTCACTGTGTTAGCCAGGATGGTCTCAATTTCCTGACCTTGTGATCCACCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCACGCCTGGCCCCCCTTTTTTTTTTTTTTGAGATGGAGTCTTGCTCTGTTGTGCAGGCTGGAGTGCAGTGGCCTAATC'..b'ATTTATAGTAATTTCTTAGTATCTAATAGCCAGTCCATATTCAAACTTCCCGAATTGAGGAATTTATTTTTAATTAAGATGGTATTAAATAATTACACTTGGTGAGATAATTCTTTCTTGATGTTTTTCTCCCTGACCTTCTTTCTTAAAATTGAAGCCTACAGACAAGATGAACACAATAAACATTCATATATTTTTCAACTTGATAACCCAAAAGGTGGCTGATTTGCCACCTTTTTCTTTTTCTTGGATATACCATTTGAAAGTAGATTGTAGATAAAAGTCCTATTTTAATGCTATTTTTATAAGTGACAAACAGTACAGAAGACAGGCCACATGGTAATGCTCATAGATATTCTAAGTAGATATACCTATTTTTCAAAAAGGAAGACACATTTATTTGAGGAAATGCTGATGAGTTGGCAGCATTCCCTATAATAATTCTTAGAAGACTATGCTCCATCAGAGCAAGAGCTGTGTATCTCTCTTTTCATTATTTTATTCCAGTGCCTGATTGTCTATTGACCTGAATCATTATTTGTTAATAAAAGGTCATGGGGCAGGAAGAATGCCTAAGGATAACTGTCAGCTGGGACTTGGGGACTCGGTTCAACATCCAAGTTCAAGTACTAGGGTCCTAATCATGTTAGACATATACCTCACCACCTGTGACAAATTTAGAGACTTATTTGAGAAGTATAGGGACAAACTGTAAAAATATTTATTTATATGGTGTAGTTTTAAAGTAGAAAAATTAAATATATAGTATTATCTTCTTTAAAAAAATTAAATATATAGTATTATCTTCTTTAAAAAAGAAATCAAGCCAATAATAGTTTCCCATTTCTATCACCAAGCTGAAAAAGTTAAAACATTTCCAAATAAAACAATGTTAACTTTAATCTCATTAAAGTCAAAACGAGTTTATTCAAGTCAAAAGATAAAACAGATTTGTCATCTACCTCTTGAGTTGCTATTTTACGATTTAGTTCAGCTACTTTGGAAGAAGAATTTTCTACTGCATTTTGGCAAAGGAGTTTCTCTATTTCTCTCTGATGAGATGCTTTGAGGGATGCAATGTGTGCTGCAGTATCTTCCTTGACCCTACAGAGCAAATGAAAGAAAACCACACATAAAAGTGGCTCTTCAACCTCTAATTCAGAGTTAGCACAAAAACAGTAGAAGAAACCTGGGAATTAAGCAAGGGGAAAATGGGCACCAATATTAACTGCACTGTGTTAGGTGCTTTATACATTACTACTGCCTATGAGTTCTTATGACCAATCCATGAGCTACTATTTACTGAATTTTATAAGGGCAAACTTGAGGAAATAGTGATATATCTCTACTTTACCCCAACCTGAGGCTACACTTTCTGAGGGAATCTAGGGTTCCAAAAGCAAAGCACTTGACATTTGATCTTTTAAGATAAACTCAGATTTCTTGCCCAGATGCTTCTTTGGAAAATCACAGCTGTTCCCTTTAGAATCTCCAATGCCTTGTAGGCAGCATTAACCAATTTTCAACCCATGCATGAGACTCCAGGGCTAGTTGCATATTGTGAGAATGAGACAATCTTTATGGTAATTCTCAGGACATATTATGCTTGTAATATGCAATTAATTAATTGGACTGTAAGTGTGAAAGACTATTCATTTGTCTCTGTGATAAAATTTATTCAGAGGCAGTTCAGTAAATGGTTAAAATTATAAATAAAGATTTGGTATATTTCCTACAGATAAACATTTTCTCTCTTATTGGAAAGACTTTGAAAATAACAGCATTTAACTTAAAGCATGTATTTTAGTAAACTGCTGTTGCTATATATTAATATGGTGCTTCCCAACTATAGACAAATTTATCCATTGCTTATTTCACCATATGAATATTTCTCCATGGAAACAGTGTGAGTAGGGTCCTAGAAAAAGCATAAAAACCTAAATTAAAGCACATATAACTGAATGATAGTAAAAAGTCTAAATATTGGACTAGAAAAGTTTATTCTTCACTTCTCAGGCCCAGACTTATCTAAGAAACAGATTGACAATATTAACAAATTTTAAATGATGTACAGGAAAATTAATTGGAAAACCTGAATTTTAAATTCTTTCCTGGAAAAAATGTGATTCTTCTTAAAGAGCTTCATGCTACTGTCATAATATTCAGGACTTAAGAAACAAGCTTTCCATTTGGTAGCAATATGACTGCCATATGGTAACAACATGACTCACTCACTGCCATGGCTGCCAGTCAATAAGCATTTGTTGGGTGTTTCCCATGCTCATTCTCCTCCTACAGCACATTGCTGTGGGGATGCAAAAGCAGCATAATCTTACACCAGTTCTCAAGGAACTACAAGGCTGTGTATGATTAATCCTTTCTTGGTACATATTAGTAAGTTATGTAGGAGTTGGGGGTAGGAGAAGGCAATTTCCTGGGAAGTTCCACGAAATGTTTTGTGAAGGTAGTACTTATAACAAGAATGAGGAAAAGGCATGAGGAAATGTGACAGATTAGGTAAGTAGAGTAGTATTAGAATAGTGATGAGACTTGAGATGCTAGGCAGAGAAATTTAGTCTTGATATTTAAGGAAGTTGAGAGTCACCGGAGAGCAGAGTGACCCAGGTATATGAGTATTTAAAGAATATTAATGATTTTTAAGCAAGATGACTGGGGAAGGTTAAAAAAAAGGAAGATTGGAGTGGGAAAATTGTATAATGGCAGCACTGGTTTATAAAAGTAAGGAAGACTGGAAAATGGGAAACATTTATACCCAAGGAATAACAGAGATAAAGCTGGGCTGGTAATTAAAATAAATATAGACAGGGAAGGGGAGCTTGGGAAGGGGAACTAATTTACAGGTAAAAAAAGGAAACTTGAGGTATTAGTGATTCCAAGAGAAGCAATCCAATAAATAGTTCTAGGTTTCACATCTGAACTCAGCAAAGAGAACAAGACTTTAAAAGTAAATCTAGAAGTCATGGTTCACAGAAACCGTAAGAATGGGTAAGTTTAGCAACAGAGAAAGAACAGAGAATAAACAGAAAACTAAGAGCTGAATGCTGGTAGAAAGCCAGATTTTTGGGGATGGAGAAGGAAGAAGGGTCAGAATTCAGTAAAAGAAACAGAAAAGGAGTTTTGGTCAGAGCAGCCAAGCCACAGAGGTTAAGGGGAGAAGCCATTTCAGGAAAAGTAGTGTGGTCAACATTGTTGAAGAAAATGAGGAAGGAGAAAATGCCCCTGGACTGGGAAAGCTCATTATTGAGACCAGGTTTAAAAAGGGTGATGATGAGAGCCATATTTAAGAGGAAGTGAGATAGAAATAAAAGAAAATACTATTTGTGAAAAACGGGTGCTAAAAGACAGGATTGGATTGGAACCTGATCAGGTGAAAAAAAGATCTGAGGATGTCAAAAGACTCAGAGGAAAGAGACAGTGGATAGCAAATGGAGATAGTGAGAAGGAAATGGATGAGTATAAAGTTCCTTAAGGCATGAATGGATGTGATCACAAGGTCAATTTGAAGAGTTATTTTTGAAAAGAGGACCTTTTCCTTTTAGACTGCCAACTAGCTTTAACAATAACTGTTTTCTGAAAGCAATCTGTCTATAGCAATAATAAACTATGACATTCCTTTGCTAGAAGAGCCCAAAGAGTCAGCTTATTAATACCATTTGGGTACATGCCAAAAGGCAAGACTGGCGAGCCCAAGGACACAATTTGGGTTGACACAGATGTTCAGGTACATCAGAATTTGGGCCACCAGCAGGTAGAAGACCCTATCCTGAAACAGACACATGCTCAGCAATATAATATAATTTATTAATATTCACTTATGAATTCAGTTCGGGGTCAAACTAATTATCTGGAGGAAATATATCGTATAATTTTTCTATTTTTATCTTTTTATTTTTACAAATATTTATAAATAATTTAACATTTTACCTTCTCATGGAGTTTTCAAATTGATTCATCACTGCTTCAGATTTCATCTTCAG\n' |
b |
diff -r 000000000000 -r d328db400280 test-data/translated_bed_sequences.fa --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/translated_bed_sequences.fa Wed Feb 05 09:27:54 2014 -0500 |
b |
@@ -0,0 +1,26 @@ +>JUNC00019210_2 pep:novel chromosome:GRCh37:15:40902460:40907575:1 depth:1 +SYENSEKVRNGRNKKLEDNYCEIT +>JUNC00019210_3 pep:novel chromosome:GRCh37:15:40902461:40907549:1 depth:1 +HMKIVRKSEMEGIRN +>JUNC00000003_1 pep:novel chromosome:GRCh37:9:17406:18053:-1 depth:1 +APWTSGPCRYKKYVFLDPLAGAVTKTHVMLGAE +>JUNC00000003_2 pep:novel chromosome:GRCh37:9:17438:18052:-1 depth:1 +PPGRAGPAGTRSMSSWTPWLVL +>JUNC00000003_3 pep:novel chromosome:GRCh37:9:17404:18051:-1 depth:1 +PLDERALQVQEVCLPGPPGWCCNKDPCDAGGRD +>JUNC00000874_2 pep:novel chromosome:GRCh37:8:27369376:27370079:1 depth:1 +PTSCNPSDMSHGYVTVKGYHKAKATHRGPWLVA +>JUNC00001897_1 pep:novel chromosome:GRCh37:7:99077597:99079392:1 depth:1 +HLLSLFFQLGVHICIPNFRNNSVSHCTQLRVLL +>JUNC00001897_2 pep:novel chromosome:GRCh37:7:99077598:99079360:1 depth:1 +IYCLYFSNLVCISVYPTSEITV +>JUNC00002152_1 pep:novel chromosome:GRCh37:7:148909514:148910831:1 depth:1 +DQQDLADRDIPTDPNSGENKSLSSQHMTFCHGS +>JUNC00002152_2 pep:novel chromosome:GRCh37:7:148909515:148910811:1 depth:1 +ISRIWQTEIFPRIPIQVRTRVSHLST +>JUNC00002625_1 pep:novel chromosome:GRCh37:6:41766614:41767580:-1 depth:1 +LKDSGGLAVIIERRLGSMSSLT +>JUNC00002625_3 pep:novel chromosome:GRCh37:6:41766612:41767578:-1 depth:1 +KRFRWSGRNHREKIGVHVVFDQ +>JUNC00002772_1 pep:novel chromosome:GRCh37:6:84856497:84862316:-1 depth:1 +LKMKSEAVMNQFENSMRRYL |
b |
diff -r 000000000000 -r d328db400280 tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Wed Feb 05 09:27:54 2014 -0500 |
b |
@@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="biopython" version="1.62"> + <repository changeset_revision="3e82cbc44886" name="package_biopython_1_62" owner="biopython" toolshed="http://toolshed.g2.bx.psu.edu" /> + </package> +</tool_dependency> |
b |
diff -r 000000000000 -r d328db400280 translate_bed_sequences.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/translate_bed_sequences.py Wed Feb 05 09:27:54 2014 -0500 |
[ |
b'@@ -0,0 +1,255 @@\n+#!/usr/bin/env python\n+"""\n+#\n+#------------------------------------------------------------------------------\n+# University of Minnesota\n+# Copyright 2014, Regents of the University of Minnesota\n+#------------------------------------------------------------------------------\n+# Author:\n+#\n+# James E Johnson\n+#\n+#------------------------------------------------------------------------------\n+"""\n+\n+"""\n+Input: BED file (12 column) + 13th sequence column appended by extract_genomic_dna\n+Output: Fasta of 3-frame translations of the spliced sequence\n+ \n+"""\n+\n+import sys,re,os.path\n+import optparse\n+from optparse import OptionParser\n+from Bio.Seq import reverse_complement, transcribe, back_transcribe, translate\n+\n+class BedEntry( object ):\n+ def __init__(self, line):\n+ self.line = line\n+ try:\n+ (chrom,chromStart,chromEnd,name,score,strand,thickStart,thickEnd,itemRgb,blockCount,blockSizes,blockStarts,seq) = line.split(\'\\t\')[0:13]\n+ self.chrom = chrom\n+ self.chromStart = int(chromStart)\n+ self.chromEnd = int(chromEnd)\n+ self.name = name\n+ self.score = int(score)\n+ self.strand = strand\n+ self.thickStart = int(thickStart)\n+ self.thickEnd = int(thickEnd)\n+ self.itemRgb = itemRgb\n+ self.blockCount = int(blockCount)\n+ self.blockSizes = [int(x) for x in blockSizes.split(\',\')]\n+ self.blockStarts = [int(x) for x in blockStarts.split(\',\')]\n+ self.seq = seq\n+ except Exception, e:\n+ print >> sys.stderr, "Unable to read Bed entry" % e\n+ exit(1)\n+ def get_splice_junctions(self): \n+ splice_juncs = []\n+ for i in range(self.blockCount - 1):\n+ splice_junc = "%s:%d_%d" % (self.chrom, self.chromStart + self.blockSizes[i], self.chromStart + self.blockStarts[i+1])\n+ splice_juncs.append(splice_junc)\n+ return splice_juncs\n+ def get_exon_seqs(self):\n+ exons = []\n+ for i in range(self.blockCount):\n+ # splice_junc = "%s:%d_%d" % (self.chrom, self.chromStart + self.blockSizes[i], self.chromStart + self.blockStarts[i+1])\n+ exons.append(self.seq[self.blockStarts[i]:self.blockStarts[i] + self.blockSizes[i]])\n+ if self.strand == \'-\': #reverse complement\n+ exons.reverse()\n+ for i,s in enumerate(exons):\n+ exons[i] = reverse_complement(s)\n+ return exons\n+ def get_spliced_seq(self):\n+ seq = \'\'.join(self.get_exon_seqs())\n+ return seq\n+ def get_translation(self,sequence=None):\n+ translation = None\n+ seq = sequence if sequence else self.get_spliced_seq()\n+ if seq:\n+ seqlen = len(seq) / 3 * 3;\n+ if seqlen >= 3:\n+ translation = translate(seq[:seqlen])\n+ return translation\n+ def get_translations(self):\n+ translations = []\n+ seq = self.get_spliced_seq()\n+ if seq:\n+ for i in range(3):\n+ translation = self.get_translation(sequence=seq[i:])\n+ if translation:\n+ translations.append(translation)\n+ return translations\n+ ## [[start,end,seq],[start,end,seq],[start,end,seq]]\n+ ## filter: ignore translation if stop codon in first exon after ignore_left_bp\n+ def get_filterd_translations(self,untrimmed=False,filtering=True,ignore_left_bp=0,ignore_right_bp=0):\n+ translations = [None,None,None]\n+ seq = self.get_spliced_seq()\n+ ignore = (ignore_left_bp if self.strand == \'+\' else ignore_right_bp) / 3\n+ block_sum = sum(self.blockSizes)\n+ exon_sizes = self.blockSizes\n+ if self.strand == \'-\':\n+ exon_sizes.reverse()\n+ splice_sites = [sum(exon_sizes[:x]) / 3 for x in range(1,len(exon_sizes))]\n+ junc = splice_sites[0] if len(splice_sites) > 0 else exon_sizes[0]\n+ if seq:\n+ for i in range(3):\n+ translation = self.get_translation(sequence=seq[i:])\n+ if translation:\n+ tstart = 0\n+ tstop = len(translation)\n+ if not untrimmed:\n+ tstart = translation.rfind(\'*\',0,junc) + 1\n+ stop = translation.find(\'*\',junc)\n+ '..b' with stop codon in the first exon\' )\n+ parser.add_option( \'-u\', \'--untrimmed\', dest=\'untrimmed\', action=\'store_true\', default=False, help=\'Do NOT trim from splice site to stop codon\' )\n+ parser.add_option( \'-L\', \'--min_length\', dest=\'min_length\', type=\'int\', default=None, help=\'Minimun length (to first stop codon)\' )\n+ parser.add_option( \'-M\', \'--max_stop_codons\', dest=\'max_stop_codons\', type=\'int\', default=None, help=\'Filter out translations with more than max_stop_codons\' )\n+ parser.add_option( \'-d\', \'--debug\', dest=\'debug\', action=\'store_true\', default=False, help=\'Turn on wrapper debugging to stdout\' )\n+ (options, args) = parser.parse_args()\n+ # Input files\n+ if options.input != None:\n+ try:\n+ inputPath = os.path.abspath(options.input)\n+ inputFile = open(inputPath, \'r\')\n+ except Exception, e:\n+ print >> sys.stderr, "failed: %s" % e\n+ exit(2)\n+ else:\n+ inputFile = sys.stdin\n+ # Output files\n+ outFile = None\n+ if options.output == None:\n+ #write to stdout\n+ outFile = sys.stdout\n+ else:\n+ try:\n+ outPath = os.path.abspath(options.output)\n+ outFile = open(outPath, \'w\')\n+ except Exception, e:\n+ print >> sys.stderr, "failed: %s" % e\n+ exit(3)\n+ leading_bp = 0\n+ trailing_bp = 0\n+ if options.leading_bp:\n+ if options.leading_bp >= 0:\n+ leading_bp = options.leading_bp\n+ else:\n+ print >> sys.stderr, "failed: leading_bp must be positive"\n+ exit(5)\n+ if options.trailing_bp:\n+ if options.trailing_bp >= 0:\n+ trailing_bp = options.trailing_bp\n+ else:\n+ print >> sys.stderr, "failed: trailing_bp must be positive"\n+ exit(5)\n+ # Scan bed file \n+ try:\n+ for i, line in enumerate( inputFile ):\n+ if line.startswith(\'track\'):\n+ if outFile and options.bed_format:\n+ outFile.write(line)\n+ continue\n+ entry = BedEntry(line)\n+ strand = 1 if entry.strand == \'+\' else -1\n+ translations = entry.get_translations()\n+ if options.debug:\n+ exon_seqs = entry.get_exon_seqs()\n+ exon_sizes = [len(seq) for seq in exon_seqs]\n+ splice_sites = [sum(exon_sizes[:x]) / 3 for x in range(1,len(exon_sizes))]\n+ print >> sys.stderr, entry.name\n+ print >> sys.stderr, line.rstrip(\'\\r\\n\')\n+ print >> sys.stderr, "exons: %s" % exon_seqs\n+ print >> sys.stderr, "%s" % splice_sites\n+ for i,translation in enumerate(translations):\n+ print >> sys.stderr, "frame %d: %s" % (i+1,translation)\n+ print >> sys.stderr, "splice: %s" % (\'\'.join([\'^\' if (((j*3)+i)/3) in splice_sites else \'-\' for j in range(len(translation))]))\n+ print >> sys.stderr, ""\n+ if options.bed_format:\n+ tx_entry = "%s\\t%s\\n" % (line.rstrip(\'\\r\\n\'),\'\\t\'.join(translations))\n+ outFile.write(tx_entry)\n+ else:\n+ translations = entry.get_filterd_translations(untrimmed=options.untrimmed,filtering=options.filtering,ignore_left_bp=leading_bp,ignore_right_bp=trailing_bp)\n+ for i,tx in enumerate(translations):\n+ if tx:\n+ (chromStart,chromEnd,translation) = tx\n+ if options.min_length != None and len(translation) < options.min_length:\n+ continue\n+ if options.max_stop_codons != None and translation.count(\'*\') > options.max_stop_codons:\n+ continue\n+ frame_name = \'_%s\' % (i + 1)\n+ location = "chromosome:%s:%s:%s:%s:%s" % (options.reference,entry.chrom,chromStart,chromEnd,strand)\n+ score = " %s:%s" % (options.score_name,entry.score) if options.score_name else \'\'\n+ seq_id = "%s%s %s %s%s" % (entry.name,frame_name,options.seqtype,location, score)\n+ outFile.write(">%s\\n" % seq_id)\n+ outFile.write(translation)\n+ outFile.write(\'\\n\')\n+ except Exception, e:\n+ print >> sys.stderr, "failed: Error reading %s - %s" % (options.input if options.input else \'stdin\',e)\n+\n+if __name__ == "__main__" : __main__()\n+\n' |
b |
diff -r 000000000000 -r d328db400280 translate_bed_sequences.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/translate_bed_sequences.xml Wed Feb 05 09:27:54 2014 -0500 |
b |
@@ -0,0 +1,102 @@ +<?xml version="1.0"?> +<tool id="translate_bed_sequences" name="Translate BED Sequences" version="0.0.1"> + <description>3 frame translation of BED augmented with a sequence column</description> + <requirements> + <requirement type="package" version="1.62">biopython</requirement> + <requirement type="python-module">Bio</requirement> + </requirements> + <command interpreter="python">translate_bed_sequences.py --input "$input" + #if $reference: + --reference $reference + #else: + --reference ${input.metadata.dbkey} + #end if + #if $seqtype: + --seqtype $seqtype + #end if + #if $score_name: + --score_name $score_name + #end if + #if $filter.filterseqs == 'yes': + #if $filter.leading_bp: + --leading_bp $filter.leading_bp + #end if + #if $filter.trailing_bp: + --trailing_bp $filter.trailing_bp + #end if + #else: + --unfiltered + #end if + #if $trim.trimseqs == 'no': + --untrimmed + #if $trim.max_stop_codons.__str__ != '': + --max_stop_codons $trim.max_stop_codons + #end if + #end if + #if $min_length: + --min_length $min_length + #end if + --output "$output" + </command> + <inputs> + <param name="input" type="data" format="bed" label="BED file with added sequence column" + help="Output from 'Extract Genomic DNA' run on tophat junctions.bed "/> + <param name="reference" type="text" value="" optional="true" label="Genome reference name" + help="By default, the database metadata will be used."/> + <param name="seqtype" type="text" value="" optional="true" label="The SEQTYPE:STATUS to include in the fasta ID lines" + help="For example: pep:splice"/> + <param name="score_name" type="text" value="" optional="true" label="Add the bed score field fasta ID line with this tag name" + help="For example: with the tag name 'depth' and bed score 12: depth:12"/> + <conditional name="filter"> + <param name="filterseqs" type="select" label="Filter out translations with stop codons before the splice site"> + <option value="yes" selected="true">Yes</option> + <option value="no">No</option> + </param> + <when value="yes"> + <param name="leading_bp" type="integer" value="" min="0" optional="true" label="Stop codon filtering start position base pairs" + help="Do not reject translation is stop_codons are within base pairs of the BED start position for positive strand"/> + <param name="trailing_bp" type="integer" value="" min="0" optional="true" label="Stop codon filtering end position base pairs" + help="Do not reject translation is stop_codons are within base pairs of the BED end position for negative strand"/> + </when> + <when value="no"/> + </conditional> + <conditional name="trim"> + <param name="trimseqs" type="select" label="Trim translations to stop codons"> + <option value="yes" selected="true">Yes</option> + <option value="no">No</option> + </param> + <when value="no"> + <param name="max_stop_codons" type="integer" value="" min="0" optional="true" label="Maximum number of stop codons allowed in a translation to be reported"/> + </when> + </conditional> + <param name="min_length" type="integer" value="" min="0" optional="true" label="Minimum length of a translation to be reported"/> + </inputs> + <stdio> + <exit_code range="1:" level="fatal" description="Error" /> + </stdio> + <outputs> + <data name="output" metadata_source="input" format="fasta" label="${tool.name} on ${on_string}"> + <filter>'found' in str(outputs)</filter> + </data> + </outputs> + <tests> + <test> + <param name="input" value="Extract_Genomic_DNA.bed" ftype="bed" dbkey="hg19"/> + <param name="reference" value="GRCh37"/> + <param name="seqtype" value="pep:novel"/> + <param name="score_name" value="depth"/> + <output name="output" file="translated_bed_sequences.fa"/> + </test> + </tests> + <help> +**Translate BED Sequences** + +This tool takes a BED input file that has been processed +by the Galaxy tool "Extract Genomic DNA" to add a 13th column with the transcript sequence. + +It generates a peptide fasta file with the 3-frame translations of the spliced sequence +defined by each entry in the input BED file. + + + </help> +</tool> |