Rank-based inference for conditional independence and its applications