How to use the biopandas.mol2.PandasMol2 function in biopandas

To help you get started, we’ve selected a few biopandas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rasbt / screenlamp / tools / funcgroup_matching.py View on Github external
mol2_lines=q_mol2[1])
            q_pdmol._df = q_pdmol.df[(q_pdmol.df['atom_type'] != 'H')]
            cache[q_mol2[0]] = q_pdmol

        atoms, charges = get_atom_matches(q_pdmol, d_pdmol)

        dct_results['query'].append(q_mol2[0])
        dct_results['dbase'].append(d_mol2[0])
        dct_results['atoms'].append(atoms)
        dct_results['charges'].append(charges)
    """

    with open(output_file + '_charge.tsv', 'w') as f1,\
            open(output_file + '_atomtype.tsv', 'w') as f2:

        columns = PandasMol2().read_mol2(q_path).df['atom_name'].values
        f1.write('dbase\tquery\t%s\n' % '\t'.join(columns))
        f2.write('dbase\tquery\t%s\n' % '\t'.join(columns))
        for i in range(len(dct_results['dbase'])):
            s1 = '%s\t%s\t%s\n' % (dct_results['dbase'][i],
                                 dct_results['query'][i],
                                 '\t'.join(format(x, "1.2f")
                                          for x in dct_results['charges'][i]))

            f1.write(s1)
            s2 = '%s\t%s\t%s\n' % (dct_results['dbase'][i],
                                 dct_results['query'][i],
                                 '\t'.join(dct_results['atoms'][i]))
            f2.write(s2)

    if verbose:
        elapsed = time.time() - start
github rasbt / screenlamp / tools / funcgroup_presence_to_id.py View on Github external
def data_processor_gz(mol2_gz):

    pdmol = PandasMol2().read_mol2_from_list(mol2_lines=mol2_gz[1],
                                             mol2_code=mol2_gz[0])

    match = mol2_gz[0].decode('utf-8')
    for sub_sele in SELECTION:
        if not pd.eval(sub_sele).any():
            match = ''
            break

    return match
github rasbt / screenlamp / tools / funcgroup_distance_to_id.py View on Github external
def data_processor_gz(mol2_gz):

    pdmol = PandasMol2().read_mol2_from_list(mol2_lines=mol2_gz[1],
                                             mol2_code=mol2_gz[0])

    coordinates = pdmol.df.loc[pd.eval(SELECTION[0]), ['x', 'y', 'z']].values

    pdmol._df = pdmol._df[pd.eval(SELECTION[1])]

    for xyz in coordinates:

        distances = pdmol.distance(xyz)

        match = ((distances.values >= DISTANCE[0]).any() and
                 (distances.values <= DISTANCE[1]).any())

        if match:
            return mol2_gz[0].decode('utf-8')
github rasbt / screenlamp / tools / funcgroup_matching.py View on Github external
def data_processor(mol2s):

    q_pdmol = PandasMol2()
    d_pdmol = PandasMol2()

    d_pdmol.read_mol2_from_list(mol2_code=mol2s[0][0],
                                mol2_lines=mol2s[0][1])

    q_pdmol.read_mol2_from_list(mol2_code=mol2s[1][0],
                                mol2_lines=mol2s[1][1])

    atoms, charges = get_atom_matches(q_pdmol, d_pdmol)
    return mol2s[0][0], mol2s[1][0], atoms, charges
github rasbt / screenlamp / tools / funcgroup_distance_to_id.py View on Github external
def data_processor(mol2):

    pdmol = PandasMol2().read_mol2_from_list(mol2_lines=mol2[1],
                                             mol2_code=mol2[0])

    coordinates = pdmol.df.loc[pd.eval(SELECTION[0]), ['x', 'y', 'z']].values

    pdmol._df = pdmol._df[pd.eval(SELECTION[1])]

    for xyz in coordinates:

        distances = pdmol.distance(xyz)

        match = ((distances.values >= DISTANCE[0]).any() and
                 (distances.values <= DISTANCE[1]).any())

        if match:
            return mol2[0]
github rasbt / screenlamp / tools / funcgroup_matching.py View on Github external
def data_processor(mol2s):

    q_pdmol = PandasMol2()
    d_pdmol = PandasMol2()

    d_pdmol.read_mol2_from_list(mol2_code=mol2s[0][0],
                                mol2_lines=mol2s[0][1])

    q_pdmol.read_mol2_from_list(mol2_code=mol2s[1][0],
                                mol2_lines=mol2s[1][1])

    atoms, charges = get_atom_matches(q_pdmol, d_pdmol)
    return mol2s[0][0], mol2s[1][0], atoms, charges
github rasbt / screenlamp / tools / funcgroup_matching.py View on Github external
def data_processor_gz(mol2s_gz):

    q_pdmol = PandasMol2()
    d_pdmol = PandasMol2()

    d_pdmol.read_mol2_from_list(mol2_code=mol2s_gz[0][0],
                                mol2_lines=mol2s_gz[0][1])

    q_pdmol.read_mol2_from_list(mol2_code=mol2s_gz[1][0],
                                mol2_lines=mol2s_gz[1][1])

    atoms, charges = get_atom_matches(q_pdmol, d_pdmol)
    return (mol2s_gz[0][0].decode('utf-8'),
            mol2s_gz[1][0].decode('utf-8'),
            atoms, charges)
github rasbt / screenlamp / tools / funcgroup_presence_to_id.py View on Github external
def data_processor(mol2):

    pdmol = PandasMol2().read_mol2_from_list(mol2_lines=mol2[1],
                                             mol2_code=mol2[0])

    match = mol2[0]
    for sub_sele in SELECTION:
        if not pd.eval(sub_sele).any():
            match = ''
            break

    return match
github rasbt / screenlamp / tools / funcgroup_matching.py View on Github external
def data_processor_gz(mol2s_gz):

    q_pdmol = PandasMol2()
    d_pdmol = PandasMol2()

    d_pdmol.read_mol2_from_list(mol2_code=mol2s_gz[0][0],
                                mol2_lines=mol2s_gz[0][1])

    q_pdmol.read_mol2_from_list(mol2_code=mol2s_gz[1][0],
                                mol2_lines=mol2s_gz[1][1])

    atoms, charges = get_atom_matches(q_pdmol, d_pdmol)
    return (mol2s_gz[0][0].decode('utf-8'),
            mol2s_gz[1][0].decode('utf-8'),
            atoms, charges)

biopandas

Machine Learning Library Extensions

BSD-3-Clause
Latest version published 4 months ago

Package Health Score

74 / 100
Full package analysis

Similar packages