Exploring the heterogeneity of immune response to viral and bacterial infection