Implementation of remote monitoring and diffraction evaluation systems at the Photon Factory macromolecular crystallography beamlines

At the Photon Factory macromolecular crystallography beamlines, two new functions, remote monitoring and diffraction image evaluation, have been developed and installed on the beamline controlling system STARS (simple transmission and retrieval system).


Introduction
The technique of high-throughput crystallography has advanced drastically in recent years, and currently it is possible to examine a large number of samples in a short period of time. As a result, researchers' visits to the beamlines have become more frequent, and the number of samples assessed by a given researcher has increased even further. Consequently, it is essential to develop an efficient beamline control system for use by researchers. In the past few years, the Photon Factory (PF) has constructed several high-throughput macromolecular crystallography beamlines, and made consistent efforts to automate experimentation. These efforts include the development of a sample exchange robot and a beamline control system Matsugaki et al., 2006;Hiraki et al., 2006;Gaponov et al., 2004). In order to enhance the productivity of researchers at the PF beamlines, it has been necessary to develop two new functions, remote monitoring and diffraction image evaluation. Remote monitoring is a system that enables users to monitor their experiments from outside the facility. This has great advantages, in that collaborators and expert researchers who could not come to a beamline can nonetheless participate in the experiment and provide useful input in real time. Furthermore, this technology raises the possibility that users might simply send the samples to the beamline, where beamline staff could conduct experiments in consultation with the remote user. Remote monitoring systems have already been implemented in some facilities, with some success (Ueno et al., 2005;Skinner et al., 2006;Gonzá lez et al., 2008). Diffraction evaluation is a system that processes the diffraction images and displays the results in the beamline control software. In the experiment using a sample exchanger, the number of samples is enormous, and this system helps a great deal in screening for diffraction-quality crystals.
These two new functions are closely related to the beamline control system, and therefore consistency among them is crucial for successful implementation. Here we show how these two systems were developed and installed onto our existing beamline control system, STARS (simple transmission and retrieval system; Kosuge et al., 2002).

STARS system
2.1. Overview of the STARS system STARS is a transferring message software with a TCP/IP socket, originally developed by the interlock group within PF (Kosuge et al., 2002). STARS consists of client programs (STARS clients) and a server program (STARS server); each client is connected to the server via a TCP/IP socket. Upon communication between two clients, a client sends a command or an event to the server. The server interprets the message and sends it on to the appropriate client(s).

Application to the beamline control system
The configuration of the STARS system at the PF macromolecular beamlines is shown in Fig. 1. In each beamline, one STARS server is running, and STARS clients are connected to this server. There are three types of clients: user, motor and system. The user client is a user interface for experiments at beamlines, and sends experimental commands to the motor client. We have been developing two clients, UGUI and PCCS, in parallel. The former is a simple user interface, coded in Perl, and the latter is a database-oriented beamline control application (Gaponov et al., 2004). The motor client is responsible for controlling low-level devices in beamlines. When a motor client receives a command from a user client, the motor client moves device(s) according to the command and sends event messages to the STARS network to report their status. The system client, MASTER CNTL, is a special client that evaluates whether a user client has permission to send a command.

Configuration
The remote monitoring system consists of two components, a STARS client and a web server (Fig. 2a). A STARS client, called REPORTER, is connected to the STARS server in each beamline and watches the message transfers on the STARS network in that beamline. Each REPORTER client stores the status of all devices at its own beamline. Because all motor clients send the status of devices as an event message when a device is moved, REPORTER can keep this device status data up-to-date. Once a command for an experiment (e.g. snapshot, take a snapshot; runs, collect a data set; or xafs, scan heavy atom fluorescence) is submitted by a user client, REPORTER writes an XML file containing the experimental condition, device status and relevant data files (Fig. 2b) Configuration of the beamline control system on STARS. There are three types of clients: user, motor and system. Each motor client has a distinct function and is responsible for the control of low-level devices, which are listed in boxes. In this work, two new clients, REPORTER and PROCESSOR (indicated by red letters), have been developed for remote monitoring and diffraction image evaluation, respectively. (a) Scheme of the remote monitoring system. REPORTER watches messages on STARS; when a command for an experiment is submitted by a user client, it writes out the experimental conditions and device information to an XML file. The web server picks up the appropriate entries of experiments in the XML file according to userid and sends them to the user interface via the Internet. The web server has access to all local storage devices placed at each beamline. Note that the STARS network is on the PF beamline network and not directly connected to the Internet, and the web server is connected to both the beamline network and the Internet. (b) XML description of experiments. In this example, there are two entries of experiments, snapshot and runs (data-set collection). server refers to the XML file and sends experimental information in the file according to a request from a web client, i.e. the user's web browser, via the Internet. The web browser shows lists of experiments; by clicking one of the experiments, a user can see details of the resulting data, such as images, pictures and plots (described below). While REPORTER exists on every beamline's STARS network, the web server exists only on the central server in the PF beamline network, and the server refers to all XML files produced by all REPORTER instances at all beamlines. Consequently, the central server is able to monitor experiments at all beamlines by accessing the web server.

