Pathway analysis algorithm