Mercurial > repos > dchristiany > data_manager_proteore
comparison data_manager/resource_building.py @ 29:871a7347ca24 draft
planemo upload commit c89c5deac442c0c2aa52b24f2c5af4b290773fc0-dirty
| author | dchristiany |
|---|---|
| date | Mon, 28 Jan 2019 05:16:55 -0500 |
| parents | d235909789ca |
| children | b8271b9a1049 |
comparison
equal
deleted
inserted
replaced
| 28:d235909789ca | 29:871a7347ca24 |
|---|---|
| 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, target_directory): |
| 63 # Define PA Human build released number (here early 2018) | |
| 64 atlas_build_id = "472" | |
| 65 # 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 |
| 66 organism_id = "2" | 64 organism_id = "2" |
| 67 # Extract sample_category_id and output filename | 65 # Extract sample_category_id and output filename |
| 68 sample_category_id = tissue.split("-")[0] | 66 tissue=tissue.split(".") |
| 69 output_file = tissue.split("-")[1] +"_"+ time.strftime("%d-%m-%Y") + ".tsv" | 67 sample_category_id = tissue[0] |
| 70 query = "https://db.systemsbiology.net/sbeams/cgi/PeptideAtlas/GetPeptides?atlas_build_id=" + \ | 68 name = tissue[1] |
| 71 atlas_build_id + "&display_options=ShowMappings&organism_id= " + \ | 69 output_file = name+"_"+time.strftime("%d-%m-%Y") + ".tsv" |
| 72 organism_id + "&sample_category_id=" + sample_category_id + \ | 70 query="https://db.systemsbiology.net/sbeams/cgi/PeptideAtlas/GetProteins?&atlas_build_id="+sample_category_id+ \ |
| 73 "&QUERY_NAME=AT_GetPeptides&output_mode=tsv&apply_action=QUERY" | 71 "&display_options=ShowAbundances&organism_id="+organism_id+"&redundancy_constraint=4&presence_level_constraint=1%2C2"+ \ |
| 72 "&gene_annotation_level_constraint=leaf&QUERY_NAME=AT_GetProteins&action=QUERY&output_mode=tsv&apply_action=QUERY" | |
| 74 download = requests.get(query) | 73 download = requests.get(query) |
| 75 decoded_content = download.content.decode('utf-8') | 74 decoded_content = download.content.decode('utf-8') |
| 76 cr = csv.reader(decoded_content.splitlines(), delimiter='\t') | 75 cr = csv.reader(decoded_content.splitlines(), delimiter='\t') |
| 77 | 76 |
| 78 #build dictionary by only keeping uniprot accession (not isoform) as key and sum of observations as value | 77 #build dictionary by only keeping uniprot accession (not isoform) as key and sum of observations as value |
