default=None, help="Title of figure. Default: not set") parser.add_argument( "-m", "--parsing_mode", action="store", dest="parsing_mode", default="genotypes", help= "Parsing mode. Allowed: genotypes(default), 'coordinates_and_genotypes', 'complete'" ) """ parser.add_argument("-a", "--scaffold_white_list", action="store", dest="scaffold_white_list", default=[], type=lambda s: s.split(","), help="Comma-separated list of the only scaffolds to draw. Default: all") parser.add_argument("-b", "--scaffold_black_list", action="store", dest="scaffold_black_list", default=[], type=lambda s: s.split(","), help="Comma-separated list of scaffolds to skip at drawing. Default: not set") """ args = parser.parse_args() mutations = CollectionVCF(args.input, parsing_mode="genotypes") StatsVCF.count_singletons(collection_vcf=mutations, output_prefix=args.output_prefix) """ Visualization.zygoty_bar_plot(StatsVCF.count_zygoty(mutations, outfile="%s.counts" % args.output_prefix), args.output_prefix, extension_list=args.output_formats, figsize=args.figsize, dpi=args.dpi, title=args.title) """
extracting_method=args.method, threshold_tuple=None, min_threshold=args.min_threshold, max_threshold=args.max_threshold, threshold_number=None, threshold_step=args.threshold_step, output_prefix=None) """ output_prefix = "%s.D%s.M%s.depth%i" % (args.output_prefix, args.distance, args.method, args.depth) cluster_df = StatsVCF.test_clustering_thresholds( variants.records, method=args.distance, output_prefix=output_prefix, extracting_method=args.method, threshold_tuple=None, depth=args.depth, min_threshold=args.min_threshold, max_threshold=args.max_threshold, threshold_number=None, threshold_step=args.threshold_step, ) print("Drawing...") Visualization.plot_clustering_threshold_tests( cluster_df, output_prefix, scaffold_order_list=args.scaffold_ordered_list, extensions=("png", ), suptitle="Test of clustering thresholds")
print(scaffold_to_keep) print(coverage_df) print(chr_syn_dict) print(coverage_df) Visualization.draw_coverage_windows( coverage_df, args.window_size, args.window_step, chr_len_df, average_coverage_dict, args.output_prefix, figure_width=args.figure_width, figure_height_per_scaffold=args.figure_height_per_scaffold, dpi=300, colormap=args.colormap, title=args.title, extensions=args.output_formats, scaffold_order_list=args.scaffold_ordered_list, test_colormaps=args.test_colormaps, thresholds=(0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2.0, 2.125, 2.25) if args.split_coverage_thresholds else args.coverage_thresholds, absolute_coverage_values=args.absolute_coverage_values, subplots_adjust_left=args.subplots_adjust_left, subplots_adjust_bottom=args.subplots_adjust_bottom, subplots_adjust_right=args.subplots_adjust_right, subplots_adjust_top=args.subplots_adjust_top, show_track_label=not args.hide_track_label, show_trackgroup_label=True)
type=lambda s: map(int, s.split(",")), default=(5, 5), help="Size of figure in inches. X and Y values should be separated " "by comma. Default: 5,5") parser.add_argument("-e", "--output_formats", action="store", dest="output_formats", type=lambda s: s.split(","), default=["png"], help="Comma-separated list of formats (supported by matlotlib) " "of output figure.Default: png") parser.add_argument("-l", "--title", action="store", dest="title", default=None, help="Title of figure. Default: not set") """ parser.add_argument("-a", "--scaffold_white_list", action="store", dest="scaffold_white_list", default=[], type=lambda s: s.split(","), help="Comma-separated list of the only scaffolds to draw. Default: all") parser.add_argument("-b", "--scaffold_black_list", action="store", dest="scaffold_black_list", default=[], type=lambda s: s.split(","), help="Comma-separated list of scaffolds to skip at drawing. Default: not set") """ args = parser.parse_args() mutations = CollectionVCF(args.input, parsing_mode="coordinates_and_genotypes") Visualization.zygoty_bar_plot(StatsVCF.count_zygoty(mutations, outfile="%s.counts" % args.output_prefix), args.output_prefix, extension_list=args.output_formats, figsize=args.figsize, dpi=args.dpi, title=args.title)
#print(masking_df) #print(count_df) count_df.to_csv("%s.variant_counts.with_masking.tsv" % args.output_prefix, sep='\t', header=True, index=True) Visualization.draw_variant_window_densities( count_df, args.window_size, args.window_step, chr_len_df, args.output_prefix, figure_width=15, figure_height_per_scaffold=0.5, dpi=300, show_track_label=not args.hide_track_label, colormap=args.colormap, title=args.title, extensions=args.output_formats, scaffold_order_list=args.scaffold_ordered_list, test_colormaps=args.test_colormaps, thresholds=args.density_thresholds, masking=True if args.coverage else False, subplots_adjust_left=args.subplots_adjust_left, subplots_adjust_bottom=args.subplots_adjust_bottom, subplots_adjust_right=args.subplots_adjust_right, subplots_adjust_top=args.subplots_adjust_top, show_trackgroup_label=True)
#print(chr_len_df) Visualization.draw_features(feature_df, chr_len_df, args.output_prefix, legend_df=legend_df, figure_width=15, figure_height_per_scaffold=0.5, dpi=300, colormap=None, thresholds=None, colors=None, background=None, default_color=args.default_color, title=None, extensions=args.output_formats, scaffold_order_list=args.scaffold_ordered_list, feature_shape=args.feature_shape, feature_start_column_id=feature_start_column_id, feature_end_column_id=feature_end_column_id, feature_color_column_id=args.color_column_name, feature_length_column_id="length", subplots_adjust_left=args.subplots_adjust_left, subplots_adjust_bottom=args.subplots_adjust_bottom, subplots_adjust_right=args.subplots_adjust_right, subplots_adjust_top=args.subplots_adjust_top, show_track_label=not args.hide_track_label, show_trackgroup_label=True, subplot_scale=args.subplot_scale, track_group_scale=args.track_group_scale)
#print(label) scaf_df_list[-1].rename(index={scaf: label}, inplace=True) len_dict[label] = chr_len_df.loc[scaf] len_df = pd.DataFrame.from_dict(len_dict, orient="index") #print(len_df) #merged_coverage_df_dict[scaf] = pd.concat(scaf_df_list) #print(scaf) Visualization.draw_coverage_windows(pd.concat(scaf_df_list), args.window_size, args.window_step, len_df, mean_coverage_df, "{0}.{1}".format(args.output_prefix, scaf), figure_width=args.figure_width, figure_height_per_scaffold=args.figure_height_per_scaffold, dpi=300, colormap=args.colormap, title="Coverage {0}".format(scaf), extensions=args.output_formats, scaffold_order_list=args.scaffold_ordered_list, test_colormaps=args.test_colormaps, thresholds=args.coverage_thresholds, absolute_coverage_values=args.absolute_coverage_values, subplots_adjust_left=args.subplots_adjust_left, subplots_adjust_bottom=args.subplots_adjust_bottom, subplots_adjust_right=args.subplots_adjust_right, subplots_adjust_top=args.subplots_adjust_top, show_track_label=True, show_trackgroup_label=True, close_figure=True )