Package: aposteriori
Protein Structures Voxelisation for Deep Learningaposterioriis a library for the voxelization of protein structures for protein design. It uses conventional PDB files to create fixed discretized areas of space called "frames". The atoms belonging to the side-chain of the residues are removed so to allow a Deep Learning classifier to determine the identity of the frames based solely on the protein backbone structure.InstallationPyPIComing soon...pipinstallaposterioriManual InstallChange directory to the aposteriori folder if you have not done so already:gitclonehttps://github.com/wells-wood-research/aposteriori/tree/mastercdaposteriori/Install aposterioripipinstall.Creating a DatasetThere are two ways to create a dataset usingaposteriori: through the Python API inaposteriori.make_frame_datasetor using the command line toolmake-frame-datasetthat
installs along side the module:make-frame-dataset/path/to/folderIf you want to try out an example, run:make-frame-datasettests/testing_files/pdb_files/Check themake-frame-datasethelp page for more details on its usage:Usage:make-frame-dataset[OPTIONS]STRUCTURE_FILE_FOLDERCreatesadatasetofvoxelizedaminoacidframes.Aframereferstoaregionofspacearoundanaminoacid.Foreveryresidueintheinputstructure(s),acubeofspacearoundtheregion(withanedgelengthequalto`--frame_edge_length`,default12Å),willbemappedtodiscretespace,withadefinednumberofvoxelsperedge(equalto`--voxels-per-side`,default=21).BasicUsage:`make-frame-dataset$path_to_folder_with_pdb/`eg.`make-frame-datasettests/testing_files/pdb_files/`Thiscommandwillmakeatinydatasetinthecurrentdirectory`test_dataset.hdf5`,containingallresiduesofthestructuresinthefolder.Globscanbeusedtodefinethestructurefilestobeprocessed.`make-frame-datasetpdb_files/**/*.pdb`wouldincludeall`.pdb`filesinallsubdirectoriesofthe`pdb_files`directory.Youcanprocessgzippedpdbfiles,buttheprogramassumesthattheformatofthefilenameissimilarto`1mkk.pdb.gz`.Ifyouhavemorecomplexrequirementsthanthis,werecommendusingthislibrarydirectlyfromPythonratherthanthroughthisCLI.Thehdf5objectitselfislikeaPythondict.Thestructureissimple:└─[pdb_code]Containsanumberofsubgroups,oneforeachchain.└─[chain_id]Containsanumberofsubgroups,oneforeachresidue.└─[residue_id]voxels_per_side^3arrayofints,representingelementnumber.└─.attrs['label']Three-lettercodefortheresidue.└─.attrs['encoded_residue']One-hotencodingoftheresidue.└─.attrs['make_frame_dataset_ver']:str-Versionusedtoproducethedataset.└─.attrs['frame_dims']:t.Tuple[int,int,int,int]-Dimentsionsoftheframe.└─.attrs['atom_encoder']:t.List[str]-Lablesusedfortheencoding(eg,["C","N","O"]).└─.attrs['encode_cb']:bool-WhetheraCbatomwasaddedattheavgpositionof(-0.741287356,-0.53937931,-1.224287356).└─.attrs['atom_filter_fn']:str-Functionusedtofiltertheatomsintheframe.└─.attrs['residue_encoder']:t.List[str]-Orderedlistofresiduescorrespondingtotheencodingused.└─.attrs['frame_edge_length']:float-LengthoftheframeinAngstroms(A)└─.attrs['voxels_as_gaussian']:bool-Whetherthevoxelsareencodedasafloatingpointofagaussian(True)orboolean(False)Sohdf5['1ctf']['A']['58']wouldbeanarrayforthevoxelized.

