Mercurial > repos > dchristiany > data_manager_proteore
comparison data_manager/resource_building.py @ 43:3febf3d1139a draft
planemo upload commit 9b701c1faf8be4835b4e7236780ee9ee26f9a373-dirty
author | dchristiany |
---|---|
date | Thu, 31 Jan 2019 08:40:52 -0500 |
parents | 5a37a086c9a8 |
children | 80fc0b28e227 |
comparison
equal
deleted
inserted
replaced
42:5a37a086c9a8 | 43:3febf3d1139a |
---|---|
57 | 57 |
58 | 58 |
59 ####################################################################################################### | 59 ####################################################################################################### |
60 # 2. Peptide Atlas | 60 # 2. Peptide Atlas |
61 ####################################################################################################### | 61 ####################################################################################################### |
62 def peptide_atlas_sources(data_manager_dict, tissue, target_directory): | 62 def peptide_atlas_sources(data_manager_dict, tissue, date, target_directory): |
63 # Define organism_id (here Human) - to be upraded when other organism added to the project | 63 # Define organism_id (here Human) - to be upraded when other organism added to the project |
64 organism_id = "2" | 64 organism_id = "2" |
65 # Extract sample_category_id and output filename | 65 # Extract sample_category_id and output filename |
66 tissue=tissue.split(".") | 66 tissue=tissue.split(".") |
67 sample_category_id = tissue[0] | 67 sample_category_id = tissue[0] |
68 tissue_name = tissue[1] | 68 tissue_name = tissue[1] |
69 output_file = tissue_name+"_"+time.strftime("%d-%m-%Y") + ".tsv" | 69 output_file = tissue_name+"_"+date + ".tsv" |
70 | 70 |
71 query="https://db.systemsbiology.net/sbeams/cgi/PeptideAtlas/GetProteins?&atlas_build_id="+ \ | 71 query="https://db.systemsbiology.net/sbeams/cgi/PeptideAtlas/GetProteins?&atlas_build_id="+ \ |
72 sample_category_id+"&display_options=ShowAbundances&organism_id="+organism_id+ \ | 72 sample_category_id+"&display_options=ShowAbundances&organism_id="+organism_id+ \ |
73 "&redundancy_constraint=4&presence_level_constraint=1%2C2&gene_annotation_level_constraint=leaf\ | 73 "&redundancy_constraint=4&presence_level_constraint=1%2C2&gene_annotation_level_constraint=leaf\ |
74 &QUERY_NAME=AT_GetProteins&action=QUERY&output_mode=tsv&apply_action=QUERY" | 74 &QUERY_NAME=AT_GetProteins&action=QUERY&output_mode=tsv&apply_action=QUERY" |
79 cr = csv.reader(decoded_content.splitlines(), delimiter='\t') | 79 cr = csv.reader(decoded_content.splitlines(), delimiter='\t') |
80 | 80 |
81 uni_dict = build_dictionary(cr) | 81 uni_dict = build_dictionary(cr) |
82 | 82 |
83 #columns of data table peptide_atlas | 83 #columns of data table peptide_atlas |
84 date = time.strftime("%d-%m-%Y") | |
85 tissue_id = tissue_name+"_"+date | 84 tissue_id = tissue_name+"_"+date |
86 name = tissue_id.replace("-","/").replace("_"," ") | 85 name = tissue_id.replace("-","/").replace("_"," ") |
87 path = os.path.join(target_directory,output_file) | 86 path = os.path.join(target_directory,output_file) |
88 | 87 |
89 with open(path,"w") as out : | 88 with open(path,"w") as out : |
416 parser.add_argument("--hpa", metavar = ("HPA_OPTION")) | 415 parser.add_argument("--hpa", metavar = ("HPA_OPTION")) |
417 parser.add_argument("--peptideatlas", metavar=("SAMPLE_CATEGORY_ID")) | 416 parser.add_argument("--peptideatlas", metavar=("SAMPLE_CATEGORY_ID")) |
418 parser.add_argument("--id_mapping", metavar = ("ID_MAPPING_SPECIES")) | 417 parser.add_argument("--id_mapping", metavar = ("ID_MAPPING_SPECIES")) |
419 parser.add_argument("--interactome", metavar = ("PPI")) | 418 parser.add_argument("--interactome", metavar = ("PPI")) |
420 parser.add_argument("--species") | 419 parser.add_argument("--species") |
420 parser.add_argument("--date") | |
421 parser.add_argument("-o", "--output") | 421 parser.add_argument("-o", "--output") |
422 args = parser.parse_args() | 422 args = parser.parse_args() |
423 | 423 |
424 data_manager_dict = {} | 424 data_manager_dict = {} |
425 # Extract json file params | 425 # Extract json file params |
440 HPA_sources(data_manager_dict, hpa_tissue, target_directory) | 440 HPA_sources(data_manager_dict, hpa_tissue, target_directory) |
441 | 441 |
442 ## Download source file from Peptide Atlas query | 442 ## Download source file from Peptide Atlas query |
443 try: | 443 try: |
444 peptide_atlas = args.peptideatlas | 444 peptide_atlas = args.peptideatlas |
445 date = args.date | |
445 except NameError: | 446 except NameError: |
446 peptide_atlas = None | 447 peptide_atlas = None |
447 if peptide_atlas is not None: | 448 if peptide_atlas is not None: |
448 #target_directory = "/projet/galaxydev/galaxy/tools/proteore/ProteoRE/tools/resources_building/test-data/" | 449 #target_directory = "/projet/galaxydev/galaxy/tools/proteore/ProteoRE/tools/resources_building/test-data/" |
449 peptide_atlas = peptide_atlas.split(",") | 450 peptide_atlas = peptide_atlas.split(",") |
450 for pa_tissue in peptide_atlas: | 451 for pa_tissue in peptide_atlas: |
451 peptide_atlas_sources(data_manager_dict, pa_tissue, target_directory) | 452 peptide_atlas_sources(data_manager_dict, pa_tissue, date, target_directory) |
452 | 453 |
453 ## Download ID_mapping source file from Uniprot | 454 ## Download ID_mapping source file from Uniprot |
454 try: | 455 try: |
455 id_mapping=args.id_mapping | 456 id_mapping=args.id_mapping |
456 except NameError: | 457 except NameError: |