Mercurial > repos > jjohnson > ensembl_variant_report
annotate ensembl_variant_report.py @ 0:9f4ea174ce3d draft
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
author | jjohnson |
---|---|
date | Thu, 14 Jun 2018 17:51:39 -0400 |
parents | |
children | a67b4de184c2 |
rev | line source |
---|---|
0
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
1 #!/usr/bin/env python |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
2 """ |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
3 Report variants to Ensembl Transcripts |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
4 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
5 FrameShift report line |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
6 # Gene Variant Position Reference Variation Prevalence Sequencing Depth Transcript AA Position AA change AA Length Stop Codon Stop Region AA Variation |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
7 TIGD6 chr5:149374879 AAG AG 1.00 13 ENSG00000164296|ENST00000296736 345 Q344 522 A-TGA-T KRWTSSRPST* |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
8 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
9 MissSense report line |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
10 # Gene Variant Position Reference Variation Prevalence Sequencing Depth Transcript AA Position AA change AA Length Stop Codon Stop Region AA Variation |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
11 FN1 chr2:216235089 G A 1.00 7394 ENSG00000115414|ENST00000354785 2261 V2261I 2478 G-TAA TGLTRGATYN_I_IVEALKDQQR |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
12 """ |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
13 import sys |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
14 import os.path |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
15 import re |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
16 import time |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
17 import optparse |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
18 from ensemblref import EnsemblRef |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
19 from Bio.Seq import reverse_complement, translate |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
20 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
21 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
22 def __main__(): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
23 #Parse Command Line |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
24 parser = optparse.OptionParser() |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
25 #I/O |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
26 parser.add_option( '-i', '--input', dest='input', default=None, help='Tabular file with peptide_sequence column' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
27 parser.add_option( '-s', '--format', dest='format', default='tabular', choices=['tabular','snpeff'], help='Tabular file with peptide_sequence column' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
28 #Columns for tabular input |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
29 parser.add_option( '-C', '--chrom_column', type='int', dest='chrom_column', default=1, help='column ordinal with Ensembl transctip ID' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
30 parser.add_option( '-P', '--pos_column', type='int', dest='pos_column', default=2, help='column ordinal with Ensembl transctip ID' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
31 parser.add_option( '-R', '--ref_column', type='int', dest='ref_column', default=3, help='column ordinal with Ensembl transctip ID' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
32 parser.add_option( '-A', '--alt_column', type='int', dest='alt_column', default=4, help='column ordinal with Ensembl transctip ID' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
33 parser.add_option( '-T', '--transcript_column', type='int', dest='transcript_column', default=1, help='column ordinal with Ensembl transctip ID' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
34 parser.add_option( '-F', '--dpr_column', type='int', dest='dpr_column', default=1, help='column with VCF: DPR or AD' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
35 parser.add_option( '-D', '--dp_column', type='int', dest='dp_column', default=1, help='column with VCF: DP' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
36 parser.add_option( '-g', '--gene_model', dest='gene_model', default=None, help='GTF gene model file. Used to annotate NSJ peptide entries.') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
37 parser.add_option( '-2', '--twobit', dest='twobit', default=None, help='Reference genome in UCSC twobit format') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
38 #Output file |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
39 parser.add_option( '-o', '--output', dest='output', default=None, help='The output report (else write to stdout)' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
40 #filters |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
41 parser.add_option( '-d', '--min_depth', type='int', dest='min_depth', default=None, help='Minimum read depth to report' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
42 parser.add_option( '-f', '--min_freq', type='float', dest='min_freq', default=None, help='Minimum variant frequency to report' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
43 #peptide options |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
44 parser.add_option( '-l', '--leading_aa', type='int', dest='leading_aa', default=10, help='Number AAs before missense variant' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
45 parser.add_option( '-t', '--trailing_aa', type='int', dest='trailing_aa', default=10, help='Number AAs after missense variant' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
46 parser.add_option( '-r', '--readthrough', type='int', dest='readthrough', default=0, help='' ) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
47 # |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
48 parser.add_option('--debug', dest='debug', action='store_true', default=False, help='Print debugging messages') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
49 (options, args) = parser.parse_args() |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
50 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
51 ##INPUTS## |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
52 if options.input != None: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
53 try: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
54 inputPath = os.path.abspath(options.input) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
55 inputFile = open(inputPath, 'r') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
56 except Exception, e: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
57 print >> sys.stderr, "failed: %s" % e |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
58 exit(2) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
59 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
60 inputFile = sys.stdin |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
61 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
62 if options.output != None: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
63 try: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
64 outputPath = os.path.abspath(options.output) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
65 outputFile = open(outputPath, 'w') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
66 except Exception, e: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
67 print >> sys.stderr, "failed: %s" % e |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
68 exit(3) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
69 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
70 outputFile = sys.stdout |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
71 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
72 def parse_tabular(): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
73 ci = options.chrom_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
74 pi = options.pos_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
75 ri = options.ref_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
76 ai = options.alt_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
77 ti = options.transcript_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
78 di = options.dp_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
79 fi = options.dpr_column - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
80 for linenum,line in enumerate(inputFile): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
81 if options.debug: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
82 print >> sys.stderr, "%d: %s\n" % (linenum,line) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
83 if line.startswith('#'): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
84 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
85 if line.strip() == '': |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
86 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
87 fields = line.rstrip('\r\n').split('\t') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
88 transcript = fields[ti] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
89 if not transcript: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
90 print >> sys.stderr, "%d: %s\n" % (linenum,line) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
91 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
92 chrom = fields[ci] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
93 pos = int(fields[pi]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
94 ref = fields[ri] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
95 alts = fields[ai] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
96 dp = int(fields[di]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
97 dpr = [int(x) for x in fields[fi].split(',')] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
98 for i,alt in enumerate(alts.split(',')): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
99 freq = float(dpr[i+1])/float(sum(dpr)) if dpr else None |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
100 yield (transcript,pos,ref,alt,dp,freq) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
101 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
102 def parse_snpeff_vcf(): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
103 for linenum,line in enumerate(inputFile): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
104 if line.startswith('##'): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
105 if line.find('SnpEffVersion=') > 0: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
106 SnpEffVersion = re.search('SnpEffVersion="?(\d+\.\d+)',line).groups()[0] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
107 elif line.startswith('#CHROM'): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
108 pass |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
109 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
110 fields = line.strip('\r\n').split('\t') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
111 if options.debug: print >> sys.stderr, "\n%s" % (fields) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
112 (chrom, pos, id, ref, alts, qual, filter, info) = fields[0:8] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
113 alt_list = alts.split(',') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
114 pos = int(pos) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
115 qual = float(qual) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
116 dp = None |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
117 dpr = None |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
118 for info_item in info.split(';'): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
119 if info_item.find('=') < 0: continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
120 (key, val) = info_item.split('=', 1) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
121 if key == 'DP': |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
122 dp = int(val) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
123 if key == 'DPR': |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
124 dpr = [int(x) for x in val.split(',')] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
125 if key in ['EFF','ANN']: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
126 for effect in val.split(','): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
127 if options.debug: print >> sys.stderr, "\n%s" % (effect.split('|')) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
128 if key == 'ANN': |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
129 (alt,eff,impact,gene_name,gene_id,feature_type,transcript,biotype,exon,c_hgvs,p_hgvs,cdna,cds,aa,distance,info) = effect.split('|') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
130 elif key == 'EFF': |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
131 (eff, effs) = effect.rstrip(')').split('(') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
132 (impact, functional_class, codon_change, aa_change, aa_len, gene_name, biotype, coding, transcript, exon, alt) = effs.split('|')[0:11] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
133 i = alt_list.index(alt) if alt in alt_list else 0 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
134 freq = float(dpr[i+1])/float(sum(dpr)) if dpr else None |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
135 yield (transcript,pos,ref,alt,dp,freq) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
136 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
137 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
138 #Process gene model |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
139 ens_ref = None |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
140 if options.gene_model != None: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
141 try: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
142 geneModelFile = os.path.abspath(options.gene_model) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
143 twoBitFile = os.path.abspath(options.twobit) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
144 print >> sys.stderr, "Parsing ensembl ref: %s %s" % (options.gene_model,options.twobit) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
145 time1 = time.time() |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
146 ens_ref = EnsemblRef(geneModelFile,twoBitFile) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
147 time2 = time.time() |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
148 print >> sys.stderr, "Parsing ensembl ref: %d seconds" % (int(time2-time1)) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
149 except Exception, e: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
150 print >> sys.stderr, "Parsing gene model failed: %s" % e |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
151 exit(2) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
152 try: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
153 parse_input = parse_tabular if options.format == 'tabular' else parse_snpeff_vcf |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
154 for tid,pos1,ref,alt,dp,freq in parse_input(): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
155 if not tid: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
156 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
157 if options.min_depth and dp is not None and dp < options.min_depth: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
158 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
159 if options.min_freq and freq is not None and freq < options.min_freq: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
160 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
161 ## transcript_id, pos, ref, alt, dp, dpr |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
162 tx = ens_ref.get_gtf_transcript(tid) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
163 if not tx: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
164 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
165 coding = ens_ref.transcript_is_coding(tid) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
166 if not coding: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
167 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
168 frame_shift = len(ref) != len(alt) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
169 cds = ens_ref.get_cds(tid) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
170 pos0 = pos1 - 1 # zero based position |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
171 spos = pos0 if tx.gene.strand else pos0 + len(ref) - 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
172 alt_seq = alt if tx.gene.strand else reverse_complement(alt) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
173 ref_seq = ref if tx.gene.strand else reverse_complement(ref) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
174 cds_pos = ens_ref.genome_to_cds_pos(tid, spos) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
175 alt_cds = cds[:cds_pos] + alt_seq + cds[cds_pos+len(ref):] if cds_pos+len(ref) < len(cds) else '' |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
176 offset = 0 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
177 if tx.gene.strand: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
178 for i in range(min(len(ref),len(alt))): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
179 if ref[i] == alt[i]: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
180 offset = i |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
181 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
182 break |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
183 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
184 for i in range(-1,-min(len(ref),len(alt)) -1,-1): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
185 if ref[i] == alt[i]: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
186 offset = i |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
187 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
188 break |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
189 refpep = translate(cds[:len(cds)/3*3]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
190 pep = translate(alt_cds[:len(alt_cds)/3*3]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
191 peplen = len(pep) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
192 aa_pos = (cds_pos + offset) / 3 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
193 if aa_pos >= len(pep): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
194 print >> sys.stderr, "aa_pos %d >= peptide length %d : %s %d %s %s\n" % (aa_pos,len(pep),tid,pos1,ref,alt) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
195 continue |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
196 if frame_shift: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
197 #find stop_codons |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
198 nstops = 0 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
199 stop_codons = [] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
200 for i in range(aa_pos,peplen): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
201 if refpep[i] != pep[i]: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
202 aa_pos = i |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
203 break |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
204 for i in range(aa_pos,peplen): |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
205 if pep[i] == '*': |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
206 nstops += 1 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
207 stop_codons.append("%s-%s%s" % (alt_cds[i*3-1],alt_cds[i*3:i*3+3],"-%s" % alt_cds[i*3+4] if len(alt_cds) > i*3 else '')) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
208 if nstops > options.readthrough: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
209 reported_peptide = pep[aa_pos:i+1] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
210 reported_stop_codon = ','.join(stop_codons) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
211 break |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
212 else: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
213 reported_stop_codon = "%s-%s" % (alt_cds[peplen*3-4],alt_cds[peplen*3-3:peplen*3]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
214 reported_peptide = "%s_%s_%s" % (pep[max(aa_pos-options.leading_aa,0):aa_pos], |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
215 pep[aa_pos], |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
216 pep[aa_pos+1:min(aa_pos+1+options.trailing_aa,len(pep))]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
217 cs_pos = aa_pos * 3 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
218 aa_pos = (cds_pos + offset) / 3 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
219 ref_codon = cds[cs_pos:cs_pos+3] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
220 ref_aa = translate(ref_codon) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
221 alt_codon = alt_cds[cs_pos:cs_pos+3] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
222 alt_aa = translate(alt_codon) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
223 gene = tx.gene.names[0] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
224 report_fields = [tx.gene.names[0], |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
225 '%s:%d %s' % (tx.gene.contig,pos1,'+' if tx.gene.strand else '-'), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
226 ref_seq, |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
227 alt_seq, |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
228 "%1.2f" % freq if freq is not None else '', |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
229 str(dp), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
230 "%s|%s" % (tx.gene.gene_id,tx.cdna_id), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
231 "%d" % (aa_pos + 1), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
232 "%s%d%s" % (ref_aa,aa_pos + 1,alt_aa), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
233 "%d" % len(pep), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
234 reported_stop_codon, |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
235 reported_peptide |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
236 ] |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
237 if options.debug: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
238 report_fields.append("%d %d %d %d %s %s" % (cds_pos, offset, cs_pos,aa_pos,ref_codon,alt_codon)) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
239 outputFile.write('\t'.join(report_fields)) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
240 if options.debug: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
241 print >> sys.stderr, "%s %s\n%s\n%s\n%s %s" % ( |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
242 cds[cs_pos-6:cs_pos], cds[cs_pos:cs_pos+15], |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
243 translate(cds[cs_pos-6:cs_pos+15]), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
244 translate(alt_cds[cs_pos-6:cs_pos+15]), |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
245 alt_cds[cs_pos-6:cs_pos], alt_cds[cs_pos:cs_pos+15]) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
246 outputFile.write('\n') |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
247 except Exception, e: |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
248 print >> sys.stderr, "failed: %s" % e |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
249 exit(1) |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
250 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
251 |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
252 if __name__ == "__main__" : __main__() |
9f4ea174ce3d
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit e6aa05bbbee3cc7d98f16354fc41c674f439ff1b-dirty
jjohnson
parents:
diff
changeset
|
253 |