how to figure out pin numbers on expansion board and gpio pin in software

I want to read input from a switch.But I am unable to calculate gpio number based on physical pin on expansion connector.Please help me.