User authentication and security
Because the remote monitoring system displays experimental information on the Internet, it is very important to include a valid user authentication in the system, otherwise anybody in the world could see a beamline user's experiment and results. To use the remote monitoring system, users are required to undergo a log-in process. In our beamlines, user authentication in Linux and Windows is unified in an LDAP/Samba system, and the web server can also refer to the authentication information on the LDAP server, so that users can log-in to the remote monitoring system with their beamline user ID and password. In the XML file written by REPORTER, each entry (experiment) has a userid element and the web server sends only the entries that have the same userid element as the userid logged in. The communication between the web server and client is performed by secure protocol with SSL to prevent unauthorized access.

Rich interface web application
The user interface of the remote monitoring system is performed with AJAX (Asynchronous JavaScript + XML) technology, which allows a web application to be more interactive. The aim of the AJAX technology is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user requests a change. Regardless of the specific web application, users can browse lists of experiments and apply many kinds of query very smoothly. Furthermore, the user interface can display data resulting from an experiment, e.g. diffraction images, energy scanning plot and so on. Because the web server has access to all local storage devices placed at each beamline, according to the element datasection in the XML file, the server can take raw data from storage, compress it to the image format suitable for data transfer and send it to the web client where the web application is running. With this application, for example, remote users can examine diffraction images as closely as if they were on site.

Diffraction image evaluation
We have also developed PROCESSOR, a STARS client for diffraction image evaluation. PROCESSOR functions as an interface between the beamline control system and diffraction image processing software (Fig. 3a). When a command for evaluation is received from a user client, PROCESSOR interprets the command and its parameters and makes a script file for the diffraction image processing software. The script file is executed and the processing software outputs the results as a log file. PROCESSOR interprets the log file and sends the results as an event message on STARS. Three types of image analyses (counting peaks, auto-indexing and determining the optimal data-collection strategy) are available, and in each command there is a parameter to select processing software. Currently, PROCESSOR can handle script and log files for major data-processing software such as Mosflm (Leslie, 1992), HKL2000 (Otwinowski & Minor, 1997), XDS (Kabsch, 1993), SPOTFINDER/DISTL (Zhang et al., 2006), LABELIT (Sauter et al., 2004), BEST (Popov & Bourenkov, 2003). The selection of processing software on the STARS command is relatively important for users (especially in industry) who may only have licences for certain software. PROCESSOR is coded in Perl and runs on a Linux PC with two Xeon 3.2 GHz CPUs and a 1.0 GB main memory.

Summary
We have developed two new functions, remote monitoring and diffraction image evaluation, and successfully adapted them to our beamline control system (STARS). Trials of the use of these two functions will begin in October 2007. The structures of these two functions have been designed to be flexible, so that an extension of their functions may be performed easily. Current developments should lead to the further enhancement of productivity of the PF beamlines. The remote monitoring system will lead to our next challenge, full remote access.
We would like to thank Mr Ikuta, Ms Sasajima and Dr Gaponov who have developed software for beamline control. We also would like to thank Mr Kosuge who is the developer of the STARS system and helps with the system development. This work was supported in part by Grants-in-Aid for Scientific Research from the Ministry of Education, Culture, Sports, Science and Technology (MEXT) of  (a) Scheme of the diffraction image evaluation system. When a user client submits a command for evaluation, PROCESSOR prepares a script file for the imageprocessing software, according to the attached parameters, and executes it. After the analysis by the processing software, PROCESSOR interprets the log files and sends the results on STARS as an event message. (b) Example of STARS messages. Before sending the 'strategy' command to PROCESSOR, a user client (UGUI) should send the 'setdir' command to tell two directories where images exist and where log files should be written.