annotate AnnotateRNAz.py @ 0:273a961d332f draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
author bgruening
date Wed, 30 Jan 2019 04:13:47 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
1 # AnnotateRnaz.py ---
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
2 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
3 # Filename: AnnotateRnaz.py
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
4 # Description:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
5 # Author: Joerg Fallmann
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
6 # Maintainer:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
7 # Created: Sat Jan 26 12:45:25 2019 (+0100)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
8 # Version:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
9 # Package-Requires: ()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
10 # Last-Updated: Tue Jan 29 13:52:57 2019 (+0100)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
11 # By: Joerg Fallmann
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
12 # Update #: 188
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
13 # URL:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
14 # Doc URL:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
15 # Keywords:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
16 # Compatibility:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
17 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
18 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
19
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
20 # Commentary:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
21 # This script is a replacement for rnazAnnotate.pl
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
22 # rnazAnnotate can not handle the output from version 2 adequatly
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
23 # This script uses the bedtools API to fast intersect an annotation Bed
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
24 # with output from RNAz
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
25
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
26 # Change Log:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
27 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
28 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
29 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
30 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
31 # This program is free software: you can redistribute it and/or modify
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
32 # it under the terms of the GNU General Public License as published by
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
33 # the Free Software Foundation, either version 3 of the License, or (at
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
34 # your option) any later version.
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
35 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
36 # This program is distributed in the hope that it will be useful, but
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
37 # WITHOUT ANY WARRANTY; without even the implied warranty of
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
38 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
39 # General Public License for more details.
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
40 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
41 # You should have received a copy of the GNU General Public License
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
42 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
43 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
44 #
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
45
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
46 # Code:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
47
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
48 #!/usr/bin/env python3
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
49
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
50 import sys
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
51 import glob
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
52 import argparse
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
53 from io import StringIO
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
54 import gzip
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
55 import traceback as tb
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
56 import pybedtools
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
57 import re
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
58 import tempfile
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
59
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
60 def parseargs():
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
61 parser = argparse.ArgumentParser(description='Intersect RNAz output with Annotation from BED')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
62 parser.add_argument("-b", "--bed", type=str, help='Annotation BED file')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
63 parser.add_argument("-i", "--input", type=str, help='RNAz output')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
64 parser.add_argument("-o", "--bedout", type=str, help='Annotation BED output')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
65 parser.add_argument("-r", "--rnazout", type=str, help='Annotation rnaz output')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
66 return parser.parse_args()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
67
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
68 def annotate(bed, input, bedout, rnazout):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
69 try:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
70
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
71 pybedtools.set_tempdir('.') # Make sure we do not write somewhere we are not supposed to
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
72 anno = pybedtools.BedTool(bed)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
73 rnaz=readrnaz(input)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
74 tmpbed = pybedtools.BedTool(rnaztobed(rnaz), from_string=True)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
75
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
76 intersection = tmpbed.intersect(anno,wa=True,wb=True,s=True) # intersect strand specific, keep all info on a and b files
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
77
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
78 bedtornaz(intersection, rnaz, bedout, rnazout)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
79
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
80 return 1
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
81
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
82 except Exception as err:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
83 exc_type, exc_value, exc_tb = sys.exc_info()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
84 tbe = tb.TracebackException(
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
85 exc_type, exc_value, exc_tb,
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
86 )
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
87 print(''.join(tbe.format()),file=sys.stderr)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
88
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
89 def readin(file):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
90 try:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
91 if '.gz' in file:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
92 f = gzip.open(file,'rt')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
93 else:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
94 f = open(file,'rt')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
95 return f
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
96
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
97 except Exception as err:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
98 exc_type, exc_value, exc_tb = sys.exc_info()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
99 tbe = tb.TracebackException(
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
100 exc_type, exc_value, exc_tb,
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
101 )
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
102 print(''.join(tbe.format()),file=sys.stderr)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
103
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
104 def readrnaz(rnaz):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
105 try:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
106 toparse = readin(rnaz)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
107 tointersect = {}
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
108 header = []
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
109 for line in toparse:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
110 if '#' in line[0]:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
111 tointersect['header']=line.strip()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
112 line = re.sub('^#','',line)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
113 cont = line.strip().split('\t')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
114 foi = cont.index('seqID') # need to find which column contains seqID
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
115 sf = cont.index('start') # need to find which column contains start
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
116 ef = cont.index('end') # need to find which column contains end
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
117 if 'strand' in cont:# need to find which column contains strand
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
118 df = cont.index('strand')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
119 else:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
120 df = None
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
121 else:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
122 content = line.strip().split('\t')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
123 newid=re.split('\.|\,|\s|\\|\/|\_', content[foi])[1] # I can only hope that we have species.chromosome.whatever as annotation in aln or maf, if not this is hardly parseable
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
124 if df:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
125 longid = '_'.join([newid, content[sf], content[ef], 'RNAzresult', '0', content[df]])
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
126 tointersect[longid] = content
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
127 else:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
128 longid = '_'.join([newid, content[sf], content[ef], 'RNAzresult', '0', '+'])
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
129 tointersect[longid] = content
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
130 longid = '_'.join([newid, content[sf], content[ef], 'RNAzresult', '0', '-'])
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
131 tointersect[longid] = content
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
132
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
133 return tointersect
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
134
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
135 except Exception as err:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
136 exc_type, exc_value, exc_tb = sys.exc_info()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
137 tbe = tb.TracebackException(
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
138 exc_type, exc_value, exc_tb,
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
139 )
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
140 print(''.join(tbe.format()),file=sys.stderr)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
141
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
142
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
143 def rnaztobed(rnaz):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
144 try:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
145 tmpbed = []
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
146 for key in rnaz:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
147 if key != 'header':
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
148 tmpbed.append('\t'.join(key.split('_')))
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
149
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
150 return '\n'.join(tmpbed)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
151
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
152 except Exception as err:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
153 exc_type, exc_value, exc_tb = sys.exc_info()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
154 tbe = tb.TracebackException(
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
155 exc_type, exc_value, exc_tb,
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
156 )
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
157 print(''.join(tbe.format()),file=sys.stderr)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
158
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
159 def bedtornaz(bed, rnaz, bedout, rnazout):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
160 try:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
161 b = open(bedout,'w')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
162 r = open(rnazout,'w')
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
163
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
164 annotatedbed=[]
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
165 annotatedrnaz=[]
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
166 annotatedrnaz.append(str.join('\t',[rnaz['header'],'Annotation']))
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
167 for line in open(bed.fn):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
168 out = line.strip().split("\t")
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
169 annotatedbed.append(str.join('\t',out[0:3]+out[9:10]+out[4:6]))
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
170 key = str.join('_',out[0:6])
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
171 annotatedrnaz.append(str.join('\t',rnaz[key]+out[9:10]))
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
172
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
173 print(str.join('\n', annotatedbed),file=b)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
174 print(str.join('\n', annotatedrnaz),file=r)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
175
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
176 except Exception as err:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
177 exc_type, exc_value, exc_tb = sys.exc_info()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
178 tbe = tb.TracebackException(
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
179 exc_type, exc_value, exc_tb,
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
180 )
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
181 print(''.join(tbe.format()),file=sys.stderr)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
182
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
183
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
184 def closefile(file):
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
185 try:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
186 file.close()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
187
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
188 except Exception as err:
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
189 exc_type, exc_value, exc_tb = sys.exc_info()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
190 tbe = tb.TracebackException(
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
191 exc_type, exc_value, exc_tb,
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
192 )
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
193 print(''.join(tbe.format()),file=sys.stderr)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
194
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
195
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
196
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
197
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
198 ####################
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
199 #### MAIN ####
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
200 ####################
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
201 if __name__ == '__main__':
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
202 args=parseargs()
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
203 annotate(args.bed, args.input, args.bedout, args.rnazout)
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
204 ######################################################################
273a961d332f planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_team/rnaz commit d261ddb93500e1ea309845fa3989c87c6312583d-dirty
bgruening
parents:
diff changeset
205 # AnnotateRnaz.py ends here