Mercurial > repos > jjohnson > mzsqlite_psm_align
annotate mzsqlite_psm_align.py @ 0:492f98d89e26 draft
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
author | jjohnson |
---|---|
date | Tue, 10 Apr 2018 09:57:49 -0400 |
parents | |
children | af5f22779a8e |
rev | line source |
---|---|
0
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
1 #!/usr/bin/env python |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
2 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
3 # |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
4 #------------------------------------------------------------------------------ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
5 # University of Minnesota |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
6 # Copyright 2017, Regents of the University of Minnesota |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
7 #------------------------------------------------------------------------------ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
8 # Author: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
9 # |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
10 # James E Johnson |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
11 # |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
12 #------------------------------------------------------------------------------ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
13 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
14 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
15 from __future__ import print_function |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
16 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
17 import argparse |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
18 import re |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
19 import sys |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
20 import sqlite3 as sqlite |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
21 from time import time |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
22 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
23 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
24 from Bio.Seq import reverse_complement, translate |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
25 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
26 ## from bedutil import bed_from_line |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
27 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
28 ## import digest |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
29 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
30 ## from ensembl_rest import get_cdna |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
31 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
32 import pysam |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
33 from twobitreader import TwoBitFile |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
34 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
35 from profmt import PROBAM_DEFAULTS,ProBAM,ProBAMEntry,ProBED,ProBEDEntry |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
36 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
37 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
38 inputs |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
39 proBed |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
40 mzIdentML |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
41 twobit |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
42 bam |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
43 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
44 inputs |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
45 mz.sqlite |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
46 genomic.mapping |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
47 bam |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
48 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
49 CREATE TABLE spectrum_identification_results (id TEXT PRIMARY KEY, spectraData_ref TEXT, spectrumID TEXT, spectrumTitle TEXT); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
50 CREATE TABLE spectrum_identification_result_items (id TEXT PRIMARY KEY, spectrum_identification_result_ref TEXT, passThreshold TEXT, rank INTEGER, peptide_ref TEXT, calculatedMassToCharge FLOAT, experimentalMassToCharge FLOAT, chargeState INTEGER); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
51 CREATE TABLE peptide_evidence (id TEXT PRIMARY KEY, dBSequence_ref TEXT, isDecoy TEXT, pre TEXT, post TEXT, start INTEGER, end INTEGER, peptide_ref TEXT); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
52 CREATE TABLE db_sequence (id TEXT PRIMARY KEY , accession TEXT, searchDatabase_ref TEXT, description TEXT, sequence TEXT, length INTEGER); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
53 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
54 SELECT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
55 FROM spectrum_identification_result_items siri |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
56 JOIN peptide_evidence pe ON siri.peptide_ref = pe.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
57 JOIN db_sequence dbs ON pe.dBSequence_ref = |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
58 WHERE pe.isDecoy = 'false' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
59 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
60 SELECT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
61 psm.spectrumID, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
62 psm.spectrumTitle as "QNAME", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
63 psm.id, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
64 psm.sequence, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
65 psm.passThreshold, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
66 psm."PeptideShaker PSM confidence", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
67 psm."PeptideShaker PSM score", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
68 pe.start, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
69 pe.end, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
70 pe.pre, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
71 pe.post, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
72 pe.dBSequence_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
73 FROM psm_entries psm |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
74 JOIN peptide_evidence pe ON psm.id = pe.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
75 JOIN db_sequence dbs ON pe.dBSequence_ref = dbs.accession |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
76 WHERE pe.isDecoy = 'false' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
77 AND pe.peptide_ref = 'SFYPEEVSSMVITK_15.99491461956-ATAA-10' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
78 ORDER BY psm.spectrumID |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
79 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
80 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
81 proBed to SQLite |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
82 or index proBed |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
83 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
84 for psm in psms: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
85 beds = get_bed(protein_acc) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
86 cds = '' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
87 for bed in beds: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
88 bed.seq = twobit[bed.chrom][bed.start,bed.end] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
89 cds += bed.get_cds() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
90 refprot = translate(cds) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
91 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
92 def read_bed(path): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
93 pdict = dict() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
94 prog = re.compile('^([^\t]+\t[^\t]+\t[^\t]+\t([^\t]+)\t.*)$') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
95 with open(path,'r') as bed: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
96 for i,line in enumerate(bed): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
97 m = prog.match(line) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
98 prot = m.groups()[1] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
99 pdict[prot] = m.groups()[0] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
100 return pdict |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
101 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
102 from pyteomics import mzid |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
103 with mzid.reader(args.mzid) as mzidrdr: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
104 for psm in mzidrdr: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
105 SpectrumIdentificationItems = psm['SpectrumIdentificationItem'] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
106 for SpectrumIdentificationItem in SpectrumIdentificationItems: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
107 PeptideEvidenceRef = SpectrumIdentificationItem['PeptideEvidenceRef'] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
108 PepEvs = [r['peptideEvidence_ref'] for r in PeptideEvidenceRef] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
109 for PepEv in PepEvs: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
110 PepRef = mzidrdr[PepEv] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
111 dBSequence_ref = PepRef['dBSequence_ref'] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
112 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
113 spectrum_peptides = count(distinct sequence) FROM psm_entries WHERE |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
114 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
115 1 QNAME String Query template NAME Spectrum name * psm.spectrumTitle |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
116 2 FLAG Int Bitwise FLAG Bitwise FLAG map.strand |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
117 3 RNAME String Reference sequence NAME Reference sequence NAME * map.chrom |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
118 4 POS Int 1-based leftmost mapping POSition 1-based leftmost mapping POSition map.start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
119 5 -MAPQ Int MAPping Quality (Phred-scaled) - 255 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
120 6 CIGAR String Extended CIGAR string (operations: MIDN) CIGAR string * map.cigar |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
121 7 -RNEXT String Mate Reference NAME ('=' if same as RNAME) - * |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
122 8 -PNEXT Int 1-Based leftmost Mate POSition - 0 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
123 9 TLEN Int observed Template LENgth - 0 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
124 10 SEQ String segment SEQuence Coding sequence * genomic.seq |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
125 11 -QUAL String Query QUALity (ASCII-33=Phred base quality) - * |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
126 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
127 1 QNAME psm.spectrumTitle |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
128 2 FLAG map.strand |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
129 3 RNAME map.chrom |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
130 4 POS map.start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
131 5 -MAPQ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
132 6 CIGAR map.cigar |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
133 7 -RNEXT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
134 8 -PNEXT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
135 9 -TLEN |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
136 10 SEQ genomic.seq |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
137 11 -QUAL |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
138 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
139 'NH' : 'i' genomic_locations |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
140 'XO' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
141 'XL' : 'i' spectrum_peptides |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
142 'XP' : 'Z' psm.sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
143 'YP' : 'Z' peptide_evidence.dBSequence_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
144 'XF' : 'Z' reading_frame |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
145 'XI' : 'f' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
146 'XB' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
147 'XR' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
148 'YB' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
149 'YA' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
150 'XS' : 'f' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
151 'XQ' : 'f' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
152 'XC' : 'i' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
153 'XA' : 'i' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
154 'XM' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
155 'XN' : 'i' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
156 'XT' : 'i' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
157 'XE' : 'i' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
158 'XG' : 'A' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
159 'XU' : 'Z' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
160 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
161 'NH' : 'i', #number of genomic locations to which the peptide sequence maps |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
162 'XO' : 'Z', #uniqueness of the peptide mapping |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
163 'XL' : 'i', #number of peptides to which the spectrum maps |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
164 'XP' : 'Z', #peptide sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
165 'YP' : 'Z', #Protein accession ID from the original search result |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
166 'XF' : 'Z', #Reading frame of the peptide (0, 1, 2) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
167 'XI' : 'f', #Peptide intensity |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
168 'XB' : 'Z', #massdiff; experimental mass; calculated mass massdiff can be calculated by experimental mass - calculated mass. If any number is unavailable, the value should be left blank (such as 0.01;;). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
169 'XR' : 'Z', #reference peptide sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
170 'YB' : 'Z', #Preceding amino acids (2 AA, B stands for before). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
171 'YA' : 'Z', #Following amino acids (2 AA, A stands for after). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
172 'XS' : 'f', #PSM score |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
173 'XQ' : 'f', #PSM FDR (i.e. q-value or 1-PEP). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
174 'XC' : 'i', #peptide charge |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
175 'XA' : 'i', #Whether the peptide is annotated 0:yes; 1:parially unknown; 2:totally unknown; |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
176 'XM' : 'Z', #Modifications |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
177 'XN' : 'i', #Number of missed cleavages in the peptide (XP) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
178 'XT' : 'i', #Enzyme specificity |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
179 'XE' : 'i', #Enzyme used in the experiment |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
180 'XG' : 'A', #Peptide type |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
181 'XU' : 'Z', #URI |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
182 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
183 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
184 Datatype Field name Description Origin |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
185 RNAME string chrom map.chrom Reference sequence chromosome |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
186 POS uint chromStart map Start position of the first DNA base |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
187 uint chromEnd map End position of the last DNA base |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
188 QNAME string name spectrum.title Unique name |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
189 uint score Score |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
190 char[1] strand + or - for strand |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
191 uint thickStart Coding region start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
192 uint thickEnd Coding region end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
193 uint reserved Always 0 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
194 int blockCount Number of blocks |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
195 int[blockCount] blockSizes Block sizes |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
196 int[blockCount] chromStarts Block starts |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
197 YP string proteinAccession Protein accession number |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
198 XP string peptideSequence Peptide sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
199 XO string uniqueness Peptide uniqueness |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
200 string genomeReferenceVersion Genome reference version number |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
201 XS double psmScore PSM score |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
202 XQ double fdr Estimated global false discovery rate |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
203 XM string modifications Post-translational modifications |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
204 XC int charge Charge value |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
205 XB double expMassToCharge Experimental mass to charge value |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
206 XB double calcMassToCharge Calculated mass to charge value |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
207 int psmRank Peptide-Spectrum Match rank. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
208 string datasetID Dataset Identifier |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
209 string uri Uniform Resource Identifier |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
210 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
211 XG |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
212 N Normal peptide. The peptide sequence is contained in the reference protein sequence. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
213 V Variant peptide. A single amino acid variation (SAV) is present as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
214 W Indel peptide. An insertion or deletion is present as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
215 J Novel junction peptide. A peptide that spans a novel exon-intron boundary as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
216 A Alternative junction peptide. A peptide that spans a non-canonical exon-intron boundary as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
217 M Novel exon peptide. A peptide that resides in a novel exon that is not present in the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
218 C Cross junction peptide. A peptide that spans through a splice site (partly exonic - partly intronic). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
219 E Extension peptide. A peptide that points to a non-canonical N-terminal protein extension. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
220 B 3' UTR peptide. A peptide that maps to the 3' UTR region from the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
221 O Out-of-frame peptide. A peptide that is translated from an alternative frame as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
222 T Truncation peptide. A peptide that points to a non-canonical N-terminal protein truncation. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
223 R Reverse strand peptide. A peptide that is derived from translation of the reverse strand of the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
224 I Intron peptide. A peptide that is located in an intronic region of the reference isoform. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
225 G Gene fusion peptide. An (onco-) peptide that spans two exons of different genes, through gene-fusion. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
226 D Decoy peptide. A peptide that maps to a decoy sequence from the MS-based search strategy. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
227 U Unmapped peptide. A peptide that could not be mapped to a reference sequence. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
228 X Unknown. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
229 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
230 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
231 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
232 SELECT distinct chrom, CASE WHEN strand = '+' THEN start + cds_offset - cds_start ELSE end - cds_offset - cds_start END as "pos" |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
233 FROM feature_cds_map |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
234 WHERE name = acc_name AND cds_offset >= cds_start AND cds_offset < cds_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
235 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
236 sqlite> select * from feature_cds_map WHERE name = 'pre_STRG.28813.4_j_5350_5470'; |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
237 pre_STRG.28813.4_j_5350_5470|chr7|5074750|5074857|+|0|107 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
238 pre_STRG.28813.4_j_5350_5470|chr7|5075140|5075153|+|107|120 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
239 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
240 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
241 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
242 SELECT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
243 pe.isDecoy, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
244 pe.dBSequence_ref, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
245 pe.start, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
246 pe.end, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
247 sr.spectrumTitle, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
248 si.rank, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
249 si.chargeState, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
250 si.calculatedMassToCharge, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
251 si.experimentalMassToCharge |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
252 FROM spectrum_identification_results sr |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
253 JOIN spectrum_identification_result_items si ON si.spectrum_identification_result_ref = sr.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
254 JOIN peptide_evidence pe ON si.peptide_ref = pe.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
255 WHERE si.id = 'SII_7389_1' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
256 ORDER BY si.rank; |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
257 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
258 SELECT pe.isDecoy, pe.dBSequence_ref, pe.start, pe.end, sr.spectrumTitle, si.rank, si.chargeState, si.calculatedMassToCharge, si.experimentalMassToCharge |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
259 FROM spectrum_identification_results sr |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
260 JOIN spectrum_identification_result_items si ON si.spectrum_identification_result_ref = sr.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
261 JOIN peptide_evidence pe ON si.peptide_ref = pe.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
262 WHERE si.id = 'SII_7389_1' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
263 ORDER BY si.rank; |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
264 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
265 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
266 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
267 CREATE TABLE spectrum_identification_results (id TEXT PRIMARY KEY, spectraData_ref TEXT, spectrumID TEXT, spectrumTitle TEXT); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
268 CREATE TABLE spectrum_identification_result_items (id TEXT PRIMARY KEY, spectrum_identification_result_ref TEXT, passThreshold TEXT, rank INTEGER, peptide_ref TEXT, calculatedMassToCharge FLOAT, experimentalMassToCharge FLOAT, chargeState INTEGER); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
269 CREATE TABLE peptide_evidence (id TEXT PRIMARY KEY, dBSequence_ref TEXT, isDecoy TEXT, pre TEXT, post TEXT, start INTEGER, end INTEGER, peptide_ref TEXT); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
270 CREATE TABLE db_sequence (id TEXT PRIMARY KEY , accession TEXT, searchDatabase_ref TEXT, description TEXT, sequence TEXT, length INTEGER); |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
271 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
272 {'write_probed': 0.08575654029846191, 'PSM_QUERY': 4.704349040985107, 'get_cds': 0.21015286445617676, 'SPECTRUM_PEPTIDES_QUERY': 32.92655086517334, 'PEPTIDE_ACC_QUERY': 425.11919951438904, 'get_mapping': 1.5911591053009033, 'GENOMIC_POS_QUERY': 10.909647226333618} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
273 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
274 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
275 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
276 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
277 def regex_match(expr, item): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
278 return re.match(expr, item) is not None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
279 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
280 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
281 def regex_search(expr, item): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
282 return re.search(expr, item) is not None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
283 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
284 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
285 def regex_sub(expr, replace, item): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
286 return re.sub(expr, replace, item) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
287 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
288 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
289 def get_connection(sqlitedb_path, addfunctions=True): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
290 conn = sqlite.connect(sqlitedb_path) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
291 if addfunctions: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
292 conn.create_function("re_match", 2, regex_match) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
293 conn.create_function("re_search", 2, regex_search) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
294 conn.create_function("re_sub", 3, regex_sub) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
295 return conn |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
296 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
297 PSM_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
298 SELECT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
299 pe.dBSequence_ref, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
300 pe.start, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
301 pe.end, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
302 pe.pre, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
303 pe.post, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
304 pep.sequence, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
305 sr.id, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
306 sr.spectrumTitle, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
307 si.rank, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
308 si.chargeState, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
309 si.calculatedMassToCharge, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
310 si.experimentalMassToCharge, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
311 si.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
312 FROM spectrum_identification_results sr |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
313 JOIN spectrum_identification_result_items si ON si.spectrum_identification_result_ref = sr.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
314 JOIN peptide_evidence pe ON si.peptide_ref = pe.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
315 JOIN peptides pep ON pe.peptide_ref = pep.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
316 WHERE pe.isDecoy = 'false' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
317 ORDER BY sr.spectrumTitle,si.rank |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
318 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
319 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
320 PEP_MODS_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
321 SELECT location, residue, name, modType, '' as "unimod" |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
322 FROM peptide_modifications |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
323 WHERE peptide_ref = :peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
324 ORDER BY location, modType, name |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
325 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
326 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
327 #number of peptides to which the spectrum maps |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
328 ## spectrum_identification_results => spectrum_identification_result_items -> peptide_evidence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
329 SPECTRUM_PEPTIDES_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
330 SELECT count(distinct pep.sequence) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
331 FROM spectrum_identification_results sr |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
332 JOIN spectrum_identification_result_items si ON si.spectrum_identification_result_ref = sr.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
333 JOIN peptide_evidence pe ON si.peptide_ref = pe.peptide_ref |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
334 JOIN peptides pep ON pe.peptide_ref = pep.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
335 WHERE pe.isDecoy = 'false' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
336 AND sr.id = :sr_id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
337 GROUP BY sr.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
338 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
339 #number of genomic locations to which the peptide sequence maps |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
340 #uniqueness of the peptide mapping |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
341 ## peptides => peptide_evidence -> db_sequence -> location |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
342 ## proteins_by_peptide |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
343 PEPTIDE_ACC_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
344 SELECT |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
345 pe.dBSequence_ref, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
346 pe.start, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
347 pe.end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
348 FROM peptide_evidence pe |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
349 JOIN peptides pep ON pe.peptide_ref = pep.id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
350 WHERE pe.isDecoy = 'false' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
351 AND pep.sequence = :sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
352 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
353 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
354 MAP_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
355 SELECT distinct * |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
356 FROM feature_cds_map |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
357 WHERE name = :acc |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
358 AND :p_start < cds_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
359 AND :p_end >= cds_start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
360 ORDER BY name,cds_start,cds_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
361 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
362 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
363 GENOMIC_POS_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
364 SELECT distinct chrom, CASE WHEN strand = '+' THEN start + :cds_offset - cds_start ELSE end - :cds_offset - cds_start END as "pos" |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
365 FROM feature_cds_map |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
366 WHERE name = :acc |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
367 AND :cds_offset >= cds_start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
368 AND :cds_offset < cds_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
369 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
370 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
371 FEATURE_CONTAIN_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
372 SELECT id,seqid,start,end,featuretype,strand,frame |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
373 FROM features |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
374 WHERE seqid = :seqid AND start <= :start AND end >= :end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
375 AND strand = :strand AND featuretype = :ftype |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
376 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
377 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
378 FEATURE_OVERLAP_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
379 SELECT id,seqid,start,end,featuretype,strand,frame |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
380 FROM features |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
381 WHERE seqid = :seqid |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
382 AND :end >= start AND :start <= end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
383 AND strand = :strand AND featuretype = :ftype |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
384 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
385 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
386 FEATURE_ANY_QUERY = """\ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
387 SELECT id,seqid,start,end,featuretype,strand,CAST(frame AS INTEGER) as "frame", CAST(frame AS INTEGER)==:frame as "in_frame" |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
388 FROM features |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
389 WHERE seqid = :seqid |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
390 AND :end >= start AND :start <= end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
391 AND featuretype in ('CDS','five_prime_utr','three_prime_utr','transcript') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
392 ORDER BY strand == :strand DESC, featuretype, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
393 start <= :start AND end >= :end DESC, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
394 in_frame DESC, end - start, start DESC, end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
395 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
396 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
397 def __main__(): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
398 parser = argparse.ArgumentParser( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
399 description='Generate proBED and proBAM from mz.sqlite') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
400 parser.add_argument('mzsqlite', help="mz.sqlite converted from mzIdentML") |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
401 parser.add_argument('genomic_mapping_sqlite', help="genomic_mapping.sqlite with feature_cds_map table") |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
402 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
403 '-R', '--genomeReference', default='Unknown', |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
404 help='Genome reference sequence in 2bit format') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
405 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
406 '-t', '--twobit', default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
407 help='Genome reference sequence in 2bit format') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
408 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
409 '-r', '--reads_bam', default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
410 help='reads alignment bam path') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
411 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
412 '-g', '--gffutils_file', default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
413 help='gffutils GTF sqlite DB') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
414 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
415 '-B', '--probed', default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
416 help='proBed path') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
417 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
418 '-s', '--prosam', default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
419 help='proSAM path') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
420 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
421 '-b', '--probam', default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
422 help='proBAM path') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
423 parser.add_argument( |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
424 '-l', '--limit', type=int, default=None, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
425 help='limit numbers of PSMs for testing') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
426 parser.add_argument('-v', '--verbose', action='store_true', help='Verbose') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
427 parser.add_argument('-d', '--debug', action='store_true', help='Debug') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
428 args = parser.parse_args() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
429 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
430 def get_sequence(chrom, start, end): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
431 if twobit: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
432 if chrom in twobit and 0 <= start < end < len(twobit[chrom]): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
433 return twobit[chrom][start:end] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
434 contig = chrom[3:] if chrom.startswith('chr') else 'chr%s' % chrom |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
435 if contig in twobit and 0 <= start < end < len(twobit[contig]): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
436 return twobit[contig][start:end] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
437 return '' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
438 return None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
439 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
440 twobit = TwoBitFile(args.twobit) if args.twobit else None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
441 samfile = pysam.AlignmentFile(args.reads_bam, "rb" ) if args.reads_bam else None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
442 seqlens = twobit.sequence_sizes() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
443 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
444 probed = open(args.probed,'w') if args.probed else sys.stdout |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
445 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
446 gff_cursor = get_connection(args.gffutils_file).cursor() if args.gffutils_file else None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
447 map_cursor = get_connection(args.genomic_mapping_sqlite).cursor() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
448 mz_cursor = get_connection(args.mzsqlite_file).cursor() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
449 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
450 unmapped_accs = set() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
451 timings = dict() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
452 def add_time(name,elapsed): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
453 if name in timings: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
454 timings[name] += elapsed |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
455 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
456 timings[name] = elapsed |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
457 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
458 XG_TYPES = ['N','V','W','J','A','M','C','E','B','O','T','R','I','G','D','U','X','*'] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
459 FT_TYPES = ['CDS','five_prime_utr','three_prime_utr','transcript'] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
460 def get_peptide_type(exons): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
461 ## XG classify peptide |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
462 ## N Normal peptide. The peptide sequence is contained in the reference protein sequence. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
463 ## V Variant peptide. A single amino acid variation (SAV) is present as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
464 ## W Indel peptide. An insertion or deletion is present as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
465 ## J Novel junction peptide. A peptide that spans a novel exon-intron boundary as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
466 ## A Alternative junction peptide. A peptide that spans a non-canonical exon-intron boundary as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
467 ## M Novel exon peptide. A peptide that resides in a novel exon that is not present in the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
468 ## C Cross junction peptide. A peptide that spans through a splice site (partly exonic - partly intronic). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
469 ## E Extension peptide. A peptide that points to a non-canonical N-terminal protein extension. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
470 ## B 3' UTR peptide. A peptide that maps to the 3' UTR region from the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
471 ## O Out-of-frame peptide. A peptide that is translated from an alternative frame as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
472 ## T Truncation peptide. A peptide that points to a non-canonical N-terminal protein truncation. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
473 ## R Reverse strand peptide. A peptide that is derived from translation of the reverse strand of the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
474 ## I Intron peptide. A peptide that is located in an intronic region of the reference isoform. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
475 ## G Gene fusion peptide. An (onco-) peptide that spans two exons of different genes, through gene-fusion. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
476 ## D Decoy peptide. A peptide that maps to a decoy sequence from the MS-based search strategy. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
477 ## U Unmapped peptide. A peptide that could not be mapped to a reference sequence. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
478 ## X Unknown. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
479 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
480 peptide_type = '*' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
481 if gff_cursor: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
482 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
483 etypes = ['*'] * len(exons) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
484 efeatures = [None] * len(exons) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
485 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
486 print('exons:%d\t%s'% (len(exons),etypes),file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
487 for i,exon in enumerate(exons): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
488 (acc,gc,gs,ge,st,cs,ce) = exon |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
489 fr = cs % 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
490 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
491 print('exon:\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (acc,gc,gs,ge,st,cs,ce,fr),file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
492 ft_params = {"seqid" : str(gc).replace('chr',''), "start" : gs, "end" : ge, 'strand' : st, 'frame' : fr, 'ftype' : 'CDS'} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
493 features = [f for f in gff_cursor.execute(FEATURE_ANY_QUERY,ft_params)] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
494 efeatures[i] = features |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
495 for i,exon in enumerate(exons): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
496 (acc,gc,gs,ge,st,cs,ce) = exon |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
497 for f in efeatures[i]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
498 (id,seqid,start,end,featuretype,strand,frame,in_frame) = f |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
499 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
500 print('feat:\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (id,seqid,start,end,featuretype,strand,frame,in_frame),file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
501 if strand == st: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
502 if start <= gs and ge <= end: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
503 if in_frame: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
504 etypes[i] = 'N' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
505 break |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
506 elif XG_TYPES.index('O') < XG_TYPES.index(etypes[i]): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
507 etypes[i] = 'O' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
508 break |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
509 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
510 if XG_TYPES.index('O') < XG_TYPES.index(etypes[i]): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
511 etypes[i] = 'O' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
512 peptide_type = etypes[i] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
513 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
514 add_time('pep_type',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
515 return peptide_type |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
516 def classify_exon(exon,exons,features): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
517 ## N Normal peptide. The peptide sequence is contained in the reference protein sequence. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
518 # 1 exon, contained, in_frame |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
519 # 2+ exons, contained, in_frame, on_exon_boundary |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
520 ## V Variant peptide. A single amino acid variation (SAV) is present as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
521 # 1 exon, contained, in_frame, AA_mismatch |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
522 # 2+ exons, contained, in_frame, on_exon_boundary, AA_mismatch |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
523 ## W Indel peptide. An insertion or deletion is present as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
524 # 1 exon, contained, in_frame, AA_mismatch |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
525 # 2+ exons, contained, in_frame, on_exon_boundary or off by 3, AA_mismatch |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
526 ## J Novel junction peptide. A peptide that spans a novel exon-intron boundary as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
527 # 2+ exons, contained, on_exon_boundary, same transcript, non adjacent exons |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
528 ## A Alternative junction peptide. A peptide that spans a non-canonical exon-intron boundary as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
529 # 2+ exons, contained, on_exon_boundary, same transcript, non adjacent exons |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
530 ## M Novel exon peptide. A peptide that resides in a novel exon that is not present in the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
531 ## C Cross junction peptide. A peptide that spans through a splice site (partly exonic - partly intronic). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
532 # 1 exon overlaps but not contained |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
533 ## E Extension peptide. A peptide that points to a non-canonical N-terminal protein extension. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
534 ## B 3' UTR peptide. A peptide that maps to the 3' UTR region from the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
535 # exon overlaps a three_prime_utr |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
536 ## O Out-of-frame peptide. A peptide that is translated from an alternative frame as compared to the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
537 # exon contained but not in_frame |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
538 ## T Truncation peptide. A peptide that points to a non-canonical N-terminal protein truncation. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
539 ## R Reverse strand peptide. A peptide that is derived from translation of the reverse strand of the reference. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
540 ## I Intron peptide. A peptide that is located in an intronic region of the reference isoform. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
541 # exon contained in transcript, not not overlapping any exon |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
542 ## G Gene fusion peptide. An (onco-) peptide that spans two exons of different genes, through gene-fusion. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
543 # exonis from different seqs, strand, or transcripts |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
544 ## D Decoy peptide. A peptide that maps to a decoy sequence from the MS-based search strategy. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
545 ## U Unmapped peptide. A peptide that could not be mapped to a reference sequence. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
546 ## X Unknown. |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
547 return '*' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
548 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
549 def get_variant_cds(exons,ref_prot,peptide,pep_cds): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
550 if ref_prot != peptide and samfile: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
551 try: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
552 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
553 print('name: %s \nref: %s\npep: %s\n' % (scan_name,ref_prot,peptide), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
554 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
555 for exon in exons: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
556 (acc,chrom,start,end,strand,c_start,c_end) = exon |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
557 a_start = c_start / 3 * 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
558 a_end = c_end / 3 * 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
559 if ref_prot[a_start:a_end] != peptide[a_start:a_end]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
560 pileup = get_exon_pileup(chrom,start,end) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
561 for i, (bi,ai,ao) in enumerate([(i,i / 3, i % 3) for i in range(c_start, c_end)]): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
562 if ao == 0 or i == 0: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
563 if ref_prot[ai] != peptide[ai]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
564 codon = get_pep_codon(pileup, bi - c_start, peptide[ai], ao) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
565 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
566 print('%d %d %d %s : %s %s %s' % (bi,ai,ao, peptide[ai], str(pep_cds[:bi]), str(codon), str(pep_cds[bi+3:])), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
567 if codon: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
568 pep_cds = pep_cds[:bi] + codon + pep_cds[bi+3:] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
569 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
570 add_time('var_cds',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
571 except Exception as e: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
572 print('name: %s \nref: %s\npep: %s\n%s\n' % (scan_name,ref_prot,peptide,e), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
573 return pep_cds |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
574 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
575 def get_mapping(acc,pep_start,pep_end): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
576 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
577 p_start = (pep_start - 1) * 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
578 p_end = pep_end * 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
579 map_params = {"acc" : acc, "p_start" : p_start, "p_end" : p_end} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
580 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
581 print('%s' % map_params, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
582 locs = [l for l in map_cursor.execute(MAP_QUERY,map_params)] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
583 exons = [] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
584 ## ========= pep |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
585 ## --- continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
586 ## --- trim |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
587 ## --- copy |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
588 ## --- trim |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
589 ## --- break |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
590 c_end = 0 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
591 for i, (acc,chrom,start,end,strand,cds_start,cds_end) in enumerate(locs): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
592 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
593 print('Prot: %s\t%s:%d-%d\t%s\t%d\t%d' % (acc,chrom,start,end,strand,cds_start,cds_end),file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
594 c_start = c_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
595 if cds_end < p_start: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
596 continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
597 if cds_start >= p_end: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
598 break |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
599 if strand == '+': |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
600 if cds_start < p_start: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
601 start += p_start - cds_start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
602 if cds_end > p_end: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
603 end -= cds_end - p_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
604 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
605 if cds_start < p_start: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
606 end -= p_start - cds_start |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
607 if cds_end > p_end: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
608 start += cds_end - p_end |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
609 c_end = c_start + abs(end - start) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
610 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
611 print('Pep: %s\t%s:%d-%d\t%s\t%d\t%d' % (acc,chrom,start,end,strand,cds_start,cds_end),file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
612 exons.append([acc,chrom,start,end,strand,c_start,c_end]) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
613 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
614 add_time('get_mapping',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
615 return exons |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
616 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
617 def get_cds(exons): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
618 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
619 seqs = [] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
620 for i, (acc,chrom,start,end,strand,cds_start,cds_end) in enumerate(exons): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
621 seq = get_sequence(chrom, min(start,end), max(start,end)) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
622 if strand == '-': |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
623 seq = reverse_complement(seq) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
624 seqs.append(seq) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
625 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
626 add_time('get_cds',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
627 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
628 print('CDS: %s' % str(seqs),file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
629 return ''.join(seqs) if seqs else '' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
630 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
631 def genomic_mapping_count(peptide): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
632 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
633 params = {"sequence" : peptide} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
634 acc_locs = [l for l in mz_cursor.execute(PEPTIDE_ACC_QUERY,params)] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
635 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
636 add_time('PEPTIDE_ACC_QUERY',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
637 if acc_locs: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
638 if len(acc_locs) == 1: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
639 return 1 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
640 locations = set() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
641 for i,acc_loc in enumerate(acc_locs): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
642 (acc,pep_start,pep_end) = acc_loc |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
643 if acc in unmapped_accs: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
644 continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
645 try: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
646 add_time('GENOMIC_POS_QUERY_COUNT',1) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
647 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
648 p_start = pep_start * 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
649 p_end = pep_end * 3 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
650 params = {"acc" : acc, "cds_offset" : p_start} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
651 (start_chrom,start_pos) = map_cursor.execute(GENOMIC_POS_QUERY, params).fetchone() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
652 params = {"acc" : acc, "cds_offset" : p_end} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
653 (end_chrom,end_pos) = map_cursor.execute(GENOMIC_POS_QUERY, params).fetchone() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
654 locations.add('%s:%s-%s:%s' % (start_chrom,start_pos,end_chrom,end_pos)) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
655 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
656 add_time('GENOMIC_POS_QUERY',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
657 except: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
658 unmapped_accs.add(acc) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
659 print('Unmapped: %s' % acc, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
660 return len(locations) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
661 return -1 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
662 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
663 def spectrum_peptide_count(spectrum_id): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
664 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
665 params = {"sr_id" : spectrum_id} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
666 pep_count = mz_cursor.execute(SPECTRUM_PEPTIDES_QUERY, params).fetchone()[0] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
667 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
668 add_time('SPECTRUM_PEPTIDES_QUERY',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
669 return pep_count |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
670 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
671 def get_exon_pileup(chrom,chromStart,chromEnd): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
672 cols = [] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
673 for pileupcolumn in samfile.pileup(chrom, chromStart, chromEnd): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
674 if chromStart <= pileupcolumn.reference_pos <= chromEnd: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
675 bases = dict() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
676 col = {'depth' : 0, 'cov' : pileupcolumn.nsegments, 'pos': pileupcolumn.reference_pos, 'bases' : bases} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
677 for pileupread in pileupcolumn.pileups: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
678 if not pileupread.is_del and not pileupread.is_refskip: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
679 col['depth'] += 1 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
680 base = pileupread.alignment.query_sequence[pileupread.query_position] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
681 if base not in bases: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
682 bases[base] = 1 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
683 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
684 bases[base] += 1 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
685 cols.append(col) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
686 return cols |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
687 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
688 codon_map = {"TTT":"F", "TTC":"F", "TTA":"L", "TTG":"L", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
689 "TCT":"S", "TCC":"S", "TCA":"S", "TCG":"S", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
690 "TAT":"Y", "TAC":"Y", "TAA":"*", "TAG":"*", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
691 "TGT":"C", "TGC":"C", "TGA":"*", "TGG":"W", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
692 "CTT":"L", "CTC":"L", "CTA":"L", "CTG":"L", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
693 "CCT":"P", "CCC":"P", "CCA":"P", "CCG":"P", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
694 "CAT":"H", "CAC":"H", "CAA":"Q", "CAG":"Q", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
695 "CGT":"R", "CGC":"R", "CGA":"R", "CGG":"R", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
696 "ATT":"I", "ATC":"I", "ATA":"I", "ATG":"M", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
697 "ACT":"T", "ACC":"T", "ACA":"T", "ACG":"T", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
698 "AAT":"N", "AAC":"N", "AAA":"K", "AAG":"K", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
699 "AGT":"S", "AGC":"S", "AGA":"R", "AGG":"R", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
700 "GTT":"V", "GTC":"V", "GTA":"V", "GTG":"V", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
701 "GCT":"A", "GCC":"A", "GCA":"A", "GCG":"A", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
702 "GAT":"D", "GAC":"D", "GAA":"E", "GAG":"E", |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
703 "GGT":"G", "GGC":"G", "GGA":"G", "GGG":"G",} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
704 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
705 aa_codon_map = dict() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
706 for c,a in codon_map.items(): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
707 aa_codon_map[a] = [c] if a not in aa_codon_map else aa_codon_map[a] + [c] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
708 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
709 aa_na_map = dict() # m[aa]{bo : {b1 : [b3] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
710 for c,a in codon_map.items(): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
711 if a not in aa_na_map: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
712 aa_na_map[a] = dict() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
713 d = aa_na_map[a] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
714 for i in range(3): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
715 b = c[i] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
716 if i < 2: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
717 if b not in d: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
718 d[b] = dict() if i < 1 else set() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
719 d = d[b] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
720 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
721 d.add(b) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
722 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
723 def get_pep_codon(pileup, idx, aa, ao): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
724 try: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
725 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
726 bases = [] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
727 for i in range(3): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
728 if i < ao: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
729 bases.append(list(set([c[i] for c in aa_codon_map[aa]]))) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
730 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
731 bases.append([b for b, cnt in reversed(sorted(pileup[idx + i]['bases'].iteritems(), key=lambda (k,v): (v,k)))]) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
732 print('%s' % bases) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
733 for b0 in bases[0]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
734 if b0 not in aa_na_map[aa]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
735 continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
736 for b1 in bases[1]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
737 if b1 not in aa_na_map[aa][b0]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
738 continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
739 for b2 in bases[2]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
740 if b2 in aa_na_map[aa][b0][b1]: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
741 return '%s%s%s' % (b0,b1,b2) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
742 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
743 add_time('pep_codon',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
744 except Exception as e: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
745 print("get_pep_codon: %s %s %s %s" |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
746 % (aa, ao, idx, pileup), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
747 raise e |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
748 return None |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
749 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
750 def write_probed(chrom,chromStart,chromEnd,strand,blockCount,blockSizes,blockStarts, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
751 spectrum,protacc,peptide,uniqueness,genomeReference,score=1000, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
752 psmScore='.', fdr='.', mods='.', charge='.', |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
753 expMassToCharge='.', calcMassToCharge='.', |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
754 psmRank='.', datasetID='.', uri='.'): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
755 probed.write('%s\t%d\t%d\t%s\t%d\t%s\t%d\t%d\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % \ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
756 (chrom,chromStart,chromEnd,spectrum,score,strand,chromStart,chromEnd,'0',blockCount, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
757 ','.join([str(v) for v in blockSizes]), |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
758 ','.join([str(v) for v in blockStarts]), |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
759 protacc,peptide,uniqueness, genomeReference, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
760 psmScore, fdr, mods, charge, expMassToCharge, calcMassToCharge, psmRank, datasetID, uri)) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
761 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
762 def get_genomic_location(exons): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
763 chrom = exons[0][1] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
764 strand = exons[0][4] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
765 pos = [exon[2] for exon in exons] + [exon[3] for exon in exons] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
766 chromStart = min(pos) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
767 chromEnd = max(pos) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
768 blockCount = len(exons) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
769 blockSizes = [abs(exon[3] - exon[2]) for exon in exons] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
770 blockStarts = [min(exon[2],exon[3]) - chromStart for exon in exons] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
771 return (chrom,chromStart,chromEnd,strand,blockCount,blockSizes,blockStarts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
772 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
773 def get_psm_modifications(peptide_ref): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
774 mods = [] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
775 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
776 params = {"peptide_ref" : peptide_ref} |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
777 pepmods = [m for m in mz_cursor.execute(PEP_MODS_QUERY, params)] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
778 if pepmods: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
779 for (location, residue, name, modType, unimod) in pepmods: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
780 mods.append('%s-%s' % (location, unimod if unimod else '%s%s' % (name,residue))) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
781 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
782 add_time('PEP_MODS_QUERY',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
783 return ';'.join(mods) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
784 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
785 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
786 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
787 QNAME |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
788 FLAG |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
789 RNAME |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
790 POS |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
791 CIGAR |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
792 SEQ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
793 'NH' : 'i', #number of genomic locations to which the peptide sequence maps |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
794 'XO' : 'Z', #uniqueness of the peptide mapping |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
795 'XL' : 'i', #number of peptides to which the spectrum maps |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
796 'XP' : 'Z', #peptide sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
797 'YP' : 'Z', #Protein accession ID from the original search result |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
798 'XF' : 'Z', #Reading frame of the peptide (0, 1, 2) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
799 'XI' : 'f', #Peptide intensity |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
800 'XB' : 'Z', #massdiff; experimental mass; calculated mass massdiff can be calculated by experimental mass - calculated mass. If any number is unavailable, the value should be left blank (such as 0.01;;). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
801 'XR' : 'Z', #reference peptide sequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
802 'YB' : 'Z', #Preceding amino acids (2 AA, B stands for before). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
803 'YA' : 'Z', #Following amino acids (2 AA, A stands for after). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
804 'XS' : 'f', #PSM score |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
805 'XQ' : 'f', #PSM FDR (i.e. q-value or 1-PEP). |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
806 'XC' : 'i', #peptide charge |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
807 'XA' : 'i', #Whether the peptide is annotated 0:yes; 1:parially unknown; 2:totally unknown; |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
808 'XM' : 'Z', #Modifications |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
809 'XN' : 'i', #Number of missed cleavages in the peptide (XP) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
810 'XT' : 'i', #Enzyme specificity |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
811 'XE' : 'i', #Enzyme used in the experiment |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
812 'XG' : 'A', #Peptide type |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
813 'XU' : 'Z', #URI |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
814 """ |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
815 psm_cursor = get_connection(args.mzsqlite_file).cursor() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
816 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
817 psms = psm_cursor.execute(PSM_QUERY) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
818 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
819 add_time('PSM_QUERY',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
820 proBAM = ProBAM(species=None,assembly=args.genomeReference,seqlens=seqlens,comments=[]) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
821 proBED = ProBED(species=None,assembly=args.genomeReference,comments=[]) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
822 for i, psm in enumerate(psms): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
823 probam_dict = PROBAM_DEFAULTS.copy() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
824 (acc,pep_start,pep_end,aa_pre,aa_post,peptide,spectrum_id,spectrum_title,rank,charge,calcmass,exprmass,pepref) = psm |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
825 scan_name = spectrum_title if spectrum_title else spectrum_id |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
826 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
827 print('\nPSM: %d\t%s' % (i, '\t'.join([str(v) for v in (acc,pep_start,pep_end,peptide,spectrum_id,scan_name,rank,charge,calcmass,exprmass)])), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
828 exons = get_mapping(acc,pep_start,pep_end) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
829 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
830 print('%s' % exons, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
831 if not exons: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
832 continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
833 mods = get_psm_modifications(pepref) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
834 (chrom,chromStart,chromEnd,strand,blockCount,blockSizes,blockStarts) = get_genomic_location(exons) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
835 ref_cds = get_cds(exons) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
836 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
837 print('%s' % ref_cds, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
838 ref_prot = translate(ref_cds) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
839 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
840 print('%s' % ref_prot, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
841 print('%s' % peptide, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
842 spectrum_peptides = spectrum_peptide_count(spectrum_id) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
843 peptide_locations = genomic_mapping_count(peptide) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
844 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
845 print('spectrum_peptide_count: %d\tpeptide_location_count: %d' % (spectrum_peptides,peptide_locations), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
846 uniqueness = 'unique' if peptide_locations == 1 else 'not-unique[unknown]' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
847 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
848 proBEDEntry = ProBEDEntry(chrom,chromStart,chromEnd, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
849 '%s_%s' % (acc,scan_name), |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
850 1000,strand, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
851 blockCount,blockSizes,blockStarts, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
852 acc,peptide,uniqueness,args.genomeReference, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
853 charge=charge,expMassToCharge=exprmass,calcMassToCharge=calcmass, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
854 mods=mods if mods else '.', psmRank=rank) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
855 proBED.add_entry(proBEDEntry) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
856 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
857 add_time('add_probed',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
858 if len(ref_prot) != len(peptide): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
859 continue |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
860 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
861 probam_dict['NH'] = peptide_locations |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
862 probam_dict['XO'] = uniqueness |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
863 probam_dict['XL'] = peptide_locations |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
864 probam_dict['XP'] = peptide |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
865 probam_dict['YP'] = acc |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
866 probam_dict['XC'] = charge |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
867 probam_dict['XB'] = '%f;%f;%f' % (exprmass - calcmass, exprmass, calcmass) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
868 probam_dict['XR'] = ref_prot # ? dbSequence |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
869 probam_dict['YA'] = aa_post |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
870 probam_dict['YB'] = aa_pre |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
871 probam_dict['XM'] = mods if mods else '*' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
872 flag = 16 if strand == '-' else 0 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
873 if str(rank)!=str(1) and rank!='*' and rank!=[] and rank!="": |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
874 flag += 256 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
875 probam_dict['XF'] = ','.join([str(e[2] % 3) for e in exons]) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
876 ## check for variation from ref_cds |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
877 pep_cds = get_variant_cds(exons,ref_prot,peptide,ref_cds) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
878 peptide_type = '*' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
879 ## XG classify peptide |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
880 probam_dict['XG'] = get_peptide_type(exons) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
881 ## probam_dict['MD'] = peptide |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
882 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
883 ## FIX SAM sequence is forward strand |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
884 seq = pep_cds if strand == '+' else reverse_complement(pep_cds) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
885 ## cigar based on plus strand |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
886 cigar = '' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
887 if strand == '+': |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
888 blkStarts = blockStarts |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
889 blkSizes = blockSizes |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
890 else: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
891 blkStarts = [x for x in reversed(blockStarts)] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
892 blkSizes = [x for x in reversed(blockSizes)] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
893 for j in range(blockCount): |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
894 if j > 0: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
895 intron = blkStarts[j] - (blkStarts[j-1] + blkSizes[j-1]) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
896 if intron > 0: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
897 cigar += '%dN' % intron |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
898 cigar += '%dM' % blkSizes[j] |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
899 ## Mods TODO |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
900 proBAMEntry = ProBAMEntry(qname=scan_name, flag=flag, rname=chrom, pos=chromStart+1, |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
901 cigar=cigar,seq=seq,optional=probam_dict) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
902 proBAM.add_entry(proBAMEntry) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
903 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
904 add_time('add_probam',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
905 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
906 if args.debug: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
907 print('%s' % probam_dict, file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
908 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
909 if args.limit and i >= args.limit: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
910 break |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
911 if args.probed: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
912 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
913 with open(args.probed,'w') as fh: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
914 proBED.write(fh) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
915 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
916 add_time('write_probed',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
917 if args.prosam or args.probam: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
918 samfile = args.prosam if args.prosam else 'temp.sam' |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
919 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
920 with open(samfile,'w') as fh: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
921 proBAM.write(fh) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
922 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
923 add_time('write_prosam',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
924 if args.probam: |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
925 ts = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
926 bamfile = args.prosam.replace('.sam','.bam') |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
927 pysam.view(samfile, '-b', '-o', args.probam, catch_stdout=False) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
928 te = time() |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
929 add_time('write_probam',te - ts) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
930 pysam.index(args.probam) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
931 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
932 print('\n%s\n' % str(timings), file=sys.stderr) |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
933 |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
934 if __name__ == "__main__": |
492f98d89e26
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/mzsqlite_psm_align commit 88e2fb9c31fbd687a0956924a870137d1fb9bee3-dirty
jjohnson
parents:
diff
changeset
|
935 __main__() |