Saline solution was injected into the jaw muscle, which produces moderate pain for 20 minutes, but no lasting harm.
The level of pain was adjusted for each person until it was, for them, a four on a scale of one to 10.
These subjects rated the positivity or negativity of their feelings both before and after the pain challenge.
Those with low NPY were more negative both before and after the pain – meaning they were more emotionally affected while anticipating the pain and while reflecting on their experience immediately afterward.
Lastly, scientists compared NPY levels with major depressive disorders to see if there was an association between the condition and low expression of NPY.
Subjects with low-expression of NPY were more likely to suffer depression, it was found.
Dr Brian Mickey, a psychiatrist and lead author, said: "We hope they can guide us toward assessing an individual's risk for developing depression and anxiety."
The findings are published in the Archives of General Psychiatry.