Mercurial > repos > galaxyp > mzsqlite_psm_align
annotate profmt.py @ 1:4f8cf8fbef57 draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit b0c57cac4e558d974a16b14d4498cf8d4ba9e0c7
author | galaxyp |
---|---|
date | Thu, 19 Apr 2018 14:30:28 -0400 |
parents | f2dc9805107a |
children |
rev | line source |
---|---|
0
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
1 #!/usr/bin/env python |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
2 """ |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
3 # |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
4 #------------------------------------------------------------------------------ |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
5 # University of Minnesota |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
6 # Copyright 2018, Regents of the University of Minnesota |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
7 #------------------------------------------------------------------------------ |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
8 # Author: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
9 # |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
10 # James E Johnson |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
11 # |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
12 #------------------------------------------------------------------------------ |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
13 """ |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
14 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
15 import sys,re |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
16 from operator import itemgetter, attrgetter |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
17 from twobitreader import TwoBitFile |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
18 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
19 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
20 PROBAM_TAGS = ['NH', 'XO', 'XL', 'XP', 'YP', 'XF', 'XI', 'XB', 'XR', 'YB', 'YA', 'XS', 'XQ', 'XC', 'XA', 'XM', 'XN', 'XT', 'XE', 'XG', 'XU'] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
21 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
22 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
23 PROBAM_TYTPES = { |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
24 'NH' : 'i', #number of genomic locations to which the peptide sequence maps |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
25 'XO' : 'Z', #uniqueness of the peptide mapping |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
26 'XL' : 'i', #number of peptides to which the spectrum maps |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
27 'XP' : 'Z', #peptide sequence |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
28 'YP' : 'Z', #Protein accession ID from the original search result |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
29 'XF' : 'Z', #Reading frame of the peptide (0, 1, 2) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
30 'XI' : 'f', #Peptide intensity |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
31 '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;;). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
32 'XR' : 'Z', #reference peptide sequence |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
33 'YB' : 'Z', #Preceding amino acids (2 AA, B stands for before). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
34 'YA' : 'Z', #Following amino acids (2 AA, A stands for after). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
35 'XS' : 'f', #PSM score |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
36 'XQ' : 'f', #PSM FDR (i.e. q-value or 1-PEP). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
37 'XC' : 'i', #peptide charge |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
38 'XA' : 'i', #Whether the peptide is annotated 0:yes; 1:parially unknown; 2:totally unknown; |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
39 'XM' : 'Z', #Modifications |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
40 'XN' : 'i', #Number of missed cleavages in the peptide (XP) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
41 'XT' : 'i', #Enzyme specificity |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
42 'XE' : 'i', #Enzyme used in the experiment |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
43 'XG' : 'A', #Peptide type |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
44 'XU' : 'Z', #URI |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
45 } |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
46 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
47 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
48 PROBAM_DEFAULTS = { |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
49 'NH' : -1, #number of genomic locations to which the peptide sequence maps |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
50 'XO' : '*', #uniqueness of the peptide mapping |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
51 'XL' : -1, #number of peptides to which the spectrum maps |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
52 'XP' : '*', #peptide sequence |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
53 'YP' : '*', #Protein accession ID from the original search result |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
54 'XF' : '*', #Reading frame of the peptide (0, 1, 2) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
55 'XI' : -1, #Peptide intensity |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
56 'XB' : '*', #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;;). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
57 'XR' : '*', #reference peptide sequence |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
58 'YB' : '*', #Preceding amino acids (2 AA, B stands for before). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
59 'YA' : '*', #Following amino acids (2 AA, A stands for after). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
60 'XS' : -1, #PSM score |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
61 'XQ' : -1, #PSM FDR (i.e. q-value or 1-PEP). |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
62 'XC' : -1, #peptide charge |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
63 'XA' : -1, #Whether the peptide is annotated 0:yes; 1:parially unknown; 2:totally unknown; |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
64 'XM' : '*', #Modifications |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
65 'XN' : -1, #Number of missed cleavages in the peptide (XP) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
66 'XT' : -1, #Enzyme specificity |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
67 'XE' : -1, #Enzyme used in the experiment |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
68 'XG' : '*', #Peptide type |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
69 'XU' : '*', #URI |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
70 } |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
71 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
72 def cmp_alphanumeric(s1,s2): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
73 if s1 == s2: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
74 return 0 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
75 a1 = re.findall("\d+|[a-zA-Z]+",s1) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
76 a2 = re.findall("\d+|[a-zA-Z]+",s2) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
77 for i in range(min(len(a1),len(a2))): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
78 if a1[i] == a2[i]: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
79 continue |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
80 if a1[i].isdigit() and a2[i].isdigit(): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
81 return int(a1[i]) - int(a2[i]) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
82 return 1 if a1[i] > a2[i] else -1 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
83 return len(a1) - len(a2) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
84 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
85 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
86 def sort_chrom_names(names): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
87 rnames = sorted(names,cmp=cmp_alphanumeric) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
88 if 'chrM' in rnames: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
89 rnames.remove('chrM') |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
90 rnames.insert(0,'chrM') |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
91 if 'MT' in rnames: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
92 rnames.remove('MT') |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
93 rnames.append('MT') |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
94 return rnames |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
95 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
96 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
97 def as_int_list(obj): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
98 if obj is None: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
99 return None |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
100 if isinstance(obj, list): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
101 return [int(x) for x in obj] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
102 elif isinstance(obj, str): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
103 return [int(x) for x in obj.split(',')] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
104 else: # python2 unicode? |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
105 return [int(x) for x in str(obj).split(',')] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
106 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
107 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
108 class ProBEDEntry (object): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
109 def __init__(self, chrom, chromStart, chromEnd, name, score, strand, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
110 blockCount, blockSizes, blockStarts, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
111 protacc, peptide, uniqueness, genomeReference, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
112 psmScore='.', fdr='.', mods='.', charge='.', |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
113 expMassToCharge='.', calcMassToCharge='.', |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
114 psmRank='.', datasetID='.', uri='.'): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
115 self.chrom = chrom |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
116 self.chromStart = int(chromStart) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
117 self.chromEnd = int(chromEnd) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
118 self.name = name |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
119 self.score = int(score) if score is not None else 0 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
120 self.strand = '-' if str(strand).startswith('-') else '+' |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
121 self.thickStart = self.chromStart |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
122 self.thickEnd = self.chromEnd |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
123 self.itemRgb = '0' |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
124 self.blockCount = int(blockCount) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
125 self.blockSizes = as_int_list(blockSizes) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
126 self.blockStarts = as_int_list(blockStarts) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
127 self.protacc = protacc |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
128 self.peptide = peptide |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
129 self.uniqueness = uniqueness |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
130 self.genomeReference = genomeReference |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
131 self.psmScore = psmScore |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
132 self.fdr = fdr |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
133 self.mods = mods |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
134 self.charge = charge |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
135 self.expMassToCharge = expMassToCharge |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
136 self.calcMassToCharge = calcMassToCharge |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
137 self.psmRank = psmRank |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
138 self.datasetID = datasetID |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
139 self.uri = uri |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
140 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
141 def __str__(self): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
142 return '%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' % \ |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
143 (self.chrom, self.chromStart, self.chromEnd, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
144 self.name, self.score, self.strand, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
145 self.thickStart, self.thickEnd, self.itemRgb, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
146 self.blockCount, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
147 ','.join([str(x) for x in self.blockSizes]), |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
148 ','.join([str(x) for x in self.blockStarts]), |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
149 self.protacc, self.peptide, self.uniqueness, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
150 self.genomeReference, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
151 self.psmScore, self.fdr, self.mods, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
152 self.charge, self.expMassToCharge, self.calcMassToCharge, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
153 self.psmRank, self.datasetID, self.uri) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
154 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
155 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
156 class ProBED ( object ): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
157 def __init__(self,species=None,assembly=None,comments=[]): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
158 self.species = species |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
159 self.assembly = assembly |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
160 self.comments = comments |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
161 self.entries = dict() |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
162 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
163 def add_entry(self,entry): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
164 if not entry.chrom in self.entries: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
165 self.entries[entry.chrom] = [] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
166 self.entries[entry.chrom].append(entry) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
167 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
168 def write(self,fh): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
169 rnames = sort_chrom_names(self.entries.keys()) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
170 for sn in rnames: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
171 if sn not in self.entries: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
172 continue |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
173 for pbe in sorted(self.entries[sn], key=attrgetter('chromStart','chromEnd')): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
174 fh.write(str(pbe)) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
175 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
176 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
177 class ProBAMEntry (object): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
178 def __init__(self, qname='', flag=0, rname='', pos=0, mapq=255, cigar='', rnext='*', pnext='0', tlen='0', seq='*', qual='*', optional=PROBAM_DEFAULTS): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
179 self.qname = qname |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
180 self.flag = flag |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
181 self.rname = rname |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
182 self.pos = pos |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
183 self.mapq = mapq |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
184 self.cigar = cigar |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
185 self.rnext = rnext |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
186 self.pnext = pnext |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
187 self.tlen = tlen |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
188 self.seq = seq |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
189 self.qual = qual |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
190 self.optional = optional |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
191 def __str__(self): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
192 opt_cols = '\t%s' % '\t'.join(['%s:%s:%s' % (t,PROBAM_TYTPES[t],self.optional[t]) for t in PROBAM_TAGS]) if self.optional else '' |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
193 return '%s\t%d\t%s\t%d\t%d\t%s\t%s\t%s\t%s\t%s\t%s%s' % ( |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
194 self.qname,self.flag,self.rname,self.pos,self.mapq,self.cigar, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
195 str(self.rnext) if self.rnext else '', |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
196 str(self.pnext) if self.pnext else '', |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
197 str(self.tlen) if self.tlen else '', |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
198 self.seq, |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
199 self.qual, opt_cols) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
200 def add_optional(self,tag,value): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
201 self.optional[tag] = value |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
202 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
203 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
204 class ProBAM ( object ): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
205 def __init__(self,species=None,assembly=None,seqlens={},comments=[]): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
206 self.species = species |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
207 self.assembly = assembly |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
208 self.seqlens = seqlens |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
209 self.comments = comments |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
210 self.entries = dict() |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
211 self.opt_columns = set() |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
212 self.rg = [] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
213 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
214 def add_entry(self,pb_entry): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
215 if not pb_entry.rname in self.entries: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
216 self.entries[pb_entry.rname] = [] |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
217 self.entries[pb_entry.rname].append(pb_entry) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
218 if pb_entry.optional: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
219 self.opt_columns | set(pb_entry.optional.keys()) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
220 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
221 def add_entry_from_bed(self,bed_entry,optional=dict()): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
222 if bed_entry.pep: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
223 optional['XP:Z'] = bed_entry.pep |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
224 qname=bed_entry.name |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
225 flag = 0 if bed_entry.strand == '+' else 16 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
226 rname = bed_entry.chrom |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
227 pos = bed_entry.chromStart + 1 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
228 cigar = bed_entry.get_cigar() |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
229 seq = bed_entry.get_spliced_seq(strand='+') if bed_entry.seq else '*' |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
230 pb_entry = ProBAMEntry(qname=qname, flag=flag, rname=rname, pos=pos,cigar=cigar,seq=seq,optional=optional) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
231 self.add_entry(pb_entry) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
232 |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
233 def write(self,fh): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
234 fh.write('@HD VN:1.0 SO:coordinate\n') |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
235 rnames = sort_chrom_names(self.seqlens.keys()) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
236 for sn in rnames: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
237 fh.write('@SQ\tSN:%s\tLN:%d\n' % (sn,self.seqlens[sn])) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
238 for rg in self.rg: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
239 fh.write('@RG\tID:%s\n' % (rg)) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
240 fh.write('@PG\tID:SampleSpecificGenerator\n') |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
241 for comment in self.comments: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
242 fh.write('@CO\t%s\n' % comment) |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
243 for sn in rnames: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
244 if sn not in self.entries: |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
245 continue |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
246 for pbe in sorted(self.entries[sn], key=attrgetter('pos')): |
f2dc9805107a
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mzsqlite_psm_align commit 464e05be1084ed9a65b542c8eabb18147d425666
galaxyp
parents:
diff
changeset
|
247 fh.write('%s\n' % str(pbe)) |