Пример #1
0
    def overlap(self, overlap_idx, rest):
        '''
        # select position with overlap value in restriction: rest
        # e.g. rest=[0.1,0.5] overlap ratio : 0.1 <= value <= 0.5
        Args:
            overlap_idx: int index for overlap table
            rest: typle: (a,b) , restriction a < value < b 
                  list: [a,b] , restriction a <= value <= b
                  None: no restriction

        Returns: self

        '''

        _, _, df = db.get_success_data(overlap_idx, dataframe=True)
        primary_key = db.primary_key_for(overlap_idx)
        df = df[primary_key+['overlap_ratio']]
        df = table(df).apply_rest('overlap_ratio',rest)

        if self.position is None:
            self.position = df 
        else:
            self.position = self.docked & df 

        return self
Пример #2
0
    def ligand_size(self, ligand_idx, rest):
        '''
        select the ligand for the size in restriciton : rest
        e.g. rest=(None,20) for the ligand could be fit into the box with size 20 A

        Args:
            ligand_idx: int 
            rest: typle: (a,b) , restriction a < value < b 
                  list: [a,b] , restriction a <= value <= b
                  None: no restriction
        '''

        _, _, df = db.get_success_data(ligand_idx, dataframe=True)
        primary_key = db.primary_key_for(ligand_idx)
        df = df[primary_key + ['max_size_on_axis']]
        df = table(df).apply_rest('max_size_on_axis', rest)
        if self.ligand is None:
            self.ligand = df
        else:
            self.ligand = self.ligand & df 
        try:            
            folder_name  = db.get_folder(ligand_idx)
            self.ligand_folder = '{}_{}'.format(ligand_idx, folder_name)
        except:
            pass
        return self
Пример #3
0
    def docked(self, docked_idx):
        '''
        load available docked ligand from table with idx: docked_idx
        set docked_folder
    
        Args:
            docked_idx: int

        Returns: self

        '''

        _, _, df = db.get_success_data(docked_idx, dataframe=True)
        primary_key = db.primary_key_for(docked_idx)
        df = df[primary_key]
        df = table(df)

        if self.ligand is None:
            self.ligand = df 
        else:
            self.ligand = self.ligand & df 
        
        folder_name = db.get_folder(docked_idx)
        self.docked_folder = '{}_{}'.format(docked_idx, folder_name )

        return self
Пример #4
0
    def crystal(self, crystal_idx):
        '''
        load available ligand from table with idx: crystal_idx
        set ligand_folder
        
        Args:
            crystal_idx: int 

        Returns: self

        '''

        table_name, _, df  = db.get_success_data(crystal_idx, dataframe=True)
        primary_key = db.primary_key_for(crystal_idx)
        df = df[primary_key]
        df = table(df) 
        print df
        #print df
        if self.ligand is None:
            self.ligand = df 
        else:
            self.ligand = self.ligand & df  
        try:            
            folder_name  = db.get_folder(crystal_idx)
            self.ligand_folder = '{}_{}'.format(crystal_idx, folder_name)
        except:
            pass
        return self
Пример #5
0
    def receptor(self, receptor_idx, rest):
        '''
        load available receptor from table with idx: receptor_idx
        set receptor_folder
        
        Args:
            receptor_idx: int
            rest: typle: (a,b) , restriction a < value < b 
                  list: [a,b] , restriction a <= value <= b
                  None: no restriction

        Returns:

        '''

        _, _, df = db.get_success_data(receptor_idx, dataframe=True)
        primary_key = db.primary_key_for(receptor_idx)
        df = df[primary_key+['resolution']]
        df = table(df).apply_rest('resolution',rest)

        if self.ligand is None:
            self.ligand  = df 
        else:
            self.ligand = self.ligand & df

        folder_name = db.get_folder(receptor_idx)
        self.receptor_folder = '{}_{}'.format(receptor_idx, folder_name)
        
        return self
Пример #6
0
    def druglike_molecules(self, idx):
        """
        Restrictions are in order of [hbond_donors, hbonds_acceptors, has_disorder, has_3d_structure, is_organometallic, is_polymeric, is_organic, r_factor, molecular_weight]
        """
        restrictions = {"hbond_donors":[None, 5], "hbond_acceptors":[None, 10], "has_disorder":[0, 0], "has_3d_structure":[1, 1], "is_organometallic":[0, 0], "is_polymeric":[0, 0], "is_organic":[1, 1], "r_factor":[0, 15], "molecular_weight":[150.0, 600.0]} #"temperature":[150, 310]}
        _, _, df = db.get_success_data(idx, dataframe=True)
        primary_key = db.primary_key_for(idx)
        for rest in restrictions: 
            df = table(df).apply_rest(rest, restrictions[rest])
        if self.ligand is None:
            self.ligand  = df 
        else:
            self.ligand = self.ligand & df

        folder_name = db.get_folder(idx)
        self.ligand_folder = '{}_{}'.format(idx, folder_name)
        self.data_type = 'csd'        
        return self
Пример #7
0
    def exclusion(self, ex_idx):
        '''
        load the ligand that should be exclude from table with idx: ex_idx
        Args:
            ex_idx: int

        Returns: self

        '''

        _, _, df = db.get_success_data(ex_idx, dataframe=True)
        primary_key = db.primary_key_for(ex_idx)
        df = df[primary_key]
        df = table(df)

        if self.exclude is None:
            self.exclude = df
        else:
            self.exclude = self.exclude | df

        return self
Пример #8
0
    def nondruglike_molecules(self, idx):
        """
        Restrictions are in order of [hbond_donors, hbonds_acceptors, has_disorder, has_3d_structure, is_organometallic, is_polymeric, is_organic, r_factor, molecular_weight]
        """
        restrictions = {"hbond_donors":[None, 5], "hbond_acceptors":[None, 10], "has_disorder":[0, 0], "has_3d_structure":[1, 1], "is_organometallic":[0, 0], "is_polymeric":[0, 0], "is_organic":[1, 1], "r_factor":[0, 15], "molecular_weight":[150.0, 600.0]} #"temperature":[150, 310]}
        _, _, df_all = db.get_success_data(idx, dataframe=True)
        primary_key = db.primary_key_for(idx)
        df_drugs = df_all.copy()
        for rest in restrictions: 
            df_drugs = table(df_drugs).apply_rest(rest, restrictions[rest])
        df_merge = df_all.merge(df_drugs, indicator=True, how='outer')
        df_nondrug = df_merge[df_merge['_merge'] == 'left_only']
        if self.ligand is None:
            self.ligand  = df_nondrug 
        else:
            self.ligand = self.ligand & df_nondrug

        folder_name = db.get_folder(idx)
        self.ligand_folder = '{}_{}'.format(idx, folder_name)
        self.data_type = 'csd'        
        return self