With a 50K per year job you are simply not going to afford a 400K house without a HUGE down payment.
Make 50K,  pay Taxes etc, cost of living, car, gas, etc.  
At most you will save 20K to 30K per year (if you are frugal and have help from family.)
The old rule of thumb by lenders is that the long term debt to income ratio should never exceed 36% of income  (though banks may be a bit more liberal with their loans these days.)
The other old rule of thumb by lenders is that the Housing Expense-to-Income Ratio should be 28% or less of income (though again, banks may be a bit more liberal with their loans these days.)
Monthly housing expenses include payments for principal, interest, property taxes, hazard insurance, private mortgage insurance (if required), and condo or homeowner's fees (if required).
In my case,  I bought a 115K townhome last year with 0% down payment.  I had a credit rating around 750 and at the time I purchased,  I was making only about 40K per year.
That means that my long term debt to income ratio was about 28%
Principal, Interest, Property Taxes, Hazard insurance, and PMI add up to about 900 or so per month (and I managed to get a 4.25% ARM through my credit union)  On top of that,  My association dues are about 180 per month.
So my yearly housing expenses are just under 13,000.  
At the time I purchased,  I had a Housing Expense to Income ratio of 32.5%.
I haven't had any problems keeping up with payments at all,  though I have also recieved two raises totaling about 10% in that time as well.
So,  for a 400K home,   you would need to save/invest and live as cheap as you could for 5 to 10 years on a 50K income, until you came up with over 200K for the down payment.  It is possible though, with interest rates being low, and banks taking more risks, and offering "interest only" type of loans,  that you may possibly be able to qualify for bigger then a 200K loan,  though I am for from a morgage broker or loan expert.  I only know what I know from my own home purchase here in one of the cheaper burbs of Chicago.
(On the plus side,  my townhome is worth about 25K more now then when I purchased it.  It's actually increasing in value faster then in many of the less inexpensive towns.  Hopefully another year or two and I can afford to move closer to work and pick up a 200K SFH with a basement and garage (though at 200K, I would still need to drive 30 minutes + to/from work,  and I would probably only get 2 bedrooms as anything bigger is closer to 250K or above)