Analysis with Wavelets of Electrocardiographic Alterations in Chronic Chagas Patients

In this work, an algorithm was created to detect the characteristics of the electrocardiographic signal (ECG) of chronic Chagas patients from the State of Meta, Colombia and records of healthy people, using the Daubechies 5 wavelet (db 5), as an alternative way in the Fourier analysis for this type of signals. A database of 32 ECG records was created using a single channel with a 16-bits high resolution polygraph. This algorithm allowed the identification of the most important characteristics of each ECG record of patients with the disease, measuring the intervals and amplitudes of the waves and heart rate with an accuracy greater than 91%, becoming a tool for a better diagnosis of the symptoms of chronic Chagas disease.


Introduction
Chagas disease (American Trypanosomiasis) is produced by a parasite called Trypanosoma cruzi, this parasite is transmitted by vectors called blood-sucking triatomine insects (triatominae infestans and Rhodnius prolixus) among others, the vector insect is commonly known as "blood-sucking bedbug" (kissing bugs).An already infected insect sucks the blood of its victim and defecates on the wound that it produces, in the feces of the vector is the parasite which gets through the wound into the bloodstream from the gut of the insect to the human (starting the acute phase of the disease that can last from a few weeks to months) and stays there for a long period of time, then enters the cells of the heart and there it is developed, mainly affecting the myocardium [4].Another mode of transmission is through blood transfusions, organ transplants or congenitally.Of the total of people infected, it is estimated that 37% of them develop chronic heart problems and therefore high probability of sudden death from this cause, many of them without being able to get even a diagnosis [6,9].This condition is reflected in the size of the heart increased, heart weakness, arrhythmias, chest pain, dilated cardiomyopathy, disability and it also affects the transmission system of the heart electrical impulses.The parasite is also transmitted by the vector not only to humans who act as a host, but also to mammals surrounding man and the symptoms are very similar in them [8].In Chagas disease, after being infected a person can take between 10 to 20 years in a dormant period or indeterminate phase (without symptoms).Then the parasite develops in the cells of the heart, and is when the patient enters the chronic phase, with complicated heart conditions such as severe diffuse cardiomyopathy [7].After taking an electrocardiogram (ECG) of a patient with chronic Chagas disease, it is not always so easy to observe diffuse alterations in ventricular repolarization (ADRV), arrhythmias, ventricular extra-systoles or Premature Ventricular Contraction (PVC), as changes in time and amplitude of the complex QRS, blockages in the internal transmission of the electrical impulse of the heart, that is, changes in the electrocardiogram [1,3].ECG signals are time-varying, non-stationary and usually affected by noise (muscle tremor, appliances and home network), they are also very weak signals, in the order of millivolts (mV) and fractions of millivolts.
To solve these problems the Fourier transform has been used as a tool for a long period of time for analysis of these signals, however this tool is deficient because the electrocardiogram presents different frequency components and furthermore it is not a stationary signal.Currently the wavelet transform is being used as an alternative tool to supplement the deficiencies in the Fourier transform.Thus, the ECG signal analysis has been using wavelet analysis due to its high resolution capabilities to display and analyze signals or images [2].It also has been used to reduce electrical noise in the ECG, QRS detection and measurement of heart rate [1].The ECG signal reflects the electrical function of the heart, it has the advantage of being a medical procedure with results immediately available, and it is non-invasive and inexpensive.For heart disease diagnosis purposes it is of great value.Electrocardiographic records are studied by cardiologists, for them some difficulties differentiating or highlighting electrocardiographic changes in these records are sometimes present, so, an analysis was carried out with the wavelet transform that works as a support for a diagnosis of this disease.Therefore this work consisted in developing an algorithm to solve this problem.A wavelet function is used, the Daubechies 5 (db5) which best suits the application of a multiresolution analysis along with a baseline filtering, due to the similarity of function db5 with the ECG signal studied, to do this an algorithm is developed in MATLAB, with a high degree of flexibility and the ability to test several wavelet functions and choose the one that has less margin for error in the analysis and synthesis of each ECG recording.A modified algorithm of Pan-Tompkins is also used [8] to determine the QRS complex, T wave, onset and duration of the QT interval, heart rate is also calculated in order to help diagnose when a patient actually has the electrocardiographic characteristics of Chagas disease.Other studies using mathematical models to study this phenomenon are found in [5,10].

Wavelets
In this section, we briefly review the orthonormal bases of compactly supported wavelets and set our notation.For the details we refer to [2].The orthonormal basis of compactly supported wavelets of is formed by the dilation and translation of a single function by The function has a companion, the scaling function , and these functions satisfy the following relations: , , where the coefficients are a sequence of real or perhaps complex number called the scaling function coefficients and .
The wavelet basis induces a multiresolution analysis on , that is, the decomposition of the Hilbert space into a chain of closed subspaces such that and .
The orthogonal complement of in is defined as , that is, , this means that all members of are orthogonal to all members of .We require , for all appropriate .The space is represented as a direct sum .
On each fixed scale j, the wavelets form an orthonormal basis of and the functions form an orthonormal basis of .We have now constructed a set of functions y that could span all of .Any function could be written as a series expansion in terms of the scaling function and wavelets.In this expansion, the first summation gives a function that is a low resolution or coarse approximation of .For each increasing index j in the second summation, a higher or finer resolution function is added, which adds increasing detail.

