Deductions & credits

The transactions are independent of each other. You might qualify for the capital gain home owners exclusion when you sell your home.