Ejemplo n.º 1
0
    def is_equal(self, other, threshold, chiral=True):
        """Decide if the values of two Torsion objects are equal or not
        (based on Torsional RMSD). If the objects have the "initial_values"
        attributes, they will be taken into account too.

        Args(optional):
            chiral (bool): default-True, if set to False, mirror image of the
            structure will be considered too
        """

        values = []
        values.append(tor_rmsd(2, get_vec(self.values, other.values)))

        if hasattr(other, "initial_values"):
            values.append(
                tor_rmsd(2, get_vec(self.values, other.initial_values)))
        if not chiral:
            values.append(
                tor_rmsd(2, get_vec(self.values,
                                    [-1 * i for i in other.values])))
            if hasattr(other, "initial_values"):
                values.append(
                    tor_rmsd(
                        2,
                        get_vec(self.values,
                                [-1 * i for i in other.initial_values])))
        if min(values) > threshold:
            return False
        else:
            return True
Ejemplo n.º 2
0
    def is_equal(self, other, threshold, chiral=True):
        """Decide if the values of two Torsion objects are equal or not
        (based on Torsional RMSD). If the objects have the "initial_values"
        attributes, they will be taken into account too.

        Args(optional):
            chiral (bool): default-True, if set to False, mirror image of the
            structure will be considered too
        """

        values = []
        values.append(tor_rmsd(2, get_vec(self.values, other.values)))

        if hasattr(other, "initial_values"):
            values.append(tor_rmsd(2, get_vec(self.values,
                                              other.initial_values)))
        if not chiral:
            values.append(tor_rmsd(2, get_vec(self.values,
                                              [-1*i for i in other.values])))
            if hasattr(other, "initial_values"):
                values.append(tor_rmsd(2, get_vec(self.values, [-1*i for i in
                                                  other.initial_values])))
        if min(values) > threshold:
            return False
        else:
            return True
Ejemplo n.º 3
0
    def is_equal(self, other, threshold, chiral=True):
        values = []
        values.append(tor_rmsd(2, get_vec(self.values, other.values)))

        if hasattr(other, "initial_values"):
            values.append(tor_rmsd(2, get_vec(self.values, other.initial_values)))

        if not chiral:
            values.append(tor_rmsd(2, get_vec(self.values, [-1 * i for i in other.values])))
            if hasattr(other, "initial_values"):
                values.append(tor_rmsd(2, get_vec(self.values, [-1 * i for i in other.initial_values])))
        if min(values) > threshold:
            return False
        else:
            return True
Ejemplo n.º 4
0
def pyranosering_measure(sdf_string, position, dict_of_options):
    """Assign the ring to a conformation from the dictionary of options.

    Args:
        sdf_string (string)
        position (list): 7 atoms defining the ring
        dict_of_options (dict) : options for the ring
    Returns:
        An integer that corresponds to the best matching dict key
    Raises:
        ValueError: If the lenght of the position is not equal 7.
    """
    if len(position) != 7:
        raise ValueError("The position needs to be defined by 7 integers")
    ang1 = dihedral_measure(sdf_string, position[0:4])
    ang2 = dihedral_measure(sdf_string, position[1:5])
    ang3 = dihedral_measure(sdf_string, position[2:6])
    ang4 = dihedral_measure(sdf_string, (ig(3)(position), ig(4)(position),
                                         ig(5)(position), ig(0)(position)))
    ang5 = dihedral_measure(sdf_string, (ig(4)(position), ig(5)(position),
                                         ig(0)(position), ig(1)(position)))
    ang6 = dihedral_measure(sdf_string, (ig(5)(position), ig(0)(position),
                                         ig(1)(position), ig(2)(position)))

    all_ang = [ang1, ang2, ang3, ang4, ang5, ang6]

    rmsd_dict = {}

    for key in dict_of_options:
        rmsd_dict[key] = (tor_rmsd(2, get_vec(all_ang, dict_of_options[key])))

    return int(min(rmsd_dict.iteritems(), key=ig(1))[0])
Ejemplo n.º 5
0
def pyranosering_measure(sdf_string, position, dict_of_options):
    """Assign the ring to a conformation from the dictionary of options.

    Args:
        sdf_string (string)
        position (list): 7 atoms defining the ring
        dict_of_options (dict) : options for the ring
    Returns:
        An integer that corresponds to the best matching dict key
    Raises:
        ValueError: If the lenght of the position is not equal 7.
    """
    if len(position) != 7:
        raise ValueError("The position needs to be defined by 7 integers")
    ang1 = dihedral_measure(sdf_string, position[0:4])
    ang2 = dihedral_measure(sdf_string, position[1:5])
    ang3 = dihedral_measure(sdf_string, position[2:6])
    ang4 = dihedral_measure(
        sdf_string,
        (ig(3)(position), ig(4)(position), ig(5)(position), ig(0)(position)))
    ang5 = dihedral_measure(
        sdf_string,
        (ig(4)(position), ig(5)(position), ig(0)(position), ig(1)(position)))
    ang6 = dihedral_measure(
        sdf_string,
        (ig(5)(position), ig(0)(position), ig(1)(position), ig(2)(position)))

    all_ang = [ang1, ang2, ang3, ang4, ang5, ang6]

    rmsd_dict = {}

    for key in dict_of_options:
        rmsd_dict[key] = (tor_rmsd(2, get_vec(all_ang, dict_of_options[key])))

    return int(min(rmsd_dict.iteritems(), key=ig(1))[0])
Ejemplo n.º 6
0
 def is_equal(self, other, threshold, chiral=True):
     values = []
     tmp = []
     for i in get_vec(self.values, other.values):
         if i == 0:
             tmp.append(0)
         else:
             tmp.append(1)
     values.append(sum(tmp) / len(tmp))
     if hasattr(other, "initial_values"):
         tmp = []
         for i in get_vec(self.values, other.initial_values):
             if i == 0:
                 tmp.append(0)
             else:
                 tmp.append(1)
         values.append(sum(tmp) / len(tmp))
     if min(values) > threshold:
         return False
     else:
         return True
Ejemplo n.º 7
0
 def is_equal(self, other, threshold, chiral=True):
     values = []
     tmp = []
     for i in get_vec(self.values, other.values):
         if i == 0:
             tmp.append(0)
         else:
             tmp.append(1)
     values.append(sum(tmp) / len(tmp))
     if hasattr(other, "initial_values"):
         tmp = []
         for i in get_vec(self.values, other.initial_values):
             if i == 0:
                 tmp.append(0)
             else:
                 tmp.append(1)
         values.append(sum(tmp) / len(tmp))
     if min(values) > threshold:
         return False
     else:
         return True
Ejemplo n.º 8
0
    def is_equal(self, other, threshold, chiral=True):
        values = []
        values.append(tor_rmsd(2, get_vec(self.values, other.values)))

        if hasattr(other, "initial_values"):
            values.append(
                tor_rmsd(2, get_vec(self.values, other.initial_values)))

        if not chiral:
            values.append(
                tor_rmsd(2, get_vec(self.values,
                                    [-1 * i for i in other.values])))
            if hasattr(other, "initial_values"):
                values.append(
                    tor_rmsd(
                        2,
                        get_vec(self.values,
                                [-1 * i for i in other.initial_values])))
        if min(values) > threshold:
            return False
        else:
            return True