compare_maps(non_PSV_map_08, map_08) write_intersection("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/consensus/PSV_nonPSV_intersection.tsv", map_08, non_PSV_map_08 ) write_union("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/consensus/PSV_nonPSV_union.tsv", map_08, non_PSV_map_08 ) a, b = align_maps(non_PSV_map_08, map_08) # drop LG that appear only in one of the two for LG, markers in map_08.markers_of_LG.items(): if len(markers) == 1: map_08.drop_LG(LG) compare_orders(map_08, non_PSV_map_08) write_generic_map("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/consensus/chum_08_PSV_map_ALIGNED.tsv", map_08) write_generic_map("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/consensus/chum_08_NON-PSV_map_ALIGNED.tsv", non_PSV_map_08) ####### compare_maps(map_08, map_01, map_09) write_intersection("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/consensus/intersection.tsv", map_08, map_01, map_09 ) write_union("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/consensus/union.tsv", map_08, map_01, map_09 ) a, b = align_maps(map_08, map_01) align_maps(map_08, map_09)
from parseMST import Map, write_generic_map from switch_allele_functions import parse_map_file_MST, convert_genotypes_to_int_array import numpy # To summarise and plot a map in R: # Create two files, # a map file, giving the map positions # a stats file, that give stats for each locus, for quality control purposes map_chum_08 = Map('chum_08_mst', 'mst', file_path = "/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/mst/chum_08_iter0_mstmap.map") write_generic_map("/olympus/WORK/WAPLES/Stacks_mapping/Chum_data/psv/chum_08_finalmap.txt", map_chum_08) #Examine number of crossovers # Perhaps read genotype directly from the mstmap input file. # read mst map output file as above or with parse_map_file. # kick out LG and loci sitting alone # How to best count the number of crossovers along a LG??? # need to switch alleles ini_map, num_loci_on_lg = parse_map_file_MST("Y:\WORK\WAPLES\Stacks_mapping\Chum_data\mst\chum_08_iter0_mstmap.map") int_arr = convert_genotypes_to_int_array(mappable_08, ini_map) # This should be move into the psv_working pipeline, so that stats_08 is not needed here (it cannot be pickled). def write_stats(filename, stats): with open(filename, 'w') as OUTFILE: for catID, values in stats.items(): OUTFILE.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format( catID, values.epsilon, values.best_model,