``Transient are all conditioned things'': when one discerns this with wisdom, then is one disgusted with ill; this is the path to purity.
``Sorrowful are all conditioned things'': when one discerns this with wisdom, then is one disgusted with ill; this is the path to purity.
``All Dhammas are without a self'': when one discerns this with wisdom, then is one disgusted with ill; this is the path to purity. Dhammapada v. 77-79

His Holiness the Dalai Lama

Suffering originates from various causes and conditions. But the root
cause of our pain and suffering lies in our own ignorant and undisciplined state
of mind. The happiness we seek can be attained only through the purification
of our minds.

In Tibet we say: “Negative action has one good quality: it can be purified.” So there is always hope. Even murderers and the most hardened criminals can change and overcome the conditioning that led them to their crimes. Our present condition, if we use it skillfully and with wisdom, can be an inspiration to free ourselves from the bondage of suffering.

Imagine that you had gone all your life without ever washing, and then one day you decide to take a shower. You start scrubbing away, but then watch in horror as the dirt begins to ooze out of the pores of your skin and stream down your body. Something must be wrong: You were supposed to be getting cleaner and all you can see is grime. You panic and fling yourself out of the shower, convinced that you should never have begun. But you only end up even more dirty than before. You have no way of knowing that the wisest thing to do is to be patient and to finish the shower. It may look for a while as if you are getting even dirtier, but if you keep on washing, you will emerge fresh and clean. It’s all a process, the process of purification.
Whenever doubt arises, see it simply as an obstacle, recognize it as an understanding that is calling out to be clarified or unblocked, and know that it is not a fundamental problem but simply a stage in the process of purification and learning. Allow the process to continue and complete itself, and never lose your trust or resolve. This is the way followed by all the great practitioners of the past, who used to say: “There is no armor like perseverance.”

The
best solution to purify the karma of having depression is to do
the purification practice of Vajrasattva.
As long as the karma isn't purified, you'll continue to suffer
from depression again in future lives.Lama Zopa Rinpoche