welcome to HealthcareMagic
since the lump is in mid rib and is very painful it can be a abscess
(which is less possible) and the most probable may be a rib fracture
which can be as a result of excess cough
during chest infection
.Also since the pain is more when taking deep breath so this possibility is more.Please consult your doctor to discuss and find the reason.