def analyse(uniprot): print('***************** ANALYSIS *******************************') p = ProteinAnalyser(taxid='9606', uniprot=uniprot).load() p.mutation = f'{p.sequence[65]}66W' p.predict_effect() p.analyse_structure() print(p) import json json.dump(p.asdict(), open('test.json', 'w'))
def test_ProteinAnalyser(): p = ProteinAnalyser(uniprot='Q86V25').load() print(p) p.mutation = Mutation('p.N127W') p.analyse_structure() print(p.get_features_near_position()) print(p.get_gnomAD_near_position()) print(p.model.get_structure_neighbours()) print(p.get_superficiality())
def protein_step(self): """ Check mutations are valid """ self.start_timer() if self.has(): # this is already done (very unlikely/ protein = system_storage[self.handle] else: log.info( f'Step 1 analysis requested by {User.get_username(self.request)}' ) uniprot = self.request.params['uniprot'] taxid = self.request.params['species'] mutation_text = self.request.params['mutation'] ## Do analysis mutation = Mutation(mutation_text) protein = ProteinAnalyser(uniprot=uniprot, taxid=taxid) protein.load() protein.mutation = mutation # assess if not protein.check_mutation(): log.info('protein mutation discrepancy error') discrepancy = protein.mutation_discrepancy() self.reply = { **self.reply, 'error': 'mutation', 'msg': discrepancy, 'status': 'error' } raise VenusException(discrepancy) else: system_storage[self.handle] = protein self.reply['protein'] = self.jsonable(protein) self.stop_timer()
def protein_step(): uniprot = request.params['uniprot'] taxid = request.params['species'] mutation = Mutation(request.params['mutation']) protein = ProteinAnalyser(uniprot=uniprot, taxid=taxid) try: protein.load() except FutureWarning: log.error( f'There was no pickle for uniprot {uniprot} taxid {taxid}. TREMBL code via API?' ) #protein.__dict__ = ProteinGatherer(uniprot=uniprot, taxid=taxid).get_uniprot().__dict__ protein.mutation = mutation if not protein.check_mutation(): log.info('protein mutation discrepancy error') return { 'error': 'mutation', 'msg': protein.mutation_discrepancy(), 'status': 'error' } else: handle = request.params['uniprot'] + request.params['mutation'] system_storage[handle] = protein return {'protein': jsonable(protein), 'status': 'success'}
def load_protein(self) -> ProteinAnalyser: protein = ProteinAnalyser(uniprot=self.uniprot, taxid=self.taxid) protein.load() # self.reply['protein'] = self.jsonable(protein) return protein
print([m for m in p.gnomAD if m.homozygous]) print(' '.join([str(m.description.split()[0]) for m in p.gnomAD]) + ')') print([m for m in p.gnomAD if m.homozygous]) elif 1 == 0: iterate_taxon('9606') #.retrieve_references(ask=False, refresh=False) #UniprotMasterReader() #global_settings.startup() #make_pdb_dex() #split_gnomAD.gnomAD().write() #iterate_taxon('9606') p = ProteinAnalyser(taxid='9606', uniprot='Q9BZ29').load() p.mutation = 'P23W' print('check_mutation', p.check_mutation()) print('mutation_discrepancy', p.mutation_discrepancy()) print('predict_effect', p.predict_effect()) print('elmdata', p.elmdata) print(p.mutation) # fetch_binders is too slow. Pre-split the data like for gnomAD. elif 1 == 0: print('retrieving...') global_settings.retrieve_references(ask=False, refresh=False) else: ## dock 9 ops. #test_ProteinAnalyser() p = ProteinGatherer(uniprot='Q96N67').load() p.parse_gnomAD()
pymol.cmd.remove('chain A') pymol.cmd.save('GNB2_alone.pdb') native_alone = pyrosetta.rosetta.core.pose.Pose() pyrosetta.rosetta.core.import_pose.pose_from_file(native_alone, 'GNB2_alone.pdb') relax(native_alone, 15) native_alone.dump_pdb('GNB2_alone.r.pdb') ################### phosphorylated ###################################### from Bio.SeqUtils import seq3 from michelanglo_protein import ProteinAnalyser, global_settings global_settings.startup( data_folder='/home/matteo/Coding/Michelanglo/protein-data') p = ProteinAnalyser(taxid=9606, uniprot='P62879').load() native_phospho = pyrosetta.rosetta.core.pose.Pose() pyrosetta.rosetta.core.import_pose.pose_from_file(native_phospho, 'GNB2_alone.pdb') MutateResidue = pyrosetta.rosetta.protocols.simple_moves.MutateResidue # KinaseMover = pyrosetta.rosetta.protocols.enzymatic_movers.KinaseMover add_variant_type_to_residue = pyrosetta.rosetta.core.pose.add_variant_type_to_residue pose2pdb = native_phospho.pdb_info().pdb2pose for record in p.features['PSP_modified_residues']: change = record['from_residue'] + '-' + record['ptm'] if record['ptm'] == 'ub': continue elif record['ptm'] == 'p': patch = 'phosphorylated'