Epilepsy. The representation of ordinary people about this disease consists of many myths and prejudices. Often, even the patients themselves are at the mercy of such preconceptions, one of which is that epilepsy is incurable. However, the right medicines can help a person start a new life - without a disease.
About the platform designed to test the latest drugs against epilepsy, and how EPAM has to do with it, read further in the article.
')
Causes and Prejudices
Epilepsy is one of the most common neuropsychiatric diseases, characterized by recurring seizures leading to impaired motor, sensory, autonomic or mental functions and resulting from excessive discharges of nerve cells in the cerebral cortex. According to the World Health Organization, around 50 million people worldwide suffer from epilepsy; 80% of them live in developing countries.
The most common type is idiopathic epilepsy, that is, having no established causes. Most often in this case, the disease is genetically determined. The causes of secondary epilepsy can be abnormalities of brain development, traumatic brain injuries, including a strong blow to the head, neuroinfection, stroke, neoplasms.
Epilepsy is a disease known since ancient times and surrounded by numerous mysteries. In ancient Greece and Rome, it was associated with magic and called the “holy disease” - it was believed that in this way the gods punished people leading an unrighteous lifestyle. Hippocrates, the greatest doctor of antiquity, believed that seizures are provoked by the sun, wind and cold, which change the consistency of the brain. In the Middle Ages, the disease bowed, as many great people, saints and prophets suffered from this disorder. At the same time, they were afraid of the disease, since it was believed that it was incurable and was transmitted through the patient's breath during an attack.
Currently, the attitude towards epilepsy is also rather ambiguous. Patients have incomplete access to health insurance and life insurance, they are deprived of the opportunity to get a driver's license and, among other things, face obstacles when applying for certain types of work. In the laws of many countries there is discrimination against people suffering from this disease. For example, in China and India, epilepsy is considered a sufficient basis for prohibiting or canceling marriages, and until the 1970s in the United States could legally be denied access to public buildings. In Russia, this diagnosis is an absolute contraindication for work as a teacher, actor, in the medical and military fields. Getting an education, playing sports, creating a family, attending extra classes - this is an incomplete list of the limitations that patients face. And, as a rule, these restrictions are made up and exaggerated.
Experts of the World Health Organization believe that with adequate treatment, approximately 70% of patients may have no seizures. This means that the sick will not differ from other people.
AccelEpi - winner of the Bio-IT World Best Practices Awards
In order to improve the quality of life of patients with epilepsy, ongoing work is underway to improve the formulas of drugs, as well as the creation of new drugs. The process of developing a new tool lasts about ten years and includes numerous stages of testing. As a rule, testing is carried out on animals, usually in mice. However, in the case of the development of drugs against epilepsy, significant difficulties arise - this disease does not occur in mice. However, seizures in rodents can be caused. Moreover, there are technologies that allow to stimulate the appearance in mice of spontaneous epileptic seizures for a long time, which most accurately reflects the course of epilepsy in humans.
The
EPAM Life Science team has developed the
AccelEpi platform, a hardware-software complex for the automatic detection and registration of epileptic seizures in rodents based on accelerometric data. This is the first solution in the world that allows automatic detection of seizures in a non-invasive way.
The platform helped the customer to move from measuring the ability of the tested drugs to suppress single induced seizures to proactively monitoring how these drugs affect the rate of natural seizures in conditions close to real.
Creating a platform: the reasons
Drug testing is as follows. A large number of rodents are stimulated by the appearance of seizures, then they are divided into two groups: the first one begins to inject the test drug, and the second acts as a control. The experiment lasts at least two to three weeks. After this time, scientists analyze the frequency and nature of the occurrence of seizures in both groups and draw conclusions. However, in order to study the changes in the occurrence of seizures, they must be detected. One of the fundamentally possible ways is the analysis of an encephalogram - an expensive option that requires implantation of electrodes into the brain of each mouse. In addition, prolonged attachment of the electrode and the swivel cable on animals' heads can lead to undesirable changes in their behavior.
There is an alternative: an experienced specialist can identify seizures by viewing the video. But here lies the main difficulty: you need to look at 64 - as many mice are used for the experiment - a video of three weeks duration. And this is 32256 hours! Even if you view the recording in accelerated mode, the process takes too much time.
The customer had an idea how to realistically detect seizures for a long period of time. Since the animal is moving in a very specific way during an attack, it was suggested to use an accelerometer, which is easily mounted on the back of the animal, for software detection of seizure-like time intervals. In addition, it was proposed to record the video signal synchronously with the accelerometer signal - this would allow viewing suspicious areas to confirm or deny the presence of a seizure of a particular mouse at the considered moment. To implement his ideas, the customer turned to
EPAM Life Science .
What are the difficulties faced by the developers?
The
Life Science division faced a nontrivial new task of developing an algorithm that allows it to search for seizures using an accelerometric signal. In addition, the decision as a whole should meet the following requirements:
- Testing should be carried out without using an encephalogram.
- There should be simultaneous tracking of the behavior of all 64 animals over several weeks.
- The data provided by the platform must be as accurate (and even more accurate) as when viewed by a specialist.
- It should be possible to simultaneously view the video and accelerometer signal.
AccelEpi was created to solve all the tasks. The complex consists of 64 cells equipped with video cameras and devices for transmitting and recording accelerometric and video signals, as well as the program part.
The software part of the platform consists of three main components:
- A client for planning experiments, allowing to create and describe research on living organisms, manually record information about events in the laboratory, and remotely control the course of the experiment.
- The server for data collection and processing, which receives and processes accelerometer data every hour, identifies seizures and records information about the mouse's motor activity for a specified time.
- Client data validation, allowing scientists to view, verify and evaluate all attacks detected by algorithms, and enter the final results into the AccelEpi database.
Algorithms
The most difficult element in creating such a platform is an algorithm analyzing the accelerometer signal and highlighting areas that resemble seizures, accurate to a second. Typically, an attack occurs once a day and lasts a maximum of two minutes.
The recognition of an attack by the algorithm takes place on the basis of data on the behavior of rodents during a seizure and passes through the following stages:
- Preliminary data processing. At this stage, the signal is smoothed and the noise level in it is reduced using a Butterworth bandpass filter and emission removal techniques.
- The main stage of seizure recognition (immobility stage). This is where seizure is detected using the hidden Markov model.
- Recognition of the stages preceding and following the stage of immobility. Here the seizure boundaries are more clearly indicated, allowing you to determine the duration of the attack. To determine the transition points used CUSUM - method.
- Stage of decision making. Based on some penalty function, the algorithm determines how much a given sequence is similar to the patterns of seizures in the database.
The determining stage in the process is the recognition of the period of immobility, so let's move on to it immediately.
Calculation of distinctive features
In conditions of lack of training data, it was necessary to select the minimum number of variables. Based on the analysis of the possibilities offered by the various available numerical characteristics of the accelerometer signal, the following were chosen for use:
- Average adaptive frequency.
- The variation of the signal.
To calculate the first characteristic, the following formulas are used:
where
s (t) is the initial signal,
w (t) is the average frequency,
f (t) is the signal value after passing through the Butterworth filter,
df (t) is the derivative of the signal after passing through the filter,

