The study of the interrelationships between organisms and their environment, including the biotic and abiotic components.