Valve to piston clearance?

Ok I have been doing alot of reading and research on this topic and everything I see is how to check it after the engine is already assembled. Is there any formula or calculations to check and make sure you will have adequate clearance before you start buying parts? For example I have a piston a goal compression and a cam chosen that I want to use how can figure out if it will work without buying it and test fiting it?