根据数据配置信息运用非集成函数处理数据

根据数据配置信息 (data configure)运用非集成函数nonensembled_map_fns处理蛋白质tensor dict。nonensembled_map_fns处理函数: correct_msa_restypes,add_distillation_flag,cast_64bit_ints,squeeze_features,randomly_replace_msa_with_unknown,
make_seq_mask,make_msa_mask,make_hhblits_profile,make_random_crop_to_size_seed,fix_templates_aatype,make_template_mask,make_pseudo_beta,make_atom14_masks

import copy
import tensorflow.compat.v1 as tf
import pickle
import numpy as np
import ml_collectionsNUM_RES = 'num residues placeholder'
NUM_MSA_SEQ = 'msa placeholder'
NUM_EXTRA_SEQ = 'extra msa placeholder'
NUM_TEMPLATES = 'num templates placeholder'CONFIG = ml_collections.ConfigDict({'data': {'common': {'masked_msa': {'profile_prob': 0.1,'same_prob': 0.1,'uniform_prob': 0.1},'max_extra_msa': 1024,'msa_cluster_features': True,'num_recycle': 3,'reduce_msa_clusters_by_max_templates': False,'resample_msa_in_recycling': True,'template_features': ['template_all_atom_positions', 'template_sum_probs','template_aatype', 'template_all_atom_masks','template_domain_names'],'unsupervised_features': ['aatype', 'residue_index', 'sequence', 'msa', 'domain_name','num_alignments', 'seq_length', 'between_segment_residues','deletion_matrix'],'use_templates': False,},'eval': {'feat': {'aatype': [NUM_RES],'all_atom_mask': [NUM_RES, None],'all_atom_positions': [NUM_RES, None, None],'alt_chi_angles': [NUM_RES, None],'atom14_alt_gt_exists': [NUM_RES, None],'atom14_alt_gt_positions': [NUM_RES, None, None],'atom14_atom_exists': [NUM_RES, None],'atom14_atom_is_ambiguous': [NUM_RES, None],'atom14_gt_exists': [NUM_RES, None],'atom14_gt_positions': [NUM_RES, None, None],'atom37_atom_exists': [NUM_RES, None],'backbone_affine_mask': [NUM_RES],'backbone_affine_tensor': [NUM_RES, None],'bert_mask': [NUM_MSA_SEQ, NUM_RES],'chi_angles': [NUM_RES, None],'chi_mask': [NUM_RES, None],'extra_deletion_value': [NUM_EXTRA_SEQ, NUM_RES],'extra_has_deletion': [NUM_EXTRA_SEQ, NUM_RES],'extra_msa': [NUM_EXTRA_SEQ, NUM_RES],'extra_msa_mask': [NUM_EXTRA_SEQ, NUM_RES],'extra_msa_row_mask': [NUM_EXTRA_SEQ],'is_distillation': [],'msa_feat': [NUM_MSA_SEQ, NUM_RES, None],'msa_mask': [NUM_MSA_SEQ, NUM_RES],'msa_row_mask': [NUM_MSA_SEQ],'pseudo_beta': [NUM_RES, None],'pseudo_beta_mask': [NUM_RES],'random_crop_to_size_seed': [None],'residue_index': [NUM_RES],'residx_atom14_to_atom37': [NUM_RES, None],'residx_atom37_to_atom14': [NUM_RES, None],'resolution': [],'rigidgroups_alt_gt_frames': [NUM_RES, None, None],'rigidgroups_group_exists': [NUM_RES, None],'rigidgroups_group_is_ambiguous': [NUM_RES, None],'rigidgroups_gt_exists': [NUM_RES, None],'rigidgroups_gt_frames': [NUM_RES, None, None],'seq_length': [],'seq_mask': [NUM_RES],'target_feat': [NUM_RES, None],'template_aatype': [NUM_TEMPLATES, NUM_RES],'template_all_atom_masks': [NUM_TEMPLATES, NUM_RES, None],'template_all_atom_positions': [NUM_TEMPLATES, NUM_RES, None, None],'template_backbone_affine_mask': [NUM_TEMPLATES, NUM_RES],'template_backbone_affine_tensor': [NUM_TEMPLATES, NUM_RES, None],'template_mask': [NUM_TEMPLATES],'template_pseudo_beta': [NUM_TEMPLATES, NUM_RES, None],'template_pseudo_beta_mask': [NUM_TEMPLATES, NUM_RES],'template_sum_probs': [NUM_TEMPLATES, None],'true_msa': [NUM_MSA_SEQ, NUM_RES]},'fixed_size': True,'subsample_templates': False,  # We want top templates.'masked_msa_replace_fraction': 0.15,'max_msa_clusters': 512,'max_templates': 4,'num_ensemble': 1,},},'model': {'embeddings_and_evoformer': {'evoformer_num_block': 48,'evoformer': {'msa_row_attention_with_pair_bias': {'dropout_rate': 0.15,'gating': True,'num_head': 8,'orientation': 'per_row','shared_dropout': True},'msa_column_attention': {'dropout_rate': 0.0,'gating': True,'num_head': 8,'orientation': 'per_column','shared_dropout': True},'msa_transition': {'dropout_rate': 0.0,'num_intermediate_factor': 4,'orientation': 'per_row','shared_dropout': True},'outer_product_mean': {'first': False,'chunk_size': 128,'dropout_rate': 0.0,'num_outer_channel': 32,'orientation': 'per_row','shared_dropout': True},'triangle_attention_starting_node': {'dropout_rate': 0.25,'gating': True,'num_head': 4,'orientation': 'per_row','shared_dropout': True},'triangle_attention_ending_node': {'dropout_rate': 0.25,'gating': True,'num_head': 4,'orientation': 'per_column','shared_dropout': True},'triangle_multiplication_outgoing': {'dropout_rate': 0.25,'equation': 'ikc,jkc->ijc','num_intermediate_channel': 128,'orientation': 'per_row','shared_dropout': True,'fuse_projection_weights': False,},'triangle_multiplication_incoming': {'dropout_rate': 0.25,'equation': 'kjc,kic->ijc','num_intermediate_channel': 128,'orientation': 'per_row','shared_dropout': True,'fuse_projection_weights': False,},'pair_transition': {'dropout_rate': 0.0,'num_intermediate_factor': 4,'orientation': 'per_row','shared_dropout': True}},'extra_msa_channel': 64,'extra_msa_stack_num_block': 4,'max_relative_feature': 32,'msa_channel': 256,'pair_channel': 128,'prev_pos': {'min_bin': 3.25,'max_bin': 20.75,'num_bins': 15},'recycle_features': True,'recycle_pos': True,'seq_channel': 384,'template': {'attention': {'gating': False,'key_dim': 64,'num_head': 4,'value_dim': 64},'dgram_features': {'min_bin': 3.25,'max_bin': 50.75,'num_bins': 39},'embed_torsion_angles': False,'enabled': False,'template_pair_stack': {'num_block': 2,'triangle_attention_starting_node': {'dropout_rate': 0.25,'gating': True,'key_dim': 64,'num_head': 4,'orientation': 'per_row','shared_dropout': True,'value_dim': 64},'triangle_attention_ending_node': {'dropout_rate': 0.25,'gating': True,'key_dim': 64,'num_head': 4,'orientation': 'per_column','shared_dropout': True,'value_dim': 64},'triangle_multiplication_outgoing': {'dropout_rate': 0.25,'equation': 'ikc,jkc->ijc','num_intermediate_channel': 64,'orientation': 'per_row','shared_dropout': True,'fuse_projection_weights': False,},'triangle_multiplication_incoming': {'dropout_rate': 0.25,'equation': 'kjc,kic->ijc','num_intermediate_channel': 64,'orientation': 'per_row','shared_dropout': True,'fuse_projection_weights': False,},'pair_transition': {'dropout_rate': 0.0,'num_intermediate_factor': 2,'orientation': 'per_row','shared_dropout': True}},'max_templates': 4,'subbatch_size': 128,'use_template_unit_vector': False,}},'global_config': {'deterministic': False,'multimer_mode': False,'subbatch_size': 4,'use_remat': False,'zero_init': True,'eval_dropout': False,},'heads': {'distogram': {'first_break': 2.3125,'last_break': 21.6875,'num_bins': 64,'weight': 0.3},'predicted_aligned_error': {# `num_bins - 1` bins uniformly space the# [0, max_error_bin A] range.# The final bin covers [max_error_bin A, +infty]# 31A gives bins with 0.5A width.'max_error_bin': 31.,'num_bins': 64,'num_channels': 128,'filter_by_resolution': True,'min_resolution': 0.1,'max_resolution': 3.0,'weight': 0.0,},'experimentally_resolved': {'filter_by_resolution': True,'max_resolution': 3.0,'min_resolution': 0.1,'weight': 0.01},'structure_module': {'num_layer': 8,'fape': {'clamp_distance': 10.0,'clamp_type': 'relu','loss_unit_distance': 10.0},'angle_norm_weight': 0.01,'chi_weight': 0.5,'clash_overlap_tolerance': 1.5,'compute_in_graph_metrics': True,'dropout': 0.1,'num_channel': 384,'num_head': 12,'num_layer_in_transition': 3,'num_point_qk': 4,'num_point_v': 8,'num_scalar_qk': 16,'num_scalar_v': 16,'position_scale': 10.0,'sidechain': {'atom_clamp_distance': 10.0,'num_channel': 128,'num_residual_block': 2,'weight_frac': 0.5,'length_scale': 10.,},'structural_violation_loss_weight': 1.0,'violation_tolerance_factor': 12.0,'weight': 1.0},'predicted_lddt': {'filter_by_resolution': True,'max_resolution': 3.0,'min_resolution': 0.1,'num_bins': 50,'num_channels': 128,'weight': 0.01},'masked_msa': {'num_output': 23,'weight': 2.0},},'num_recycle': 3,'resample_msa_in_recycling': True},
})data_config = CONFIG.datarestypes = ['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P','S', 'T', 'W', 'Y', 'V'
]# Partial inversion of HHBLITS_AA_TO_ID.
ID_TO_HHBLITS_AA = {0: 'A',1: 'C',  # Also U.2: 'D',  # Also B.3: 'E',  # Also Z.4: 'F',5: 'G',6: 'H',7: 'I',8: 'K',9: 'L',10: 'M',11: 'N',12: 'P',13: 'Q',14: 'R',15: 'S',16: 'T',17: 'V',18: 'W',19: 'Y',20: 'X',  # Includes J and O.21: '-',
}restypes_with_x_and_gap = restypes + ['X', '-']
MAP_HHBLITS_AATYPE_TO_OUR_AATYPE = tuple(restypes_with_x_and_gap.index(ID_TO_HHBLITS_AA[i])for i in range(len(restypes_with_x_and_gap)))restype_name_to_atom14_names = {'ALA': ['N', 'CA', 'C', 'O', 'CB', '',    '',    '',    '',    '',    '',    '',    '',    ''],'ARG': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD',  'NE',  'CZ',  'NH1', 'NH2', '',    '',    ''],'ASN': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'OD1', 'ND2', '',    '',    '',    '',    '',    ''],'ASP': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'OD1', 'OD2', '',    '',    '',    '',    '',    ''],'CYS': ['N', 'CA', 'C', 'O', 'CB', 'SG',  '',    '',    '',    '',    '',    '',    '',    ''],'GLN': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD',  'OE1', 'NE2', '',    '',    '',    '',    ''],'GLU': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD',  'OE1', 'OE2', '',    '',    '',    '',    ''],'GLY': ['N', 'CA', 'C', 'O', '',   '',    '',    '',    '',    '',    '',    '',    '',    ''],'HIS': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'ND1', 'CD2', 'CE1', 'NE2', '',    '',    '',    ''],'ILE': ['N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', 'CD1', '',    '',    '',    '',    '',    ''],'LEU': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD1', 'CD2', '',    '',    '',    '',    '',    ''],'LYS': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD',  'CE',  'NZ',  '',    '',    '',    '',    ''],'MET': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'SD',  'CE',  '',    '',    '',    '',    '',    ''],'PHE': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD1', 'CD2', 'CE1', 'CE2', 'CZ',  '',    '',    ''],'PRO': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD',  '',    '',    '',    '',    '',    '',    ''],'SER': ['N', 'CA', 'C', 'O', 'CB', 'OG',  '',    '',    '',    '',    '',    '',    '',    ''],'THR': ['N', 'CA', 'C', 'O', 'CB', 'OG1', 'CG2', '',    '',    '',    '',    '',    '',    ''],'TRP': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD1', 'CD2', 'NE1', 'CE2', 'CE3', 'CZ2', 'CZ3', 'CH2'],'TYR': ['N', 'CA', 'C', 'O', 'CB', 'CG',  'CD1', 'CD2', 'CE1', 'CE2', 'CZ',  'OH',  '',    ''],'VAL': ['N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', '',    '',    '',    '',    '',    '',    ''],'UNK': ['',  '',   '',  '',  '',   '',    '',    '',    '',    '',    '',    '',    '',    ''],}restype_1to3 = {'A': 'ALA','R': 'ARG','N': 'ASN','D': 'ASP','C': 'CYS','Q': 'GLN','E': 'GLU','G': 'GLY','H': 'HIS','I': 'ILE','L': 'LEU','K': 'LYS','M': 'MET','F': 'PHE','P': 'PRO','S': 'SER','T': 'THR','W': 'TRP','Y': 'TYR','V': 'VAL',
}atom_types = ['N', 'CA', 'C', 'CB', 'O', 'CG', 'CG1', 'CG2', 'OG', 'OG1', 'SG', 'CD','CD1', 'CD2', 'ND1', 'ND2', 'OD1', 'OD2', 'SD', 'CE', 'CE1', 'CE2', 'CE3','NE', 'NE1', 'NE2', 'OE1', 'OE2', 'CH2', 'NH1', 'NH2', 'OH', 'CZ', 'CZ2','CZ3', 'NZ', 'OXT'
]atom_order = {atom_type: i for i, atom_type in enumerate(atom_types)}residue_atoms = {'ALA': ['C', 'CA', 'CB', 'N', 'O'],'ARG': ['C', 'CA', 'CB', 'CG', 'CD', 'CZ', 'N', 'NE', 'O', 'NH1', 'NH2'],'ASP': ['C', 'CA', 'CB', 'CG', 'N', 'O', 'OD1', 'OD2'],'ASN': ['C', 'CA', 'CB', 'CG', 'N', 'ND2', 'O', 'OD1'],'CYS': ['C', 'CA', 'CB', 'N', 'O', 'SG'],'GLU': ['C', 'CA', 'CB', 'CG', 'CD', 'N', 'O', 'OE1', 'OE2'],'GLN': ['C', 'CA', 'CB', 'CG', 'CD', 'N', 'NE2', 'O', 'OE1'],'GLY': ['C', 'CA', 'N', 'O'],'HIS': ['C', 'CA', 'CB', 'CG', 'CD2', 'CE1', 'N', 'ND1', 'NE2', 'O'],'ILE': ['C', 'CA', 'CB', 'CG1', 'CG2', 'CD1', 'N', 'O'],'LEU': ['C', 'CA', 'CB', 'CG', 'CD1', 'CD2', 'N', 'O'],'LYS': ['C', 'CA', 'CB', 'CG', 'CD', 'CE', 'N', 'NZ', 'O'],'MET': ['C', 'CA', 'CB', 'CG', 'CE', 'N', 'O', 'SD'],'PHE': ['C', 'CA', 'CB', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'N', 'O'],'PRO': ['C', 'CA', 'CB', 'CG', 'CD', 'N', 'O'],'SER': ['C', 'CA', 'CB', 'N', 'O', 'OG'],'THR': ['C', 'CA', 'CB', 'CG2', 'N', 'O', 'OG1'],'TRP': ['C', 'CA', 'CB', 'CG', 'CD1', 'CD2', 'CE2', 'CE3', 'CZ2', 'CZ3','CH2', 'N', 'NE1', 'O'],'TYR': ['C', 'CA', 'CB', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'N', 'O','OH'],'VAL': ['C', 'CA', 'CB', 'CG1', 'CG2', 'N', 'O']
}def shape_list(x):"""Return list of dimensions of a tensor, statically where possible.Like `x.shape.as_list()` but with tensors instead of `None`s.Args:x: A tensor.Returns:A list with length equal to the rank of the tensor. The n-th element of thelist is an integer when that dimension is statically known otherwise it isthe n-th element of `tf.shape(x)`."""x = tf.convert_to_tensor(x)# If unknown rank, return dynamic shapeif x.get_shape().dims is None:return tf.shape(x)static = x.get_shape().as_list()shape = tf.shape(x)ret = []for i in range(len(static)):dim = static[i]if dim is None:dim = shape[i]ret.append(dim)return retdef data_transforms_curry1(f):"""Supply all arguments but the first."""def fc(*args, **kwargs):return lambda x: f(x, *args, **kwargs)return fcdef correct_msa_restypes(protein):"""Correct MSA restype to have the same order as residue_constants."""new_order_list = MAP_HHBLITS_AATYPE_TO_OUR_AATYPEnew_order = tf.constant(new_order_list, dtype=protein['msa'].dtype)protein['msa'] = tf.gather(new_order, protein['msa'], axis=0)perm_matrix = np.zeros((22, 22), dtype=np.float32)perm_matrix[range(len(new_order_list)), new_order_list] = 1.for k in protein:if 'profile' in k:  # Include both hhblits and psiblast profilesnum_dim = protein[k].shape.as_list()[-1]assert num_dim in [20, 21, 22], ('num_dim for %s out of expected range: %s' % (k, num_dim))protein[k] = tf.tensordot(protein[k], perm_matrix[:num_dim, :num_dim], 1)return protein@data_transforms_curry1
def add_distillation_flag(protein, distillation):protein['is_distillation'] = tf.constant(float(distillation),shape=[],dtype=tf.float32)return proteindef cast_64bit_ints(protein):for k, v in protein.items():if v.dtype == tf.int64:protein[k] = tf.cast(v, tf.int32)return proteindef squeeze_features(protein):"""Remove singleton and repeated dimensions in protein features."""protein['aatype'] = tf.argmax(protein['aatype'], axis=-1, output_type=tf.int32)for k in ['domain_name', 'msa', 'num_alignments', 'seq_length', 'sequence','superfamily', 'deletion_matrix', 'resolution','between_segment_residues', 'residue_index', 'template_all_atom_masks']:if k in protein:final_dim = shape_list(protein[k])[-1]if isinstance(final_dim, int) and final_dim == 1:protein[k] = tf.squeeze(protein[k], axis=-1)for k in ['seq_length', 'num_alignments']:if k in protein:protein[k] = protein[k][0]  # Remove fake sequence dimensionreturn protein@data_transforms_curry1
def randomly_replace_msa_with_unknown(protein, replace_proportion):"""Replace a proportion of the MSA with 'X'."""msa_mask = (tf.random.uniform(shape_list(protein['msa'])) <replace_proportion)x_idx = 20gap_idx = 21msa_mask = tf.logical_and(msa_mask, protein['msa'] != gap_idx)protein['msa'] = tf.where(msa_mask,tf.ones_like(protein['msa']) * x_idx,protein['msa'])aatype_mask = (tf.random.uniform(shape_list(protein['aatype'])) <replace_proportion)protein['aatype'] = tf.where(aatype_mask,tf.ones_like(protein['aatype']) * x_idx,protein['aatype'])return proteindef make_seq_mask(protein):protein['seq_mask'] = tf.ones(shape_list(protein['aatype']), dtype=tf.float32)return proteindef make_msa_mask(protein):"""Mask features are all ones, but will later be zero-padded."""protein['msa_mask'] = tf.ones(shape_list(protein['msa']), dtype=tf.float32)protein['msa_row_mask'] = tf.ones(shape_list(protein['msa'])[0], dtype=tf.float32)return proteindef make_hhblits_profile(protein):"""Compute the HHblits MSA profile if not already present."""if 'hhblits_profile' in protein:return protein# Compute the profile for every residue (over all MSA sequences).protein['hhblits_profile'] = tf.reduce_mean(tf.one_hot(protein['msa'], 22), axis=0)return proteinclass SeedMaker(object):"""Return unique seeds."""def __init__(self, initial_seed=0):self.next_seed = initial_seeddef __call__(self):i = self.next_seedself.next_seed += 1return iseed_maker = SeedMaker()def make_random_seed():return tf.random.uniform([2],tf.int32.min,tf.int32.max,tf.int32,seed=seed_maker())def make_random_crop_to_size_seed(protein):"""Random seed for cropping residues and templates."""protein['random_crop_to_size_seed'] = make_random_seed()return proteindef make_atom14_masks(protein):"""Construct denser atom positions (14 dimensions instead of 37)."""restype_atom14_to_atom37 = []  # mapping (restype, atom14) --> atom37restype_atom37_to_atom14 = []  # mapping (restype, atom37) --> atom14restype_atom14_mask = []for rt in restypes:atom_names = restype_name_to_atom14_names[restype_1to3[rt]]restype_atom14_to_atom37.append([(atom_order[name] if name else 0)for name in atom_names])atom_name_to_idx14 = {name: i for i, name in enumerate(atom_names)}restype_atom37_to_atom14.append([(atom_name_to_idx14[name] if name in atom_name_to_idx14 else 0)for name in atom_types])restype_atom14_mask.append([(1. if name else 0.) for name in atom_names])# Add dummy mapping for restype 'UNK'restype_atom14_to_atom37.append([0] * 14)restype_atom37_to_atom14.append([0] * 37)restype_atom14_mask.append([0.] * 14)restype_atom14_to_atom37 = np.array(restype_atom14_to_atom37, dtype=np.int32)restype_atom37_to_atom14 = np.array(restype_atom37_to_atom14, dtype=np.int32)restype_atom14_mask = np.array(restype_atom14_mask, dtype=np.float32)# create the mapping for (residx, atom14) --> atom37, i.e. an array# with shape (num_res, 14) containing the atom37 indices for this proteinresidx_atom14_to_atom37 = tf.gather(restype_atom14_to_atom37,protein['aatype'])residx_atom14_mask = tf.gather(restype_atom14_mask,protein['aatype'])protein['atom14_atom_exists'] = residx_atom14_maskprotein['residx_atom14_to_atom37'] = residx_atom14_to_atom37# create the gather indices for mapping backresidx_atom37_to_atom14 = tf.gather(restype_atom37_to_atom14,protein['aatype'])protein['residx_atom37_to_atom14'] = residx_atom37_to_atom14# create the corresponding maskrestype_atom37_mask = np.zeros([21, 37], dtype=np.float32)for restype, restype_letter in enumerate(restypes):restype_name = restype_1to3[restype_letter]atom_names = residue_atoms[restype_name]for atom_name in atom_names:atom_type = atom_order[atom_name]restype_atom37_mask[restype, atom_type] = 1residx_atom37_mask = tf.gather(restype_atom37_mask,protein['aatype'])protein['atom37_atom_exists'] = residx_atom37_maskreturn proteindef nonensembled_map_fns(data_config):"""Input pipeline functions which are not ensembled."""common_cfg = data_config.commonmap_fns = [correct_msa_restypes,add_distillation_flag(False),cast_64bit_ints,squeeze_features,# Keep to not disrupt RNG.randomly_replace_msa_with_unknown(0.0),make_seq_mask,make_msa_mask,# Compute the HHblits profile if it's not set. This has to be run before# sampling the MSA.make_hhblits_profile,make_random_crop_to_size_seed,]if common_cfg.use_templates:map_fns.extend([fix_templates_aatype,make_template_mask,make_pseudo_beta('template_')])map_fns.extend([make_atom14_masks,])return map_fns@data_transforms_curry1
def compose(x, fs):for f in fs:x = f(x)return xwith open("Human_HBB_tensor_dict.pkl",'rb') as f:Human_HBB_tensor_dict = pickle.load(f)protein = copy.deepcopy(Human_HBB_tensor_dict)
print(f"protein特征数:{len(protein)}")
print(f"protein特征:{protein.keys()}")eval_cfg = data_config.eval
protein = compose(nonensembled_map_fns(data_config))(protein)print(f"nonensembled函数处理后protein特征数:{len(protein)}")
print(f"nonensembled函数处理后protein特征:{protein.keys()}")print(protein)## 保存
with open("Human_HBB_tensor_dict_nonensembled.pkl",'wb') as f:pickle.dump(protein, f)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/226419.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【面经】2024年软件测试面试题大全(持续更新)附答案

