Example #1
0
def test_common_contacts_featurizer_1():
    trajectories = MetEnkephalin().get_cached().trajectories
    top = trajectories[0].topology
    met_seq = top.to_fasta(0)
    #fake sequence has an insertion
    fake_met_eq ='YGGFMF'
    alignment={}
    #do "alignment "
    alignment["actual"] = met_seq+"-"
    alignment["fake"] = fake_met_eq

    feat = CommonContactFeaturizer(alignment=alignment, contacts='all',
                                   same_residue=True)
    rnd_traj = np.random.randint(len(trajectories))
    df = pd.DataFrame(feat.describe_features(trajectories[rnd_traj]))
    features = feat.transform([trajectories[rnd_traj]])
Example #2
0
def test_common_contacts_featurizer_1():
    trajectories = MetEnkephalin().get_cached().trajectories
    top = trajectories[0].topology
    met_seq = top.to_fasta(0)
    # fake sequence has an insertion
    fake_met_eq = 'YGGFMF'
    alignment = {}
    # do "alignment "
    alignment["actual"] = met_seq + "-"
    alignment["fake"] = fake_met_eq
    max_len = max([len(alignment[i]) for i in alignment.keys()])
    contacts = [i for i in itertools.combinations(np.arange(max_len), 2)]
    feat = CommonContactFeaturizer(alignment=alignment, contacts=contacts,
                                   same_residue=True)
    rnd_traj = np.random.randint(len(trajectories))
    df = pd.DataFrame(feat.describe_features(trajectories[rnd_traj]))
    features = feat.transform([trajectories[rnd_traj]])