def get_manual_homology_models(self, input_dict, outdir=None, clean=True, force_rerun=False):
        """Copy homology models to the GEM-PRO project.

        Requires an input of a dictionary formatted like so::

            {
                model_gene: {
                                homology_model_id1: {
                                                        'model_file': '/path/to/homology/model.pdb',
                                                        'file_type': 'pdb'
                                                        'additional_info': info_value
                                                    },
                                homology_model_id2: {
                                                        'model_file': '/path/to/homology/model.pdb'
                                                        'file_type': 'pdb'
                                                    }
                            }
            }

        Args:
            input_dict (dict): Dictionary of dictionaries of gene names to homology model IDs and other information
            outdir (str): Path to output directory of downloaded files, must be set if GEM-PRO directories
                were not created initially
            clean (bool): If homology files should be cleaned and saved as a new PDB file
            force_rerun (bool): If homology files should be copied again even if they exist in the GEM-PRO directory

        """
        if outdir:
            outdir_set = True
        else:
            outdir_set = False

        counter = 0
        for g in tqdm(self.genes):
            if g.id not in input_dict:
                continue

            if not outdir_set:
                outdir = g.protein.structure_dir
                if not outdir:
                    raise ValueError('Output directory must be specified')

            for hid, hdict in input_dict[g.id].items():
                if 'model_file' not in hdict or 'file_type' not in hdict:
                    raise KeyError('"model_file" and "file_type" must be keys in the manual input dictionary.')

                new_homology = g.protein.load_pdb(pdb_id=hid, pdb_file=hdict['model_file'],
                                                  file_type=hdict['file_type'], is_experimental=False)

                if clean:
                    new_homology.load_structure_path(new_homology.clean_structure(outdir=outdir, force_rerun=force_rerun),
                                                     hdict['file_type'])
                else:
                    copy_to = op.join(outdir, op.basename(hdict['model_file']))
                    if ssbio.utils.force_rerun(force_rerun, copy_to):
                        # Just copy the file to the structure directory and store the file name
                        log.debug('{}: copying model from original directory to GEM-PRO directory'.format(op.basename(hdict['model_file'])))
                        shutil.copy2(hdict['model_file'], outdir)
                        new_homology.load_structure_path(copy_to, hdict['file_type'])
                    else:
                        log.debug('{}: homology model already copied to directory'.format(copy_to))
                        new_homology.load_structure_path(copy_to, hdict['file_type'])

                # TODO: need to better handle other info in the provided dictionary, if any
                new_homology.update(hdict)

                log.debug('{}: updated homology model information and copied model file.'.format(g.id))
            counter += 1

        log.info('Updated homology model information for {} genes.'.format(counter))
def get_manual_homology_models ( self , input_dict , outdir = None , clean = True , force_rerun = False ) : if outdir : outdir_set = True else : outdir_set = False counter = 0 for g in tqdm ( self . genes ) : if g . id not in input_dict : continue if not outdir_set : outdir = g . protein . structure_dir if not outdir : raise ValueError ( 'Output directory must be specified' ) for hid , hdict in input_dict [ g . id ] . items ( ) : if 'model_file' not in hdict or 'file_type' not in hdict : raise KeyError ( '"model_file" and "file_type" must be keys in the manual input dictionary.' ) new_homology = g . protein . load_pdb ( pdb_id = hid , pdb_file = hdict [ 'model_file' ] , file_type = hdict [ 'file_type' ] , is_experimental = False ) if clean : new_homology . load_structure_path ( new_homology . clean_structure ( outdir = outdir , force_rerun = force_rerun ) , hdict [ 'file_type' ] ) else : copy_to = op . join ( outdir , op . basename ( hdict [ 'model_file' ] ) ) if ssbio . utils . force_rerun ( force_rerun , copy_to ) : log . debug ( '{}: copying model from original directory to GEM-PRO directory' . format ( op . basename ( hdict [ 'model_file' ] ) ) ) shutil . copy2 ( hdict [ 'model_file' ] , outdir ) new_homology . load_structure_path ( copy_to , hdict [ 'file_type' ] ) else : log . debug ( '{}: homology model already copied to directory' . format ( copy_to ) ) new_homology . load_structure_path ( copy_to , hdict [ 'file_type' ] ) new_homology . update ( hdict ) log . debug ( '{}: updated homology model information and copied model file.' . format ( g . id ) ) counter += 1 log . info ( 'Updated homology model information for {} genes.' . format ( counter ) )
Copy homology models to the GEM-PRO project.

        Requires an input of a dictionary formatted like so::

            {
                model_gene: {
                                homology_model_id1: {
                                                        'model_file': '/path/to/homology/model.pdb',
                                                        'file_type': 'pdb'
                                                        'additional_info': info_value
                                                    },
                                homology_model_id2: {
                                                        'model_file': '/path/to/homology/model.pdb'
                                                        'file_type': 'pdb'
                                                    }
                            }
            }

        Args:
            input_dict (dict): Dictionary of dictionaries of gene names to homology model IDs and other information
            outdir (str): Path to output directory of downloaded files, must be set if GEM-PRO directories
                were not created initially
            clean (bool): If homology files should be cleaned and saved as a new PDB file
            force_rerun (bool): If homology files should be copied again even if they exist in the GEM-PRO directory