Mercurial > repos > proteore > proteore_data_manager
comparison data_manager/resource_building.py @ 36:b18cb0d11971 draft
"planemo upload commit ba867b8fa3352695fbda1ae764407f363ee79a50-dirty"
| author | proteore |
|---|---|
| date | Wed, 08 Jan 2020 10:34:07 +0000 |
| parents | 06103d45814d |
| children | 807ecb8c3867 |
comparison
equal
deleted
inserted
replaced
| 35:06103d45814d | 36:b18cb0d11971 |
|---|---|
| 134 def id_mapping_sources (data_manager_dict, species, target_directory, tool_data_path) : | 134 def id_mapping_sources (data_manager_dict, species, target_directory, tool_data_path) : |
| 135 | 135 |
| 136 human = species == "Human" | 136 human = species == "Human" |
| 137 species_dict = { "Human" : "HUMAN_9606", "Mouse" : "MOUSE_10090", "Rat" : "RAT_10116" } | 137 species_dict = { "Human" : "HUMAN_9606", "Mouse" : "MOUSE_10090", "Rat" : "RAT_10116" } |
| 138 files=["idmapping_selected.tab.gz","idmapping.dat.gz"] | 138 files=["idmapping_selected.tab.gz","idmapping.dat.gz"] |
| 139 archive = os.path.join(tool_data_path, "ID_mapping_archive_"+species+"_"+str(time.strftime("%Y%m%d"))) | 139 archive = os.path.join(tool_data_path, "id_mapping/ID_mapping_archive_"+species+"_"+str(time.strftime("%Y%m%d"))) |
| 140 if os.path.isfile is False : os.mkdir(archive) | 140 if os.path.isfile is False : os.mkdir(archive) |
| 141 | 141 |
| 142 #header | 142 #header |
| 143 if human : tab = [["UniProt-AC","UniProt-AC_reviewed","UniProt-ID","GeneID","RefSeq","GI","PDB","GO","PIR","MIM","UniGene","Ensembl_Gene","Ensembl_Transcript","Ensembl_Protein","neXtProt","BioGrid","STRING","KEGG",'Gene_Name']] | 143 if human : tab = [["UniProt-AC","UniProt-AC_reviewed","UniProt-ID","GeneID","RefSeq","GI","PDB","GO","PIR","MIM","UniGene","Ensembl_Gene","Ensembl_Transcript","Ensembl_Protein","neXtProt","BioGrid","STRING","KEGG",'Gene_Name']] |
| 144 else : tab = [["UniProt-AC","UniProt-AC_reviewed","UniProt-ID","GeneID","RefSeq","GI","PDB","GO","PIR","MIM","UniGene","Ensembl_Gene","Ensembl_Transcript","Ensembl_Protein","BioGrid","STRING","KEGG",'Gene_Name']] | 144 else : tab = [["UniProt-AC","UniProt-AC_reviewed","UniProt-ID","GeneID","RefSeq","GI","PDB","GO","PIR","MIM","UniGene","Ensembl_Gene","Ensembl_Transcript","Ensembl_Protein","BioGrid","STRING","KEGG",'Gene_Name']] |
| 250 | 250 |
| 251 with open(path,"w") as out : | 251 with open(path,"w") as out : |
| 252 w = csv.writer(out,delimiter='\t') | 252 w = csv.writer(out,delimiter='\t') |
| 253 w.writerows(tab) | 253 w.writerows(tab) |
| 254 | 254 |
| 255 subprocess.call(['tar', '-zczf', archive+".tar.gz", archive]) | 255 subprocess.call(['tar', '-czvf', archive+".tar.gz", archive]) |
| 256 os.remove(archive) | |
| 256 | 257 |
| 257 name_dict={"Human" : "Homo sapiens", "Mouse" : "Mus musculus", "Rat" : "Rattus norvegicus"} | 258 name_dict={"Human" : "Homo sapiens", "Mouse" : "Mus musculus", "Rat" : "Rattus norvegicus"} |
| 258 name = species +" (" + name_dict[species]+" "+time.strftime("%d/%m/%Y")+")" | 259 name = species +" (" + name_dict[species]+" "+time.strftime("%d/%m/%Y")+")" |
| 259 release = species+"_id_mapping_"+ time.strftime("%d-%m-%Y") | 260 release = species+"_id_mapping_"+ time.strftime("%d-%m-%Y") |
| 260 id = str(10000000000 - int(time.strftime("%Y%m%d"))) #new ids must be inferior to previous id -> sort by <filter> in xml only in descending order | 261 id = str(10000000000 - int(time.strftime("%Y%m%d"))) #new ids must be inferior to previous id -> sort by <filter> in xml only in descending order |