Options:
Options:-o,--output-folderPATHPathtofolderwhereoutputwillbewritten.Default=`.`-n,--nameTEXTNameusedforthedatasetfile,the`.hdf5`extensiondoesnotneedtobeincludedasitwillbeappended.Default=`frame_dataset`-e,--extensionTEXTExtensionofstructurefilestobeincluded.Default=`.pdb`.--pieces-filter-filePATHPathtoaPiecesformatfileusedtofilterthedatasettospecificchainsinspecificfiles.AllotherPDBfilesincludedintheinputwillbeignored.--frame-edge-lengthFLOATEdgelengthofthecubeofspacearoundeachresiduethatwillbevoxelized.Default=12.0Angstroms.--voxels-per-sideINTEGERThenumberofvoxelspersideoftheframe.Thiswillgiveafinalcubeof`voxels-per-side`^3.Default=21.-p,--processesINTEGERNumberofprocessestobeusedtocreatethedataset.Default=1.-z,--is_pdb_gzippedIfTrue,thisflagindicatesthatthestructurefilesaregzipped.Default=False.-r,--recursiveIfTrue,allfilesinallsubfolderswillbeprocessed.-v,--verboseSetstheverbosityoftheoutput,use`-v`forlowleveloutputor`-vv`forevenmoreinformation.-cb,--encode_cbBOOLEANEncodetheCbatanaverageposition(-0.741287356,-0.53937931,-1.224287356)inthealignedframe,evenforGlycineresidues.Default=True-ae,--atom_encoder[CNO|CNOCB|CNOCBCA]Encodesatomsindifferentchannels,dependingonatomtypes.DefaultisCNO,otheroptionsare´CNOCB´and`CNOCBCA`toencodetheCborCbandCaindifferentchannelsrespectively.[required]-d,--download_filePATHPathtocsvfilewithPDBcodestobevoxelised.Thebiologicalassemblywillbeusedfordownload.PDBcodeswillbedownloadedthe/pdb/folder.-g,--voxels_as_gaussianBOOLEANBoolean-whethertoencodevoxelsasgaussians(True)orvoxels(False).Thegaussianrepresentationusesthewanderwaal'sradiusofeachatomusingtheformulae^(-x^2)wherexisVx-x)^2+(Vy-y)^2)+(Vz-z)^2)/r^2and(Vx,Vy,Vz)isthepositionofthevoxelinspace.(x,y,z)isthepositionoftheatominspace,ristheVanderWaal’sradiusoftheatom.Theyarethennormalizedtoaddupto1.-b,--blacklist_csvPATHPathtocsvfilewithstructurestoberemoved.-comp,--compression_gzipBOOLEANWhethertocomrpessthedatasetwithgzipcompression.-vas,--voxelise_all_statesBOOLEANWhethertovoxeliseonlythefirststateoftheNMRstructure(False)orallofthem(True).-rot,--tag_rotamersBOOLEANWhethertotagrotamerinformationtotheframe(True)ornot(False).--helpShowthismessageandexit.Example 1: Create a Dataset Using Biological Units of ProteinsIdeally, if you are trying to solve the Inverse Protein Folding Problem
, you should use Biological Units as they are the minimal functional part of
a protein. This prevents having solvent-exposed hydrophobic residues as
training data.Download the dataset:ftp://ftp.ebi.ac.uk/pub/databases/pdb/data/biounit/PDB(European Server)
Alternative servers are available here (https://www.wwpdb.org/ftp/pdb-ftp-sites)To read more about biological units:https://pdbj.org/help/about-aubuandhttps://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assembliesOnce the dataset is downloaded, you will have a directory with sub-directory
containig the gzipped PDB structures (ie. your Protein Data Bank Files).To voxelize the structures into frames, run:make-frame-dataset/path/to/biounits/-e.pdb1.gzIf everything went well, you should be seeing the number of structures that
will be voxelised and a list of default parameters, to which you will press "y
" to proceed.Example 2: Create a Dataset Using Biological Units of Proteins and PISCESPISCES (Protein Sequence Culling Server) is a curated subset of protein
structures. Each file contains a list of structures with parameters such as
resolution, percentage identity and R-Values.Aposteriori supports filtering with a PISCES file as such:make-frame-dataset/path/to/biounits/-e.pdb1.gz--pieces-filter-filepath/to/pisces/cullpdb_pc90_res1.6_R0.25_d190114_chains8082If everything went well, you should be seeing the number of structures that
will be voxelised and a list of default parameters, to which you will press "y
" to proceed.DevelopmentThe easiest way to install a development version ofaposterioriis using Conda:CondaCreate the environment:condacreate-naposterioripython=3.8Activate it and clone the repository:condaactivateaposteriori
gitclonehttps://github.com/wells-wood-research/aposteriori.gitcdaposteriori/Install dependencies:pipinstall-rdev-requirements.txtInstall aposteriori:pipinstall.Check that aposteriori worksmake-frame-dataset--helpMake sure you test your install:pytesttests/Pip (only)Alternatively you can install the repository with pip:gitclonehttps://github.com/wells-wood-research/aposteriori.gitcdaposteriori/
pipinstall-rdev-requirements.txtInstall aposteriori:pipinstall.