&#x1f4e2;专注于分享软件测试干货内容&#xff0c;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1f4dd; 如有错误敬请指正&#xff01;&#x1f4e2;交流讨论&#xff1a;欢迎加入我们一起学习&#xff01;&#x1f4e2;资源分享&#xff1a;耗时200小时精选的「软件测试」资…

冒泡排序学习

冒泡排序&#xff08;Bubble Sort&#xff09;是一种简单的排序算法&#xff0c;它通过重复地交换相邻的元素来排序。具体实现如下&#xff1a; 1. 从待排序的数组中的第一个元素开始&#xff0c;依次比较相邻的两个元素。 2. 如果前一个元素大于后一个元素&#xff0c;则交换…

计算机网络英文总结

物理层 数据链路层 循环冗余校验(Cyclic Redundancy Check) 点对点协议PPP(Point-to-Point Protocol) 链路控制协议(Link Control Protocol) 网络控制协议(Network Control Protocol) 网络层(network layer) IP(Internet Protocol) 网际协议 ARP(Address…

Mysql in FIND_IN_SET(‘123‘, 数据库字段) 的使用场景

-- in后面的参数是我传入的List SELECT * from user where 数据库字段 in(123, 456); -- 第一个参数是常量, 第二个参数是 数据库字段(逗号隔开的字符串) SELECT * from user where FIND_IN_SET(123, 数据库字段); 用find_in_set 和 like, SELECT * FROM user WHERE…

YOLOv8使用自定义改进后的模型同时《加载官方预训练权重》教程,附代码

YOLOv8自定义改进后的模型同时《加载官方预训练权重》教程,附代码 💡该教程为改进YOLOv8指南,属于《芒果书》📚系列,包含大量的原创改进方式🚀 💡🚀🚀🚀内含改进源代码 按步骤操作运行改进后的代码即可💡更方便的统计更多实验数据,方便写作 YOLOv8自定义…

docker部署node服务pm2

mkdir /data cd /data拉取最新keymetrics/pm2:latest-alpine镜像 docker pull keymetrics/pm2  从github上拉取代码&#xff0c;先要安装git git clone https://github.com/keymetrics/pm2-docker-alpinecd /data/pm2-docker-alpine/example-app编写Dockerfile&#xff0c;…

Spring boot basePackages 通配符* 找不到Bean

Spring boot basePackages 通配符* 找不到Bean 今天遇到了一个关于spring boot 组件ComponentScan 中basePackages 使用通配符* 找不到Bean的问题 目录结构中BussinessPerson与Dog类中都有标注有Component注解&#xff0c;结果扫描不到。 然后删除通配符&#xff0c;结果运行成…

01 Vue介绍

概述 Developers in the industry must resolve frontend development problems quickly with minimal impact on existing workflows or backend architecture. In any cases, developers tend to overlook the UI until the end of a project, which can happen because of …

C++相关闲碎记录(15)

1、string字符串 #include <iostream> #include <string> using namespace std;int main (int argc, char** argv) {const string delims(" \t,.;");string line;// for every line read successfullywhile (getline(cin,line)) {string::size_type beg…

ADUM1200ARZ数字隔离器:重新定义技术标准

ADUM1200ARZ数字隔离器成为技术进步领域的关键组件。其创新设计和多方面功能重新定义了数字隔离技术的格局&#xff0c;提供了满足不同工业需求的众多功能。让我们通过本文直观的了解ADUM1200ARZ的功能与技术标准。 窄体且符合ROHS&#xff1a;设定新基准 该数字隔离器采用窄体…

持续集成交付CICD:Jenkins使用GitLab共享库实现基于Ansible的CD流水线部署前端应用的蓝绿发布

目录 一、实验 1.蓝绿发布准备 2.Jenkins使用GitLab共享库实现基于Ansible的CD流水线部署前端应用的蓝绿发布 二、问题 1.手动构建Jenkins前端项目CI流水线报错 2.如何优化手动构建流水线选项参数 一、实验 1.蓝绿发布准备 &#xff08;1&#xff09;环境 表1 蓝绿发布…

该不该实行末位淘汰制?

在绩效考核中&#xff0c;不得不提一种特别的制度&#xff1a;末位淘汰制。具体而言&#xff0c;末位淘汰制是指工作单位根据设定的目标&#xff0c;结合各个岗位的实际情况&#xff0c;设定的考核指标体系&#xff0c;并以此指标体系为标准对员工进行考核&#xff0c;最后根据…

用EnumSet代替位域

在Java中&#xff0c;可以使用EnumSet来代替位域&#xff0c;以提高代码的可读性和类型安全性。下面是一个简单的例子&#xff0c;演示如何使用EnumSet来管理一组枚举值&#xff1a; import java.util.EnumSet;// 定义一个枚举类型表示权限 enum Permission {READ, WRITE, EXE…

Ubuntu NAT模式下自己电脑无法用过Xshell等工具远程

背景 下载的Ubuntu18.04桌面版&#xff0c;默认配置成NAT模式后&#xff0c;电脑主机可以正常ping通VM&#xff0c;但是Xshell无法远程连接 做法&#xff08;怕不可逆可以先快照&#xff09; 1&#xff1a;查看/etc/ssh/sshd_config配置是否开启22端口 开启后重启ssh 2&#x…

NCNN 源码学习【三】:数据处理

一、Topic&#xff1a;数据处理 这次我们来一段NCNN应用代码中&#xff0c;除了推理外最重要的一部分代码&#xff0c;数据处理&#xff1a; ncnn::Mat in ncnn::Mat::from_pixels_resize(bgr.data, ncnn::Mat::PIXEL_BGR, bgr.cols, bgr.rows, 227, 227);const float mean_v…

独孤思维:真正赚钱的人只会关注自己的事业

真正赚钱的人只会关注自己的事业。 因为对他们来说&#xff0c;事业才是稀缺奢侈品。 这份事业可以是你的工作&#xff0c;可以是你的副业&#xff0c;也可以是你的创业。 真正赚钱的人不会去绞劲脑汁去想如何炫耀&#xff0c;如何吹牛b。 但凡赚了点钱&#xff0c;就开始炫…

DDOS 攻击是什么?有哪些常见的DDOS攻击?

DDOS简介 DDOS又称为分布式拒绝服务&#xff0c;全称是Distributed Denial of Service。DDOS本是利用合理的请求造成资源过载&#xff0c;导致服务不可用&#xff0c;从而造成服务器拒绝正常流量服务。就如酒店里的房间是有固定的数量的&#xff0c;比如一个酒店有50个房间&am…

2276. 统计区间中的整数数目

【LetMeFly】2276.统计区间中的整数数目 力扣题目链接&#xff1a;https://leetcode.cn/problems/count-integers-in-intervals/ 给你区间的 空 集&#xff0c;请你设计并实现满足要求的数据结构&#xff1a; 新增&#xff1a;添加一个区间到这个区间集合中。统计&#xff1…

C# OpenVINO 直接读取百度模型实现图片旋转角度检测

目录 效果 模型信息 代码 下载 C# OpenVINO 直接读取百度模型实现图片旋转角度检测 效果 模型信息 Inputs ------------------------- name&#xff1a;x tensor&#xff1a;F32[?, 3, 224, 224] --------------------------------------------------------------- Ou…

RV32/64 特权架构

machine mode: 运行最可信的代码;supervisor mode:为 Linux&#xff0c;FreeBSD 和 Windows 等操作系统提供支持;user mode:权限最低&#xff0c;应用程序的代码在此模式下运行&#xff1b; 这两种新模式都比user mode有着更高的权限&#xff0c;有更多权限的模式通常可以使用…