# Now need to make the gene samples and snp samples match up desired_samples = gene_samples num_haploids = len(desired_samples) # Calculate which pairs of idxs belong to the same sample, which to the same subject # and which to different subjects #desired_same_sample_idxs, desired_same_subject_idxs, desired_diff_subject_idxs = parse_midas_data.calculate_subject_pairs(subject_sample_map, desired_samples) # Calculate which pairs of idxs belong to the same sample, which to the same subject # and which to different subjects desired_same_sample_idxs, desired_same_subject_idxs, desired_diff_subject_idxs = parse_midas_data.calculate_ordered_subject_pairs( sample_order_map, desired_samples) snp_sample_idx_map = parse_midas_data.calculate_sample_idx_map( desired_samples, snp_samples) gene_sample_idx_map = parse_midas_data.calculate_sample_idx_map( desired_samples, gene_samples) same_sample_snp_idxs = parse_midas_data.apply_sample_index_map_to_indices( snp_sample_idx_map, desired_same_sample_idxs) same_sample_gene_idxs = parse_midas_data.apply_sample_index_map_to_indices( gene_sample_idx_map, desired_same_sample_idxs) same_subject_snp_idxs = parse_midas_data.apply_sample_index_map_to_indices( snp_sample_idx_map, desired_same_subject_idxs) same_subject_gene_idxs = parse_midas_data.apply_sample_index_map_to_indices( gene_sample_idx_map, desired_same_subject_idxs) diff_subject_snp_idxs = parse_midas_data.apply_sample_index_map_to_indices( snp_sample_idx_map, desired_diff_subject_idxs)
variant_type='1D', min_change=min_change) sys.stderr.write("Done!\n") # Only plot samples above a certain depth threshold high_coverage_samples = samples[median_coverages >= min_coverage] high_coverage_low_pi_samples = samples[(median_coverages >= min_coverage) * (pis <= 1e-03)] # Calculate which pairs of idxs belong to the same sample, which to the same subject # and which to different subjects high_coverage_same_sample_idxs, high_coverage_same_subject_idxs, high_coverage_diff_subject_idxs = parse_midas_data.calculate_subject_pairs( subject_sample_map, high_coverage_samples) sample_idx_map = parse_midas_data.calculate_sample_idx_map( high_coverage_samples, samples) same_sample_idxs = parse_midas_data.apply_sample_index_map_to_indices( sample_idx_map, high_coverage_same_sample_idxs) # same_subject_idxs = parse_midas_data.apply_sample_index_map_to_indices( sample_idx_map, high_coverage_same_subject_idxs) # diff_subject_idxs = parse_midas_data.apply_sample_index_map_to_indices( sample_idx_map, high_coverage_diff_subject_idxs) # Calculate which pairs of idxs belong to the same sample, which to the same subject # and which to different subjects high_coverage_low_pi_same_sample_idxs, high_coverage_low_pi_same_subject_idxs, high_coverage_low_pi_diff_subject_idxs = parse_midas_data.calculate_subject_pairs( subject_sample_map, high_coverage_low_pi_samples)