- constant values,
t is a discrete time measured at time points,
r (t) is an additional variable that evaluates the performance of the gradient. It is known that r (0) = f (0) = df (0) = 0. Suppose that
t begins with one, then all variables are zero for all negative values of
t .
The second characteristic is calculated by the following formula:
where
n is the number of points in time for the selected interval, in our case
n = 500 points.
Seizure identification
For recognition of seizures, a hidden Markov model was used with the following characteristics and parameters:
- The number of hidden states N and the set of states S. In our case there are three such states:

- Stationary probabilities of the state transition matrix:
This characteristic contains six unknown parameters. - The distribution of the observed characteristics for each of the states. In our case, the vector of the observed feature is a two-dimensional Gaussian vector, and we must estimate 15 additional parameters (the mean value and the covariance matrix for each state):

- The initial probability of observing the process in each of the states:

Possible values for all parameters mentioned above were calculated using the following formulas:
where a tilde over
x means an estimate of the corresponding parameter x of the model;

- the observed value of the characteristic
p at time
t ;
S (t) - expert assessment of the mouse state at time
t ;
I (A) is equal to the true value of the expression
A , that is, it is equal to 1 when
A is true, or 0 when it is false;
n is the size of the training sequence.
We needed to develop a separate algorithm for the twelve-hour period with light and the twelve-hour period without light.
The final state classification is made in accordance with the Viterbi algorithm.
What is the result
AccelEpi allowed the customer, for the first time in practice, to track the occurrence of epileptic seizures in a significant number of mice for a long time and conduct testing of drugs against epilepsy in the volumes necessary for research projects in the pharmaceutical industry.
The system has a significantly lower cost of the experiment compared to a hypothetical analysis in manual mode: to process the results of the six-week experiment on 64 mice, 14 man-days instead of 360 are required with full viewing (subject to video acceleration 6 times). The seizure recognition algorithm demonstrated greater accuracy of the recognition results on the data set for validation than two of the three experts were able to show, and allowed the use of true models of disease development in the projects.
Afterword
New opportunities for drug testing will make the development of antiepileptic drugs more effective. And, therefore, improve the quality of life of patients with epilepsy, opening up opportunities for them that were previously inaccessible.
The project team:
Development of the recognition algorithm -
Vladimir Schwartz and
kokorins Sergey Kokorin .
Creating a technological complex -
Vladimir Davydov ,
Dmitry Robin and
Mikhail Serkov .