\section{Query Definition}


\subsection{Inputs}

The typical starting point for a Pharmit session is a ligand-receptor complex structure, although a ligand-only structure or pharmacophore query file may be used as well. A Pharmit session can be automatically initialized using any complex in the PDB by inputing the corresponding PDB accession code on the Pharmit main page and selecting how active site water molecules should be treated (ignored, as part of the receptor, or as part of the ligand).  The dropdown menu next to the box where a PDB code may be entered allows the user to select which ligand found in the PDB file should be used as the basis of the query.  

Alternatively, a user can upload their own complex, in which case the receptor and ligand structures must be in separate files; these are uploaded by clicking `Enter Pharmit Search' on the main page and then choosing `Load receptor' and `Load features' on the resulting page. Any file format supported by OpenBabel may be used. 
 Note that the query ligand must be pre-positioned within the binding site of the receptor - Pharmit does not perform docking.
Pharmit prepares the receptor by protonating it with OpenBabel, but no other modifications are made. Thus the user must decide whether there are missing residues that should be included, if the histidine protonation state is correct, or if any other structural changes to the receptor are necessary.  

Pharmit can also accept initiate queries without a receptor, either in the form of a ligand structure or an externally generated pharmacophore query file, but in this case features that require a receptor, such as energy minimization, will not be available.

\subsection{Pharmacophore Queries}
A pharmacophore \cite{Koes_2015rev,Yang_2010,Leach_2010} defines the essential features of an interaction. Importantly, a pharmacophore includes the spatial arrangement of these features. 
Features supported by Pharmit include hydrogen bond acceptors and donors,  negative and positive charges, aromatics, and hydrophobic features.
As shown in Figure~\ref{pharmfig}, a pharmacophore query specifies these features using tolerance spheres.  Compounds match if they can be positioned so that their corresponding features are located within these spheres. Some features can have additional constraints, such as size (number of atoms) for hydrophobic features and direction for hydrogen bonds and aromatics.

Pharmit will identify all pharmacophore features present in a provided ligand structure. If a receptor structure is provided, it will identify which of these features are relevant to the protein-ligand interaction using distance cutoffs between corresponding features on the receptor and ligand (e.g., a hydrogen donor on the ligand and acceptor on the receptor). Only the interacting features will be enabled. Alternatively, a pharmacophore query can be initialized using pharmacophore files in MOE \cite{moe}, LigBuilder \cite{Wang_2000}, LigandScout \cite{Wolber_2005}, PharmaGist \cite{Schneidman_Duhovny_2008} or Pharmer \cite{Koes_2011} query formats.  The features of the query can be interactively edited within the Pharmit interface as changes to the query editor are immediately reflected in the molecular viewer and clicking on a feature in the viewer selects it for editing, as shown in Figure~\ref{pharmfig}.

\subsection{Shape Queries}

Similarity of molecular shape is a common method of structure-based virtual screening \cite{Nicholls_2010}.  Pharmit uses the Volumetric Aligned Molecular Shapes (VAMS) \cite{vams} method of shape search, which uses inclusive and exclusive shape constraints to identify matching molecular shapes.  In Pharmit, inclusive constraints are specified using the shape of the provided ligand or by manually specified inclusion spheres. Inclusive constraints specify a minimum bound on the desired molecular shape; matching compounds will overlap these constraints. Exclusive constraints are specified using the shape of the provided receptor or by manually specified exclusion spheres.  Exclusive constraints are used to limit the desired molecular shape; matching compounds are prohibited from overlapping these constraints.  Both constraints are represented using voxelized volumes, as shown in Figure~\ref{shapefig}, and can be adjusted by growing or shrinking the constraint volume. A shape-first search with pharmacophore restraints is distinct from the commonly used ROCS with color shape method \cite{Hawkins_2007} as it does not optimize the position with respect to the pharmacophores.

