Formation of bioorganic compounds in planetary atmospheres by cosmic radiation