Materials and methods
A study of the carriers of chronic Chagas disease was made by requesting the Health Secretary of the State of Meta for data about patients carrying the parasite (Trypanosoma cruzi) who had already been diagnosed positive carriers of the parasite.These were patients from the region ranging between their 40s and 60s, of both sexes.Also, ECG samples of healthy people were taken in order to compare the flexibility and efficiency of the algorithm developed for this purpose.With the cooperation of a specialist in electrophysiology, an ECG of each patient was taken with ADInstruments brand equipment model PowerLab 8/30 with 8-channels and a 16 bit A/D converter, located in the facilities of the Electrophysiology Laboratory at the Universidad de los Llanos in the State of Meta during 2010 and 2011.Thirty-two (32) records for the derivative D II were taken, with different sampling rates, mostly 2000 samples/second, 1mV and 2mV amplification.Once each ECG record is taken, the equipment performs an A/D conversion, besides, it performs a filtering from 0.5 Hz. to 50 Hz., this because the waves (P, QRS and T) which make up the ECG are in this frequency range.Each sample was decomposed to level 11 using the Discrete Wavelet Transform (DWT) and the multiresolution analysis to level eleven (11).In the decomposition and reconstruction, different wavelet functions were tested and the ones that showed the best results were the Daubechies wavelets and particularly the db5 one, due to its fading times (5 times) and to its similarity with the ECG signal [2].It is remarkable that the same wavelet must be used for the decomposition as well as for the reconstruction when minimal error is needed.In this stage, each sample is standardised and also with a sampling rate of 2000 samples/s, involving the need for a total of eleven (11) decomposition levels (2 11 ) to get to the low frequency component of 0.9 Hz (linebase noise frequency) which is an interference due to patient breathing during the ECG recording or movements of the same.
At this stage the Pan-Tompkins algorithm was adapted, with this Pan-Tompkins algorithm [8] QRS complex was detected, which is a basic algorithm, but in this work it was necessary to modify and complement it in order to identify P and T waves, too (its amplitude in mV.), its start and end, the QT interval (Q wave onset and end of the T wave) and QTc (corrected QT) and heart rate obtaining high effectiveness at the moment of analyzing all the samples collected, despite the inhomogeneity of the electrocardiographic records own of the Chagas disease, as observed in each one of them.To measure the QTc interval, the Bazett's formula was used, where is the QT interval corrected for heart rate, and RR is the interval from the onset of one QRS complex to the onset of the next QRS complex [1].The measurement of heart rate in beats per minute (BPM) was achieved by developing an algorithm after finding the values in the time axis corresponding to R peaks in each epoch (RR interval in milliseconds).The problem to detect the J point was tackled (end point of the S wave) and it was possible to identify and locate it in the time axis [3].With this procedure it was possible to obtain in most electrocardiographic samples of healthy people and Chagas patients, the value of time in milliseconds (ms) of the entire QRS complex.
Then it was preceded to the development of another algorithm for calculating the PR interval time, ranging from the start of the P wave to the beginning of the Q wave.This interval is very important in detecting 1st grade atrio-ventricular blockages.For this interval, a threshold of 200 ms.was set up [1] (red colour of the box is chosen if the measured time of the interval exceeds this value).

Applications of the algorithm
A graphic user interface (GUI: Graphic User Interface) was created and the algorithm was applied to all the epochs stored of all the electrocardiographic records of Chagas patients and healthy people, in each of them were obtained the most important features of the waves and amplitudes, also the time of the most representative intervals and they were compared to the results obtained with high-resolution equipment and the classification of a specialist in electrophysiology.The values of the amplitudes (mV), intervals (ms) and heart rate (BPM), of the epoch 0001 in Figure 1 are shown in data Table 1.

Results and discussion
After applying the algorithm and making an accuracy analysis to (10) epochs, measuring the amplitudes of the waves detected and the interval times together with the measurement of heart rate, it was obtained data Table 2.The Figure 2 shows some ECG epochs of a healthy person and a person with chronic Chagas disease.Based on data Table 2 accuracy of the algorithm applied to the epochs was averaged, in which the amplitudes were measured (mV) of the waves P, Q, R, S and T, the time (ms) of the intervals and heart rate in beats per minute [7].It was observed that there is a greater accuracy in the measurement of the heart rate due to the higher measured time interval (RR interval), which generates the smallest error measurement.The lowest accuracy was present in the measurements of the amplitudes of the waves because when recording the data with high resolution equipment, it did not filter the low frequency noise signal (baseline noise) whereas with the algorithm this filtering was performed and this caused variations in the amplitudes, especially of P and Q waves [1].As another result some electrocardiographic changes were identified by a specialist in the samples from Chagas patients in the chronic phase after applying the algorithm, this result is shown in Table 3.

Conclusions
With the present work it has been managed to develop an algorithm that facilitates professionals to identify the major components present in the ECG signals of pati-

Figure 1 .
Figure 1.Application of the algorithm to epoch 0001

Table 1
illustrates the data obtained with the algorithm applied to the Epoch 0001 and data obtained with high resolution equipment and the error calculation.It can be observed that the average accuracy in measurements of the amplitudes is 90.96%.The average accuracy in measurements of the intervals of 96.71% compared with 98.95% accuracy in the measurement of the heart rate (BPM).

Table 3 .
Electrocardiographic abnormalities in chronic Chagas disease patients * Some patients may present more than one abnormality simultaneously.