Mercurial > repos > galaxyp > mqppep_anova
annotate mqppep_mrgfltr.py @ 5:7d1f8a256cf6 draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit aa5f4a19e76ec636812865293b8ee9b196122121
| author | galaxyp | 
|---|---|
| date | Fri, 17 Feb 2023 22:38:21 +0000 | 
| parents | 2276e88d5a1f | 
| children | 
| rev | line source | 
|---|---|
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1 #!/usr/bin/env python | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 2 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 3 # Import the packages needed | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 4 import argparse | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 5 import operator # for operator.itemgetter | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 6 import os.path | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 7 import re | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 8 import shutil # for shutil.copyfile(src, dest) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 9 import sqlite3 as sql | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 10 import sys # import the sys module for exc_info | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 11 import time | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 12 import traceback # for formatting stack-trace | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 13 from codecs import getreader as cx_getreader | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 14 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 15 import numpy as np | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 16 import pandas | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 17 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 18 # global constants | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 19 N_A = "N/A" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 20 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 21 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 22 # ref: https://stackoverflow.com/a/8915613/15509512 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 23 # answers: "How to handle exceptions in a list comprehensions" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 24 # usage: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 25 # from math import log | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 26 # eggs = [1,3,0,3,2] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 27 # print([x for x in [catch(log, egg) for egg in eggs] if x is not None]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 28 # producing: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 29 # for <built-in function log> | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 30 # with args (0,) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 31 # exception: math domain error | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 32 # [0.0, 1.0986122886681098, 1.0986122886681098, 0.6931471805599453] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 33 def catch(func, *args, handle=lambda e: e, **kwargs): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 34 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 35 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 36 return func(*args, **kwargs) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 37 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 38 print("For %s" % str(func)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 39 print(" with args %s" % str(args)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 40 print(" caught exception: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 41 (ty, va, tb) = sys.exc_info() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 42 print(" stack trace: " + str(traceback.format_exception(ty, va, tb))) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 43 exit(-1) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 44 return None | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 45 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 46 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 47 def whine(func, *args, handle=lambda e: e, **kwargs): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 48 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 49 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 50 return func(*args, **kwargs) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 51 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 52 print("Warning: For %s" % str(func)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 53 print(" with args %s" % str(args)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 54 print(" caught exception: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 55 (ty, va, tb) = sys.exc_info() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 56 print(" stack trace: " + str(traceback.format_exception(ty, va, tb))) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 57 return None | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 58 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 59 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 60 def ppep_join(x): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 61 x = [i for i in x if N_A != i] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 62 result = "%s" % " | ".join(x) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 63 if result != "": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 64 return result | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 65 else: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 66 return N_A | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 67 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 68 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 69 def melt_join(x): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 70 tmp = {key.lower(): key for key in x} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 71 result = "%s" % " | ".join([tmp[key] for key in tmp]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 72 return result | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 73 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 74 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 75 def __main__(): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 76 # Parse Command Line | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 77 parser = argparse.ArgumentParser( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 78 description="Phopsphoproteomic Enrichment Pipeline Merge and Filter." | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 79 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 80 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 81 # inputs: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 82 # Phosphopeptide data for experimental results, including the intensities | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 83 # and the mapping to kinase domains, in tabular format. | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 84 parser.add_argument( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 85 "--phosphopeptides", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 86 "-p", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 87 nargs=1, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 88 required=True, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 89 dest="phosphopeptides", | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 90 help=" ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 91 "Phosphopeptide data for experimental results, including the", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 92 "intensities and the mapping to kinase domains, in tabular format" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 93 ]), | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 94 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 95 # UniProtKB/SwissProt DB input, SQLite | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 96 parser.add_argument( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 97 "--ppep_mapping_db", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 98 "-d", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 99 nargs=1, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 100 required=True, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 101 dest="ppep_mapping_db", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 102 help="UniProtKB/SwissProt SQLite Database", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 103 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 104 # species to limit records chosed from PhosPhositesPlus | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 105 parser.add_argument( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 106 "--species", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 107 "-x", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 108 nargs=1, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 109 required=False, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 110 default=[], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 111 dest="species", | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 112 help=" ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 113 "limit PhosphoSitePlus records to indicated species", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 114 "(field may be empty)" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 115 ]), | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 116 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 117 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 118 # outputs: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 119 # tabular output | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 120 parser.add_argument( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 121 "--mrgfltr_tab", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 122 "-o", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 123 nargs=1, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 124 required=True, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 125 dest="mrgfltr_tab", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 126 help="Tabular output file for results", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 127 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 128 # CSV output | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 129 parser.add_argument( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 130 "--mrgfltr_csv", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 131 "-c", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 132 nargs=1, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 133 required=True, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 134 dest="mrgfltr_csv", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 135 help="CSV output file for results", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 136 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 137 # SQLite output | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 138 parser.add_argument( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 139 "--mrgfltr_sqlite", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 140 "-S", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 141 nargs=1, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 142 required=True, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 143 dest="mrgfltr_sqlite", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 144 help="SQLite output file for results", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 145 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 146 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 147 # "Make it so!" (parse the arguments) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 148 options = parser.parse_args() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 149 print("options: " + str(options)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 150 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 151 # determine phosphopeptide ("upstream map") input tabular file access | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 152 if options.phosphopeptides is None: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 153 exit('Argument "phosphopeptides" is required but not supplied') | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 154 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 155 upstream_map_filename_tab = os.path.abspath(options.phosphopeptides[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 156 input_file = open(upstream_map_filename_tab, "r") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 157 input_file.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 158 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 159 exit("Error parsing phosphopeptides argument: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 160 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 161 # determine input SQLite access | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 162 if options.ppep_mapping_db is None: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 163 exit('Argument "ppep_mapping_db" is required but not supplied') | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 164 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 165 uniprot_sqlite = os.path.abspath(options.ppep_mapping_db[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 166 input_file = open(uniprot_sqlite, "rb") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 167 input_file.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 168 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 169 exit("Error parsing ppep_mapping_db argument: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 170 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 171 # copy input SQLite dataset to output SQLite dataset | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 172 if options.mrgfltr_sqlite is None: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 173 exit('Argument "mrgfltr_sqlite" is required but not supplied') | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 174 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 175 output_sqlite = os.path.abspath(options.mrgfltr_sqlite[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 176 shutil.copyfile(uniprot_sqlite, output_sqlite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 177 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 178 exit("Error copying ppep_mapping_db to mrgfltr_sqlite: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 179 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 180 # determine species to limit records from PSP_Regulatory_Sites | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 181 if options.species is None: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 182 exit( | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 183 'Argument "species" is required (& may be empty) but not supplied' | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 184 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 185 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 186 if len(options.species) > 0: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 187 species = options.species[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 188 else: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 189 species = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 190 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 191 exit("Error parsing species argument: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 192 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 193 # determine tabular output destination | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 194 if options.mrgfltr_tab is None: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 195 exit('Argument "mrgfltr_tab" is required but not supplied') | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 196 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 197 output_filename_tab = os.path.abspath(options.mrgfltr_tab[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 198 output_file = open(output_filename_tab, "w") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 199 output_file.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 200 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 201 exit("Error parsing mrgfltr_tab argument: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 202 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 203 # determine CSV output destination | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 204 if options.mrgfltr_csv is None: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 205 exit('Argument "mrgfltr_csv" is required but not supplied') | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 206 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 207 output_filename_csv = os.path.abspath(options.mrgfltr_csv[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 208 output_file = open(output_filename_csv, "w") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 209 output_file.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 210 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 211 exit("Error parsing mrgfltr_csv argument: %s" % str(e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 212 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 213 def mqpep_getswissprot(): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 214 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 215 # | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 216 # copied from Excel Output Script.ipynb BEGIN # | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 217 # | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 218 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 219 # String Constants ################# | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 220 DEPHOSPHOPEP = "DephosphoPep" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 221 DESCRIPTION = "Description" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 222 FUNCTION_PHOSPHORESIDUE = ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 223 "Function Phosphoresidue(PSP=PhosphoSitePlus.org)" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 224 ) | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 225 # Gene Name from UniProtKB | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 226 GENE_NAME = "Gene_Name" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 227 # ON_FUNCTION column from PSP_Regulatory_Sites | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 228 ON_FUNCTION = ("ON_FUNCTION") | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 229 # NOTES column from PSP_Regulatory_Sites | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 230 ON_NOTES = "NOTES" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 231 # ON_OTHER_INTERACT column from PSP_Regulatory_Sites | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 232 ON_OTHER_INTERACT = "ON_OTHER_INTERACT" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 233 # ON_PROCESS column from PSP_Regulatory_Sites | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 234 ON_PROCESS = ("ON_PROCESS") | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 235 # ON_PROT_INTERACT column from PSP_Regulatory_Sites | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 236 ON_PROT_INTERACT = "ON_PROT_INTERACT" | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 237 PHOSPHOPEPTIDE = "Phosphopeptide" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 238 PHOSPHOPEPTIDE_MATCH = "Phosphopeptide_match" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 239 PHOSPHORESIDUE = "Phosphoresidue" | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 240 PUTATIVE_UPSTREAM_DOMAINS = " ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 241 "Putative Upstream Kinases(PSP=PhosphoSitePlus.org)/", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 242 "Phosphatases/Binding Domains" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 243 ]) | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 244 SEQUENCE = "Sequence" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 245 SEQUENCE10 = "Sequence10" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 246 SEQUENCE7 = "Sequence7" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 247 SITE_PLUSMINUS_7AA_SQL = "SITE_PLUSMINUS_7AA" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 248 UNIPROT_ID = "UniProt_ID" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 249 UNIPROT_SEQ_AND_META_SQL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 250 select Uniprot_ID, Description, Gene_Name, Sequence, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 251 Organism_Name, Organism_ID, PE, SV | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 252 from UniProtKB | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 253 order by Sequence, UniProt_ID | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 254 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 255 UNIPROT_UNIQUE_SEQ_SQL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 256 select distinct Sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 257 from UniProtKB | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 258 group by Sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 259 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 260 PPEP_PEP_UNIPROTSEQ_SQL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 261 select distinct phosphopeptide, peptide, sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 262 from uniprotkb_pep_ppep_view | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 263 order by sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 264 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 265 PPEP_MELT_SQL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 266 SELECT DISTINCT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 267 phospho_peptide AS 'p_peptide', | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 268 kinase_map AS 'characterization', | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 269 'X' AS 'X' | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 270 FROM ppep_gene_site_view | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 271 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 272 # CREATE TABLE PSP_Regulatory_site ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 273 # site_plusminus_7AA TEXT PRIMARY KEY ON CONFLICT IGNORE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 274 # domain TEXT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 275 # ON_FUNCTION TEXT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 276 # ON_PROCESS TEXT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 277 # ON_PROT_INTERACT TEXT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 278 # ON_OTHER_INTERACT TEXT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 279 # notes TEXT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 280 # organism TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 281 # ); | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 282 PSP_REGSITE_SQL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 283 SELECT DISTINCT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 284 SITE_PLUSMINUS_7AA , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 285 DOMAIN , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 286 ON_FUNCTION , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 287 ON_PROCESS , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 288 ON_PROT_INTERACT , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 289 ON_OTHER_INTERACT , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 290 NOTES , | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 291 ORGANISM | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 292 FROM PSP_Regulatory_site | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 293 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 294 PPEP_ID_SQL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 295 SELECT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 296 id AS 'ppep_id', | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 297 seq AS 'ppep_seq' | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 298 FROM ppep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 299 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 300 MRGFLTR_DDL = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 301 DROP VIEW IF EXISTS mrgfltr_metadata_view; | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 302 DROP TABLE IF EXISTS mrgfltr_metadata; | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 303 CREATE TABLE mrgfltr_metadata | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 304 ( ppep_id INTEGER REFERENCES ppep(id) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 305 , Sequence10 TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 306 , Sequence7 TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 307 , GeneName TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 308 , Phosphoresidue TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 309 , UniProtID TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 310 , Description TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 311 , FunctionPhosphoresidue TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 312 , PutativeUpstreamDomains TEXT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 313 , PRIMARY KEY (ppep_id) ON CONFLICT IGNORE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 314 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 315 ; | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 316 CREATE VIEW mrgfltr_metadata_view AS | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 317 SELECT DISTINCT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 318 ppep.seq AS phospho_peptide | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 319 , Sequence10 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 320 , Sequence7 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 321 , GeneName | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 322 , Phosphoresidue | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 323 , UniProtID | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 324 , Description | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 325 , FunctionPhosphoresidue | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 326 , PutativeUpstreamDomains | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 327 FROM | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 328 ppep, mrgfltr_metadata | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 329 WHERE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 330 mrgfltr_metadata.ppep_id = ppep.id | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 331 ORDER BY | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 332 ppep.seq | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 333 ; | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 334 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 335 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 336 CITATION_INSERT_STMT = """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 337 INSERT INTO Citation ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 338 ObjectName, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 339 CitationData | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 340 ) VALUES (?,?) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 341 """ | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 342 CITATION_INSERT_PSP = " ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 343 "PhosphoSitePlus(R) (PSP) was created by Cell Signaling", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 344 "Technology Inc. It is licensed under a Creative Commons", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 345 "Attribution-NonCommercial-ShareAlike 3.0 Unported License.", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 346 "When using PSP data or analyses in printed publications or", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 347 "in online resources, the following acknowledgements must be", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 348 "included: (a) the words", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 349 '"PhosphoSitePlus(R), www.phosphosite.org" must', | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 350 "be included at appropriate places in the text or webpage,", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 351 "and (b) the following citation must be included in the", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 352 'bibliography: "Hornbeck PV, Zhang B, Murray B, Kornhauser', | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 353 "JM, Latham V, Skrzypek E PhosphoSitePlus, 2014: mutations,", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 354 "PTMs and recalibrations. Nucleic Acids Res. 2015", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 355 '43:D512-20. PMID: 25514926."' | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 356 ]) | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 357 CITATION_INSERT_PSP_REF = " ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 358 'Hornbeck, 2014, "PhosphoSitePlus, 2014: mutations, PTMs and', | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 359 'recalibrations.", https://pubmed.ncbi.nlm.nih.gov/22135298,', | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 360 "https://doi.org/10.1093/nar/gkr1122" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 361 ]) | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 362 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 363 MRGFLTR_METADATA_COLUMNS = [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 364 "ppep_id", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 365 "Sequence10", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 366 "Sequence7", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 367 "GeneName", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 368 "Phosphoresidue", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 369 "UniProtID", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 370 "Description", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 371 "FunctionPhosphoresidue", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 372 "PutativeUpstreamDomains", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 373 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 374 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 375 # String Constants (end) ############ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 376 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 377 class Error(Exception): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 378 """Base class for exceptions in this module.""" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 379 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 380 pass | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 381 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 382 class PreconditionError(Error): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 383 """Exception raised for errors in the input. | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 384 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 385 Attributes: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 386 expression -- input expression in which the error occurred | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 387 message -- explanation of the error | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 388 """ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 389 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 390 def __init__(self, expression, message): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 391 self.expression = expression | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 392 self.message = message | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 393 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 394 # start_time = time.clock() #timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 395 start_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 396 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 397 # get keys from upstream tabular file using readline() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 398 # ref: https://stackoverflow.com/a/16713581/15509512 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 399 # answer to "Use codecs to read file with correct encoding" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 400 file1_encoded = open(upstream_map_filename_tab, "rb") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 401 file1 = cx_getreader("latin-1")(file1_encoded) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 402 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 403 count = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 404 upstream_map_p_peptide_list = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 405 re_tab = re.compile("^[^\t]*") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 406 while True: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 407 count += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 408 # Get next line from file | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 409 line = file1.readline() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 410 # if line is empty | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 411 # end of file is reached | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 412 if not line: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 413 break | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 414 if count > 1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 415 m = re_tab.match(line) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 416 upstream_map_p_peptide_list.append(m[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 417 file1.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 418 file1_encoded.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 419 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 420 # Get the list of phosphopeptides with the p's that represent | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 421 # the phosphorylation sites removed | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 422 re_phos = re.compile("p") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 423 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 424 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 425 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 426 "%0.6f pre-read-SwissProt [0.1]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 427 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 428 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 429 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 430 # -------- Get SwissProt data from SQLite database (start) ----------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 431 # build UniProt sequence LUT and list of unique SwissProt sequences | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 432 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 433 # Open SwissProt SQLite database | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 434 conn = sql.connect(uniprot_sqlite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 435 cur = conn.cursor() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 436 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 437 # Set up structures to hold SwissProt data | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 438 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 439 uniprot_Sequence_List = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 440 UniProtSeqLUT = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 441 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 442 # Execute query for unique seqs without fetching the results yet | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 443 uniprot_unique_seq_cur = cur.execute(UNIPROT_UNIQUE_SEQ_SQL) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 444 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 445 while 1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 446 batch = uniprot_unique_seq_cur.fetchmany(size=50) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 447 if not batch: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 448 # handle case where no records are returned | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 449 break | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 450 for row in batch: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 451 Sequence = row[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 452 UniProtSeqLUT[(Sequence, DESCRIPTION)] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 453 UniProtSeqLUT[(Sequence, GENE_NAME)] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 454 UniProtSeqLUT[(Sequence, UNIPROT_ID)] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 455 UniProtSeqLUT[Sequence] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 456 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 457 # Execute query for seqs and metadata without fetching the results yet | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 458 uniprot_seq_and_meta = cur.execute(UNIPROT_SEQ_AND_META_SQL) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 459 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 460 while 1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 461 batch = uniprot_seq_and_meta.fetchmany(size=50) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 462 if not batch: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 463 # handle case where no records are returned | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 464 break | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 465 for ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 466 UniProt_ID, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 467 Description, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 468 Gene_Name, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 469 Sequence, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 470 OS, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 471 OX, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 472 PE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 473 SV, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 474 ) in batch: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 475 uniprot_Sequence_List.append(Sequence) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 476 UniProtSeqLUT[Sequence] = Sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 477 UniProtSeqLUT[(Sequence, UNIPROT_ID)].append(UniProt_ID) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 478 UniProtSeqLUT[(Sequence, GENE_NAME)].append(Gene_Name) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 479 if OS != N_A: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 480 Description += " OS=" + OS | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 481 if OX != -1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 482 Description += " OX=" + str(OX) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 483 if Gene_Name != N_A: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 484 Description += " GN=" + Gene_Name | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 485 if PE != N_A: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 486 Description += " PE=" + PE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 487 if SV != N_A: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 488 Description += " SV=" + SV | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 489 UniProtSeqLUT[(Sequence, DESCRIPTION)].append(Description) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 490 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 491 # Close SwissProt SQLite database; clean up local variables | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 492 conn.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 493 Sequence = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 494 UniProt_ID = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 495 Description = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 496 Gene_Name = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 497 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 498 # -------- Get SwissProt data from SQLite database (finish) ----------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 499 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 500 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 501 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 502 "%0.6f post-read-SwissProt [0.2]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 503 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 504 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 505 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 506 # -------- Get SwissProt data from SQLite database (start) ----------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 507 # Open SwissProt SQLite database | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 508 conn = sql.connect(uniprot_sqlite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 509 cur = conn.cursor() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 510 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 511 # Set up dictionary to aggregate results for phosphopeptides | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 512 # corresponding to dephosphoeptide | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 513 DephosphoPep_UniProtSeq_LUT = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 514 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 515 # Set up dictionary to accumulate results | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 516 PhosphoPep_UniProtSeq_LUT = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 517 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 518 # Execute query for tuples without fetching the results yet | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 519 ppep_pep_uniprotseq_cur = cur.execute(PPEP_PEP_UNIPROTSEQ_SQL) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 520 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 521 while 1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 522 batch = ppep_pep_uniprotseq_cur.fetchmany(size=50) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 523 if not batch: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 524 # handle case where no records are returned | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 525 break | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 526 for (phospho_pep, dephospho_pep, sequence) in batch: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 527 # do interesting stuff here... | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 528 PhosphoPep_UniProtSeq_LUT[phospho_pep] = phospho_pep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 529 PhosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 530 (phospho_pep, DEPHOSPHOPEP) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 531 ] = dephospho_pep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 532 if dephospho_pep not in DephosphoPep_UniProtSeq_LUT: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 533 DephosphoPep_UniProtSeq_LUT[dephospho_pep] = set() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 534 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 535 (dephospho_pep, DESCRIPTION) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 536 ] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 537 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 538 (dephospho_pep, GENE_NAME) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 539 ] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 540 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 541 (dephospho_pep, UNIPROT_ID) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 542 ] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 543 DephosphoPep_UniProtSeq_LUT[(dephospho_pep, SEQUENCE)] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 544 DephosphoPep_UniProtSeq_LUT[dephospho_pep].add(phospho_pep) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 545 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 546 if ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 547 sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 548 not in DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 549 (dephospho_pep, SEQUENCE) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 550 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 551 ): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 552 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 553 (dephospho_pep, SEQUENCE) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 554 ].append(sequence) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 555 for phospho_pep in DephosphoPep_UniProtSeq_LUT[dephospho_pep]: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 556 if phospho_pep != phospho_pep: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 557 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 558 "phospho_pep:'%s' phospho_pep:'%s'" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 559 % (phospho_pep, phospho_pep) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 560 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 561 if phospho_pep not in PhosphoPep_UniProtSeq_LUT: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 562 PhosphoPep_UniProtSeq_LUT[phospho_pep] = phospho_pep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 563 PhosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 564 (phospho_pep, DEPHOSPHOPEP) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 565 ] = dephospho_pep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 566 r = list( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 567 zip( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 568 [s for s in UniProtSeqLUT[(sequence, UNIPROT_ID)]], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 569 [s for s in UniProtSeqLUT[(sequence, GENE_NAME)]], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 570 [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 571 s | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 572 for s in UniProtSeqLUT[(sequence, DESCRIPTION)] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 573 ], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 574 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 575 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 576 # Sort by `UniProt_ID` | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 577 # ref: https://stackoverflow.com/a/4174955/15509512 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 578 r = sorted(r, key=operator.itemgetter(0)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 579 # Get one tuple for each `phospho_pep` | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 580 # in DephosphoPep_UniProtSeq_LUT[dephospho_pep] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 581 for (upid, gn, desc) in r: | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 582 # Append pseudo-tuple per UniProt_ID iff not present | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 583 if ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 584 upid | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 585 not in DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 586 (dephospho_pep, UNIPROT_ID) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 587 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 588 ): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 589 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 590 (dephospho_pep, UNIPROT_ID) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 591 ].append(upid) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 592 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 593 (dephospho_pep, DESCRIPTION) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 594 ].append(desc) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 595 DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 596 (dephospho_pep, GENE_NAME) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 597 ].append(gn) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 598 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 599 # Close SwissProt SQLite database; clean up local variables | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 600 conn.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 601 # wipe local variables | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 602 phospho_pep = dephospho_pep = sequence = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 603 upid = gn = desc = r = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 604 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 605 # -------- Get SwissProt data from SQLite database (finish) ----------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 606 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 607 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 608 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 609 "%0.6f finished reading and decoding '%s' [0.4]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 610 % (end_time - start_time, upstream_map_filename_tab), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 611 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 612 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 613 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 614 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 615 "{:>10} unique upstream phosphopeptides tested".format( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 616 str(len(upstream_map_p_peptide_list)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 617 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 618 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 619 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 620 # Read in Upstream tabular file | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 621 # We are discarding the intensity data; so read it as text | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 622 upstream_data = pandas.read_table( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 623 upstream_map_filename_tab, dtype="str", index_col=0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 624 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 625 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 626 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 627 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 628 "%0.6f read Upstream Map from file [1g_1]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 629 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 630 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 631 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 632 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 633 upstream_data.index = upstream_map_p_peptide_list | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 634 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 635 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 636 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 637 "%0.6f added index to Upstream Map [1g_2]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 638 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 639 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 640 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 641 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 642 # trim upstream_data to include only the upstream map columns | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 643 old_cols = upstream_data.columns.tolist() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 644 i = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 645 first_intensity = -1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 646 last_intensity = -1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 647 intensity_re = re.compile("Intensity.*") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 648 for col_name in old_cols: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 649 m = intensity_re.match(col_name) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 650 if m: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 651 last_intensity = i | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 652 if first_intensity == -1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 653 first_intensity = i | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 654 i += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 655 # print('last intensity = %d' % last_intensity) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 656 col_PKCalpha = last_intensity + 2 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 657 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 658 data_in_cols = [old_cols[0]] + old_cols[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 659 first_intensity - 1: last_intensity | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 660 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 661 data_col_names = [old_cols[0]] + old_cols[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 662 first_intensity: last_intensity + 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 663 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 664 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 665 if upstream_data.empty: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 666 print("upstream_data is empty") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 667 exit(0) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 668 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 669 data_in = upstream_data.copy(deep=True)[data_in_cols] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 670 data_in.columns = data_col_names | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 671 print("data_in") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 672 print(data_in) | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 673 ###################################################################### | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 674 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 675 # Convert floating-point integers to int64 integers | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 676 # ref: https://stackoverflow.com/a/68497603/15509512 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 677 data_in[list(data_in.columns[1:])] = ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 678 data_in[list(data_in.columns[1:])] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 679 .astype("float64") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 680 .apply(np.int64) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 681 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 682 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 683 # create another phosphopeptide column that will be used to join later; | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 684 # MAY need to change depending on Phosphopeptide column position | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 685 # data_in[PHOSPHOPEPTIDE_MATCH] = data_in[data_in.columns.tolist()[0]] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 686 data_in[PHOSPHOPEPTIDE_MATCH] = data_in.index | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 687 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 688 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 689 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 690 "%0.6f set data_in[PHOSPHOPEPTIDE_MATCH] [A]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 691 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 692 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 693 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 694 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 695 # Produce a dictionary of metadata for a single phosphopeptide. | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 696 # This is replaces `UniProtInfo_subdict` from the original code. | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 697 def pseq_to_subdict(phospho_pep): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 698 # Strip "p" from phosphopeptide sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 699 dephospho_pep = re_phos.sub("", phospho_pep) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 700 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 701 # Determine number of phosphoresidues in phosphopeptide | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 702 numps = len(phospho_pep) - len(dephospho_pep) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 703 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 704 # Determine location(s) of phosphoresidue(s) in phosphopeptide | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 705 # (used later for Phosphoresidue, Sequence7, and Sequence10) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 706 ploc = [] # list of p locations | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 707 i = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 708 p = phospho_pep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 709 while i < numps: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 710 ploc.append(p.find("p")) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 711 p = p[: p.find("p")] + p[p.find("p") + 1:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 712 i += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 713 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 714 # Establish nested dictionary | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 715 result = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 716 result[SEQUENCE] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 717 result[UNIPROT_ID] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 718 result[DESCRIPTION] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 719 result[GENE_NAME] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 720 result[PHOSPHORESIDUE] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 721 result[SEQUENCE7] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 722 result[SEQUENCE10] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 723 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 724 # Add stripped sequence to dictionary | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 725 result[SEQUENCE].append(dephospho_pep) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 726 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 727 # Locate phospho_pep in PhosphoPep_UniProtSeq_LUT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 728 # Caller may elect to: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 729 # try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 730 # ... | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 731 # except PreconditionError as pe: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 732 # print("'{expression}': {message}".format( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 733 # expression = pe.expression, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 734 # message = pe.message)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 735 # ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 736 # ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 737 if phospho_pep not in PhosphoPep_UniProtSeq_LUT: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 738 raise PreconditionError( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 739 phospho_pep, | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 740 " ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 741 "no matching phosphopeptide found in", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 742 "PhosphoPep_UniProtSeq_LUT" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 743 ]) | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 744 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 745 if dephospho_pep not in DephosphoPep_UniProtSeq_LUT: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 746 raise PreconditionError( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 747 dephospho_pep, | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 748 " ".join([ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 749 "dephosphorylated phosphopeptide not found", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 750 "in DephosphoPep_UniProtSeq_LUT" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 751 ]) | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 752 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 753 if ( | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 754 dephospho_pep != PhosphoPep_UniProtSeq_LUT[ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 755 (phospho_pep, DEPHOSPHOPEP)] | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 756 ): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 757 my_err_msg = "dephosphorylated phosphopeptide does not match " | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 758 my_err_msg += "PhosphoPep_UniProtSeq_LUT" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 759 my_err_msg += "[(phospho_pep,DEPHOSPHOPEP)] = " | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 760 my_err_msg += PhosphoPep_UniProtSeq_LUT[ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 761 (phospho_pep, DEPHOSPHOPEP)] | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 762 raise PreconditionError(dephospho_pep, my_err_msg) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 763 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 764 result[SEQUENCE] = [dephospho_pep] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 765 result[UNIPROT_ID] = DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 766 (dephospho_pep, UNIPROT_ID) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 767 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 768 result[DESCRIPTION] = DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 769 (dephospho_pep, DESCRIPTION) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 770 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 771 result[GENE_NAME] = DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 772 (dephospho_pep, GENE_NAME) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 773 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 774 if (dephospho_pep, SEQUENCE) not in DephosphoPep_UniProtSeq_LUT: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 775 raise PreconditionError( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 776 dephospho_pep, | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 777 "".join( | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 778 "no matching phosphopeptide found", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 779 "in DephosphoPep_UniProtSeq_LUT") | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 780 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 781 UniProtSeqList = DephosphoPep_UniProtSeq_LUT[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 782 (dephospho_pep, SEQUENCE) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 783 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 784 if len(UniProtSeqList) < 1: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 785 print( | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 786 "Skipping DephosphoPep_UniProtSeq_LUT[('%s',SEQUENCE)] %s" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 787 % (dephospho_pep, "because value has zero length") | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 788 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 789 for UniProtSeq in UniProtSeqList: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 790 i = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 791 phosphoresidues = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 792 seq7s_set = set() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 793 seq7s = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 794 seq10s_set = set() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 795 seq10s = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 796 while i < len(ploc): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 797 start = UniProtSeq.find(dephospho_pep) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 798 # handle case where no sequence was found for dep-pep | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 799 if start < 0: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 800 i += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 801 continue | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 802 psite = ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 803 start + ploc[i] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 804 ) # location of phosphoresidue on protein sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 805 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 806 # add Phosphoresidue | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 807 phosphosite = "p" + str(UniProtSeq)[psite] + str(psite + 1) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 808 phosphoresidues.append(phosphosite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 809 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 810 # Add Sequence7 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 811 if psite < 7: # phospho_pep at N terminus | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 812 seq7 = str(UniProtSeq)[: psite + 8] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 813 if seq7[psite] == "S": # if phosphosresidue is serine | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 814 pres = "s" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 815 elif ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 816 seq7[psite] == "T" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 817 ): # if phosphosresidue is threonine | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 818 pres = "t" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 819 elif ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 820 seq7[psite] == "Y" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 821 ): # if phosphoresidue is tyrosine | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 822 pres = "y" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 823 else: # if not pSTY | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 824 pres = "?" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 825 seq7 = ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 826 seq7[:psite] + pres + seq7[psite + 1: psite + 8] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 827 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 828 while ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 829 len(seq7) < 15 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 830 ): # add appropriate number of "_" to the front | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 831 seq7 = "_" + seq7 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 832 elif ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 833 len(UniProtSeq) - psite < 8 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 834 ): # phospho_pep at C terminus | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 835 seq7 = str(UniProtSeq)[psite - 7:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 836 if seq7[7] == "S": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 837 pres = "s" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 838 elif seq7[7] == "T": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 839 pres = "t" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 840 elif seq7[7] == "Y": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 841 pres = "y" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 842 else: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 843 pres = "?" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 844 seq7 = seq7[:7] + pres + seq7[8:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 845 while ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 846 len(seq7) < 15 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 847 ): # add appropriate number of "_" to the back | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 848 seq7 = seq7 + "_" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 849 else: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 850 seq7 = str(UniProtSeq)[psite - 7: psite + 8] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 851 pres = "" # phosphoresidue | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 852 if seq7[7] == "S": # if phosphosresidue is serine | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 853 pres = "s" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 854 elif seq7[7] == "T": # if phosphosresidue is threonine | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 855 pres = "t" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 856 elif seq7[7] == "Y": # if phosphoresidue is tyrosine | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 857 pres = "y" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 858 else: # if not pSTY | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 859 pres = "?" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 860 seq7 = seq7[:7] + pres + seq7[8:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 861 if seq7 not in seq7s_set: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 862 seq7s.append(seq7) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 863 seq7s_set.add(seq7) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 864 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 865 # add Sequence10 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 866 if psite < 10: # phospho_pep at N terminus | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 867 seq10 = ( | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 868 str(UniProtSeq)[:psite] + "p" + str( | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 869 UniProtSeq)[psite: psite + 11] | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 870 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 871 elif ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 872 len(UniProtSeq) - psite < 11 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 873 ): # phospho_pep at C terminus | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 874 seq10 = ( | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 875 str(UniProtSeq)[psite - 10: psite] + "p" + str( | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 876 UniProtSeq)[psite:] | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 877 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 878 else: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 879 seq10 = str(UniProtSeq)[psite - 10: psite + 11] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 880 seq10 = seq10[:10] + "p" + seq10[10:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 881 if seq10 not in seq10s_set: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 882 seq10s.append(seq10) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 883 seq10s_set.add(seq10) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 884 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 885 i += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 886 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 887 result[PHOSPHORESIDUE].append(phosphoresidues) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 888 result[SEQUENCE7].append(seq7s) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 889 # result[SEQUENCE10] is a list of lists of strings | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 890 result[SEQUENCE10].append(seq10s) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 891 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 892 r = list( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 893 zip( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 894 result[UNIPROT_ID], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 895 result[GENE_NAME], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 896 result[DESCRIPTION], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 897 result[PHOSPHORESIDUE], | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 898 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 899 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 900 # Sort by `UniProt_ID` | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 901 # ref: https://stackoverflow.com//4174955/15509512 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 902 s = sorted(r, key=operator.itemgetter(0)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 903 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 904 result[UNIPROT_ID] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 905 result[GENE_NAME] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 906 result[DESCRIPTION] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 907 result[PHOSPHORESIDUE] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 908 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 909 for r in s: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 910 result[UNIPROT_ID].append(r[0]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 911 result[GENE_NAME].append(r[1]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 912 result[DESCRIPTION].append(r[2]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 913 result[PHOSPHORESIDUE].append(r[3]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 914 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 915 # convert lists to strings in the dictionary | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 916 for key, value in result.items(): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 917 if key not in [PHOSPHORESIDUE, SEQUENCE7, SEQUENCE10]: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 918 result[key] = "; ".join(map(str, value)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 919 elif key in [SEQUENCE10]: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 920 # result[SEQUENCE10] is a list of lists of strings | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 921 joined_value = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 922 joined_set = set() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 923 sep = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 924 for valL in value: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 925 # valL is a list of strings | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 926 for val in valL: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 927 # val is a string | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 928 if val not in joined_set: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 929 joined_set.add(val) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 930 joined_value += sep + val | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 931 sep = "; " | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 932 # joined_value is a string | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 933 result[key] = joined_value | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 934 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 935 newstring = "; ".join( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 936 [", ".join(prez) for prez in result[PHOSPHORESIDUE]] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 937 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 938 result[PHOSPHORESIDUE] = newstring | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 939 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 940 # separate sequence7's by | | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 941 oldstring = result[SEQUENCE7] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 942 oldlist = oldstring | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 943 newstring = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 944 for ol in oldlist: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 945 for e in ol: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 946 if e == ";": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 947 newstring = newstring + " |" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 948 elif len(newstring) > 0 and 1 > newstring.count(e): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 949 newstring = newstring + " | " + e | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 950 elif 1 > newstring.count(e): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 951 newstring = newstring + e | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 952 result[SEQUENCE7] = newstring | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 953 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 954 return [phospho_pep, result] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 955 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 956 # Construct list of [string, dictionary] lists | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 957 # where the dictionary provides the SwissProt metadata | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 958 # for a phosphopeptide | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 959 result_list = [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 960 whine(pseq_to_subdict, psequence) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 961 for psequence in data_in[PHOSPHOPEPTIDE_MATCH] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 962 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 963 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 964 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 965 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 966 "%0.6f added SwissProt annotations to phosphopeptides [B]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 967 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 968 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 969 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 970 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 971 # Construct dictionary from list of lists | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 972 # ref: https://www.8bitavenue.com/\ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 973 # how-to-convert-list-of-lists-to-dictionary-in-python/ | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 974 UniProt_Info = { | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 975 result[0]: result[1] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 976 for result in result_list | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 977 if result is not None | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 978 } | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 979 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 980 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 981 print( | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 982 "%0.6f create dictionary mapping phosphopeptide %s" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 983 % (end_time - start_time, "to metadata dictionary [C]"), | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 984 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 985 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 986 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 987 # cosmetic: add N_A to phosphopeptide rows with no hits | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 988 p_peptide_list = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 989 for key in UniProt_Info: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 990 p_peptide_list.append(key) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 991 for nestedKey in UniProt_Info[key]: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 992 if UniProt_Info[key][nestedKey] == "": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 993 UniProt_Info[key][nestedKey] = N_A | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 994 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 995 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 996 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 997 "%0.6f performed cosmetic clean-up [D]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 998 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 999 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1000 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1001 # convert UniProt_Info dictionary to dataframe | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1002 uniprot_df = pandas.DataFrame.transpose( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1003 pandas.DataFrame.from_dict(UniProt_Info) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1004 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1005 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1006 # reorder columns to match expected output file | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1007 uniprot_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1008 PHOSPHOPEPTIDE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1009 ] = uniprot_df.index # make index a column too | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1010 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1011 cols = uniprot_df.columns.tolist() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1012 # cols = [cols[-1]]+cols[4:6]+[cols[1]]+[cols[2]]+[cols[6]]+[cols[0]] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1013 # uniprot_df = uniprot_df[cols] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1014 uniprot_df = uniprot_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1015 [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1016 PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1017 SEQUENCE10, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1018 SEQUENCE7, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1019 GENE_NAME, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1020 PHOSPHORESIDUE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1021 UNIPROT_ID, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1022 DESCRIPTION, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1023 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1024 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1025 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1026 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1027 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1028 "%0.6f reordered columns to match expected output file [1]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1029 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1030 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1031 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1032 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1033 # concat to split then groupby to collapse | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1034 seq7_df = pandas.concat( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1035 [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1036 pandas.Series(row[PHOSPHOPEPTIDE], row[SEQUENCE7].split(" | ")) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1037 for _, row in uniprot_df.iterrows() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1038 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1039 ).reset_index() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1040 seq7_df.columns = [SEQUENCE7, PHOSPHOPEPTIDE] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1041 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1042 # read in PhosphoSitePlus Regulatory Sites dataset from SQLite | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1043 # --- -------------- begin read PSP_Regulatory_sites ----- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1044 conn = sql.connect(uniprot_sqlite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1045 regsites_df = pandas.read_sql_query(PSP_REGSITE_SQL, conn) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1046 # Close SwissProt SQLite database | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1047 conn.close() | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1048 # ... -------------- end read PSP_Regulatory_sites ------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1049 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1050 # keep only the human entries in dataframe | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1051 if len(species) > 0: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1052 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1053 'Limit PhosphoSitesPlus records to species "' + species + '"' | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1054 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1055 regsites_df = regsites_df[regsites_df.ORGANISM == species] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1056 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1057 # merge the seq7 df with the regsites df based off of the sequence7 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1058 merge_df = seq7_df.merge( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1059 regsites_df, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1060 left_on=SEQUENCE7, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1061 right_on=SITE_PLUSMINUS_7AA_SQL, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1062 how="left", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1063 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1064 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1065 # after merging df, select only the columns of interest; | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1066 # note that PROTEIN is absent here | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1067 merge_df = merge_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1068 [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1069 PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1070 SEQUENCE7, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1071 ON_FUNCTION, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1072 ON_PROCESS, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1073 ON_PROT_INTERACT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1074 ON_OTHER_INTERACT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1075 ON_NOTES, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1076 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1077 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1078 # combine column values of interest | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1079 # into one FUNCTION_PHOSPHORESIDUE column" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1080 merge_df[FUNCTION_PHOSPHORESIDUE] = merge_df[ON_FUNCTION].str.cat( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1081 merge_df[ON_PROCESS], sep="; ", na_rep="" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1082 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1083 merge_df[FUNCTION_PHOSPHORESIDUE] = merge_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1084 FUNCTION_PHOSPHORESIDUE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1085 ].str.cat(merge_df[ON_PROT_INTERACT], sep="; ", na_rep="") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1086 merge_df[FUNCTION_PHOSPHORESIDUE] = merge_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1087 FUNCTION_PHOSPHORESIDUE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1088 ].str.cat(merge_df[ON_OTHER_INTERACT], sep="; ", na_rep="") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1089 merge_df[FUNCTION_PHOSPHORESIDUE] = merge_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1090 FUNCTION_PHOSPHORESIDUE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1091 ].str.cat(merge_df[ON_NOTES], sep="; ", na_rep="") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1092 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1093 # remove the columns that were combined | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1094 merge_df = merge_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1095 [PHOSPHOPEPTIDE, SEQUENCE7, FUNCTION_PHOSPHORESIDUE] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1096 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1097 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1098 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1099 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1100 "%0.6f merge regsite metadata [1a]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1101 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1102 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1103 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1104 # cosmetic changes to Function Phosphoresidue column | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1105 fp_series = pandas.Series(merge_df[FUNCTION_PHOSPHORESIDUE]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1106 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1107 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1108 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1109 "%0.6f more cosmetic changes [1b]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1110 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1111 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1112 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1113 i = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1114 while i < len(fp_series): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1115 # remove the extra ";" so that it looks more professional | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1116 if fp_series[i] == "; ; ; ; ": # remove ; from empty hits | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1117 fp_series[i] = "" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1118 while fp_series[i].endswith("; "): # remove ; from the ends | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1119 fp_series[i] = fp_series[i][:-2] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1120 while fp_series[i].startswith("; "): # remove ; from the beginning | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1121 fp_series[i] = fp_series[i][2:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1122 fp_series[i] = fp_series[i].replace("; ; ; ; ", "; ") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1123 fp_series[i] = fp_series[i].replace("; ; ; ", "; ") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1124 fp_series[i] = fp_series[i].replace("; ; ", "; ") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1125 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1126 # turn blanks into N_A to signify the info | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1127 # that was searched for but cannot be found | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1128 if fp_series[i] == "": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1129 fp_series[i] = N_A | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1130 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1131 i += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1132 merge_df[FUNCTION_PHOSPHORESIDUE] = fp_series | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1133 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1134 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1135 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1136 "%0.6f cleaned up semicolons [1c]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1137 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1138 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1139 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1140 # merge uniprot df with merge df | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1141 uniprot_regsites_merged_df = uniprot_df.merge( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1142 merge_df, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1143 left_on=PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1144 right_on=PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1145 how="left", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1146 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1147 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1148 # collapse the merged df | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1149 uniprot_regsites_collapsed_df = pandas.DataFrame( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1150 uniprot_regsites_merged_df.groupby(PHOSPHOPEPTIDE)[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1151 FUNCTION_PHOSPHORESIDUE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1152 ].apply(lambda x: ppep_join(x)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1153 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1154 # .apply(lambda x: "%s" % ' | '.join(x))) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1155 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1156 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1157 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1158 "%0.6f collapsed pandas dataframe [1d]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1159 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1160 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1161 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1162 uniprot_regsites_collapsed_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1163 PHOSPHOPEPTIDE | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1164 ] = ( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1165 uniprot_regsites_collapsed_df.index | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1166 ) # add df index as its own column | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1167 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1168 # rename columns | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1169 uniprot_regsites_collapsed_df.columns = [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1170 FUNCTION_PHOSPHORESIDUE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1171 "ppp", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1172 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1173 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1174 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1175 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1176 "%0.6f selected columns to be merged to uniprot_df [1e]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1177 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1178 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1179 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1180 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1181 # add columns based on Sequence7 matching site_+/-7_AA | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1182 uniprot_regsite_df = pandas.merge( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1183 left=uniprot_df, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1184 right=uniprot_regsites_collapsed_df, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1185 how="left", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1186 left_on=PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1187 right_on="ppp", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1188 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1189 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1190 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1191 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1192 "%0.6f added columns based on Sequence7 matching site_+/-7_AA [1f]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1193 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1194 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1195 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1196 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1197 data_in.rename( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1198 {"Protein description": PHOSPHOPEPTIDE}, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1199 axis="columns", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1200 inplace=True, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1201 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1202 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1203 res2 = sorted( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1204 data_in[PHOSPHOPEPTIDE_MATCH].tolist(), key=lambda s: s.casefold() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1205 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1206 data_in = data_in.loc[res2] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1207 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1208 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1209 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1210 "%0.6f sorting time [1f]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1211 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1212 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1213 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1214 print("old_cols[:col_PKCalpha]") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1215 print(old_cols[:col_PKCalpha]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1216 cols = [old_cols[0]] + old_cols[col_PKCalpha - 1:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1217 upstream_data = upstream_data[cols] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1218 print("upstream_data.columns") | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1219 print(upstream_data.columns) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1220 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1221 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1222 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1223 "%0.6f refactored columns for Upstream Map [1g]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1224 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1225 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1226 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1227 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1228 # rename upstream columns in new list | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1229 def col_rename(name): | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1230 if "_NetworKIN" in name: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1231 name = name.split("_")[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1232 if " motif" in name: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1233 name = name.split(" motif")[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1234 if " sequence " in name: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1235 name = name.split(" sequence")[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1236 if "_Phosida" in name: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1237 name = name.split("_")[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1238 if "_PhosphoSite" in name: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1239 name = name.split("_")[0] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1240 return name | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1241 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1242 new_cols = [col_rename(col) for col in cols] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1243 upstream_data.columns = new_cols | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1244 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1245 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1246 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1247 "%0.6f renamed columns for Upstream Map [1h_1]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1248 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1249 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1250 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1251 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1252 # Create upstream_data_cast as a copy of upstream_data | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1253 # but with first column substituted by the phosphopeptide sequence | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1254 upstream_data_cast = upstream_data.copy() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1255 new_cols_cast = new_cols | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1256 new_cols_cast[0] = "p_peptide" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1257 upstream_data_cast.columns = new_cols_cast | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1258 upstream_data_cast["p_peptide"] = upstream_data.index | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1259 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1260 # Get melted kinase mapping data from SQLite database | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1261 # --- begin read upstream_data_melt --------------------------------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1262 conn = sql.connect(uniprot_sqlite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1263 upstream_data_melt_df = pandas.read_sql_query(PPEP_MELT_SQL, conn) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1264 # Close SwissProt SQLite database | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1265 conn.close() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1266 upstream_data_melt = upstream_data_melt_df.copy() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1267 upstream_data_melt.columns = ["p_peptide", "characterization", "X"] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1268 upstream_data_melt["characterization"] = [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1269 col_rename(s) for s in upstream_data_melt["characterization"] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1270 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1271 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1272 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1273 "%0.6f upstream_data_melt_df initially has %d rows" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1274 % (end_time - start_time, len(upstream_data_melt.axes[0])), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1275 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1276 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1277 # ref: https://stackoverflow.com/a/27360130/15509512 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1278 # e.g. df.drop(df[df.score < 50].index, inplace=True) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1279 upstream_data_melt.drop( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1280 upstream_data_melt[upstream_data_melt.X != "X"].index, inplace=True | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1281 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1282 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1283 "%0.6f upstream_data_melt_df pre-dedup has %d rows" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1284 % (end_time - start_time, len(upstream_data_melt.axes[0])), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1285 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1286 ) | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1287 # ... end read upstream_data_melt --------------------------------- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1288 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1289 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1290 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1291 "%0.6f melted and minimized Upstream Map dataframe [1h_2]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1292 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1293 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1294 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1295 # ... end read upstream_data_melt | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1296 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1297 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1298 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1299 "%0.6f indexed melted Upstream Map [1h_2a]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1300 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1301 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1302 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1303 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1304 upstream_delta_melt_LoL = upstream_data_melt.values.tolist() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1305 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1306 melt_dict = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1307 for key in upstream_map_p_peptide_list: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1308 melt_dict[key] = [] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1309 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1310 for el in upstream_delta_melt_LoL: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1311 (p_peptide, characterization, X) = tuple(el) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1312 if p_peptide in melt_dict: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1313 melt_dict[p_peptide].append(characterization) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1314 else: | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1315 los = [ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1316 "Phosphopeptide %s" % p_peptide, | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1317 "not found in ppep_mapping_db:", | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1318 '"phopsphopeptides" and "ppep_mapping_db" must both', | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1319 "originate from the same run of mqppep_kinase_mapping" | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1320 ] | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1321 exit(" ".join(los)) | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1322 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1323 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1324 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1325 "%0.6f appended peptide characterizations [1h_2b]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1326 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1327 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1328 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1329 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1330 # for key in upstream_map_p_peptide_list: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1331 # melt_dict[key] = ' | '.join(melt_dict[key]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1332 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1333 for key in upstream_map_p_peptide_list: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1334 melt_dict[key] = melt_join(melt_dict[key]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1335 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1336 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1337 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1338 "%0.6f concatenated multiple characterizations [1h_2c]" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1339 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1340 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1341 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1342 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1343 # map_dict is a dictionary of dictionaries | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1344 map_dict = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1345 for key in upstream_map_p_peptide_list: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1346 map_dict[key] = {} | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1347 map_dict[key][PUTATIVE_UPSTREAM_DOMAINS] = melt_dict[key] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1348 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1349 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1350 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1351 "%0.6f instantiated map dictionary [2]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1352 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1353 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1354 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1355 # convert map_dict to dataframe | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1356 map_df = pandas.DataFrame.transpose( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1357 pandas.DataFrame.from_dict(map_dict) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1358 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1359 map_df["p-peptide"] = map_df.index # make index a column too | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1360 cols_map_df = map_df.columns.tolist() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1361 cols_map_df = [cols_map_df[1]] + [cols_map_df[0]] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1362 map_df = map_df[cols_map_df] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1363 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1364 # join map_df to uniprot_regsite_df | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1365 output_df = uniprot_regsite_df.merge( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1366 map_df, how="left", left_on=PHOSPHOPEPTIDE, right_on="p-peptide" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1367 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1368 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1369 output_df = output_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1370 [ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1371 PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1372 SEQUENCE10, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1373 SEQUENCE7, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1374 GENE_NAME, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1375 PHOSPHORESIDUE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1376 UNIPROT_ID, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1377 DESCRIPTION, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1378 FUNCTION_PHOSPHORESIDUE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1379 PUTATIVE_UPSTREAM_DOMAINS, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1380 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1381 ] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1382 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1383 # join output_df back to quantitative columns in data_in df | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1384 quant_cols = data_in.columns.tolist() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1385 quant_cols = quant_cols[1:] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1386 quant_data = data_in[quant_cols] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1387 | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1388 # ---- Write merge/filter metadata to SQLite database (start) ---- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1389 # Open SwissProt SQLite database | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1390 conn = sql.connect(output_sqlite) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1391 cur = conn.cursor() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1392 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1393 cur.executescript(MRGFLTR_DDL) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1394 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1395 cur.execute( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1396 CITATION_INSERT_STMT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1397 ("mrgfltr_metadata_view", CITATION_INSERT_PSP), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1398 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1399 cur.execute( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1400 CITATION_INSERT_STMT, ("mrgfltr_metadata", CITATION_INSERT_PSP) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1401 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1402 cur.execute( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1403 CITATION_INSERT_STMT, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1404 ("mrgfltr_metadata_view", CITATION_INSERT_PSP_REF), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1405 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1406 cur.execute( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1407 CITATION_INSERT_STMT, ("mrgfltr_metadata", CITATION_INSERT_PSP_REF) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1408 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1409 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1410 # Read ppep-to-sequence LUT | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1411 ppep_lut_df = pandas.read_sql_query(PPEP_ID_SQL, conn) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1412 # write only metadata for merged/filtered records to SQLite | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1413 mrgfltr_metadata_df = output_df.copy() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1414 # replace phosphopeptide seq with ppep.id | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1415 mrgfltr_metadata_df = ppep_lut_df.merge( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1416 mrgfltr_metadata_df, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1417 left_on="ppep_seq", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1418 right_on=PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1419 how="inner", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1420 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1421 mrgfltr_metadata_df.drop( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1422 columns=[PHOSPHOPEPTIDE, "ppep_seq"], inplace=True | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1423 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1424 # rename columns | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1425 mrgfltr_metadata_df.columns = MRGFLTR_METADATA_COLUMNS | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1426 mrgfltr_metadata_df.to_sql( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1427 "mrgfltr_metadata", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1428 con=conn, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1429 if_exists="append", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1430 index=False, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1431 method="multi", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1432 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1433 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1434 # Close SwissProt SQLite database | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1435 conn.close() | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1436 # ---- Write merge/filter metadata to SQLite database (finish) ---- | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1437 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1438 output_df = output_df.merge( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1439 quant_data, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1440 how="right", | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1441 left_on=PHOSPHOPEPTIDE, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1442 right_on=PHOSPHOPEPTIDE_MATCH, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1443 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1444 output_cols = output_df.columns.tolist() | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1445 output_cols = output_cols[:-1] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1446 output_df = output_df[output_cols] | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1447 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1448 # cosmetic changes to Upstream column | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1449 # fill the NaN with "" for those Phosphopeptides that got a | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1450 # "WARNING: Failed match for " in the upstream mapping | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1451 output_df[PUTATIVE_UPSTREAM_DOMAINS] = output_df[ | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1452 PUTATIVE_UPSTREAM_DOMAINS | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1453 ].fillna( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1454 "" | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1455 ) | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1456 us_series = pandas.Series(output_df[PUTATIVE_UPSTREAM_DOMAINS]) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1457 i = 0 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1458 while i < len(us_series): | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1459 # turn blanks into N_A to signify the info | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1460 # that was searched for but cannot be found | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1461 if us_series[i] == "": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1462 us_series[i] = N_A | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1463 i += 1 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1464 output_df[PUTATIVE_UPSTREAM_DOMAINS] = us_series | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1465 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1466 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1467 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1468 "%0.6f establisheed output [3]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1469 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1470 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1471 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1472 (output_rows, output_cols) = output_df.shape | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1473 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1474 output_df = output_df.convert_dtypes(convert_integer=True) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1475 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1476 # Output onto Final CSV file | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1477 output_df.to_csv(output_filename_csv, index=False) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1478 output_df.to_csv( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1479 output_filename_tab, quoting=None, sep="\t", index=False | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1480 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1481 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1482 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1483 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1484 "%0.6f wrote output [4]" % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1485 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1486 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1487 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1488 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1489 "{:>10} phosphopeptides written to output".format(str(output_rows)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1490 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1491 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1492 end_time = time.process_time() # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1493 print( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1494 "%0.6f seconds of non-system CPU time were consumed" | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1495 % (end_time - start_time,), | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1496 file=sys.stderr, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1497 ) # timer | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1498 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1499 # Rev. 7/1/2016 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1500 # Rev. 7/3/2016 : fill NaN in Upstream column to replace to N/A's | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1501 # Rev. 7/3/2016: renamed Upstream column to PUTATIVE_UPSTREAM_DOMAINS | 
| 1 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1502 # Rev. 12/2/2021: Converted to Python from ipynb; use fast \ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1503 # Aho-Corasick searching; \ | 
| 
2276e88d5a1f
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
 galaxyp parents: 
0diff
changeset | 1504 # read from SwissProt SQLite database | 
| 0 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1505 # Rev. 12/9/2021: Transfer code to Galaxy tool wrapper | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1506 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1507 # | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1508 # copied from Excel Output Script.ipynb END # | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1509 # | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1510 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1511 try: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1512 catch( | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1513 mqpep_getswissprot, | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1514 ) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1515 exit(0) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1516 except Exception as e: | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1517 exit("Internal error running mqpep_getswissprot(): %s" % (e)) | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1518 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1519 | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1520 if __name__ == "__main__": | 
| 
d9b68bedbc91
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
 galaxyp parents: diff
changeset | 1521 __main__() | 
