ALLCools.plot.genome_track._pygenometrack
Contents
ALLCools.plot.genome_track._pygenometrack
¶
Modified from pygenometracks LICENSE: https://github.com/deeptools/pyGenomeTracks/blob/master/LICENSE
Module Contents¶
- class MultiDict[source]¶
Bases:
collections.OrderedDict
Class to allow identically named sections in configuration file by appending the section number for example: 1. section name
- class PlotTracks(config, fig_width=DEFAULT_FIGURE_WIDTH, fig_height=None, fontsize=None, dpi=None, track_label_width=None, plot_regions=None, plot_width=None)[source]¶
Bases:
object
- get_tracks_height(self, start_region=None, end_region=None)[source]¶
The main purpose of the following loop is to get the height of each of the tracks because for the Hi-C the height is variable with respect to the range being plotted, the function is called when each plot is going to be printed.
- Parameters
start_region – start of the region to plot. Only used in case the plot is a Hi-C matrix
end_region – end of the region to plot. Only used in case the plot is a Hi-C matrix
Returns:
- plot(self, chrom, start, end, file_name=None, title=None, h_align_titles='left', decreasing_x_axis=False)[source]¶
- plot_vlines(self, axis_list, chrom_region, start_region, end_region)[source]¶
Plots dotted lines from the top of the first plot to the bottom of the last plot at the specified positions.
- Parameters
axis_list – list of plotted axis
:param chrom_region chromosome name :param start_region start position :param end_region end position
- Returns
None
- parse_tracks(self, tracks_file, plot_regions=None)[source]¶
Parses a configuration file
- Parameters
tracks_file – file path containing the track configuration
plot_regions – a list of tuple [(chrom1, start1, end1), (chrom2, start2, end2)] on which the data should be loaded here the vlines
- Returns
array of dictionaries and vlines_file. One dictionary per track
- static check_file_exists(track_dict, tracks_path, is_hic=False)[source]¶
Checks if a file or list of files exists. If the file does not exist tries to check if the file may be relative to the track_file path, in such case the path is updated. :param track_dict: dictionary of track values. Should contain
a ‘file’ key containing the path of the file or files to be checked separated by space For example: file1 file2 file3
- Parameters
tracks_path – path of the tracks file
is_hic –
- Returns
None
- static guess_filetype(track_dict, available_tracks)[source]¶
- Parameters
track_dict – dictionary of track values with the ‘file’ key containing a string path of the file or files. Only the ending of the last file is used in case when there are more files
available_tracks – list of available tracks
- Returns
string file type detected
- class SpacerTrack(properties_dict)[source]¶
Bases:
pygenometracks.tracks.GenomeTrack.GenomeTrack
The GenomeTrack object is a holder for all tracks that are to be plotted. For example, to plot a bedgraph file a new class that extends GenomeTrack should be created.
It is expected that all GenomeTrack objects have a plot method.
- plot_y_axis(self, ax, plot_ax)[source]¶
Plot the scale of the y axis with respect to the plot_axis :param ax: axis to use to plot the scale :param plot_axis: the reference axis to get the max and min. :param transform: what was the transformation of the data :param log_pseudocount: :param y_axis: ‘tranformed’ or ‘original’ :param only_at_ticks: False: only min_max are diplayed
True: only ticks values are displayed
Returns:
- class XAxisTrack(*args, **kwargs)[source]¶
Bases:
pygenometracks.tracks.GenomeTrack.GenomeTrack
The GenomeTrack object is a holder for all tracks that are to be plotted. For example, to plot a bedgraph file a new class that extends GenomeTrack should be created.
It is expected that all GenomeTrack objects have a plot method.
- plot_y_axis(self, ax, plot_ax)[source]¶
Plot the scale of the y axis with respect to the plot_axis :param ax: axis to use to plot the scale :param plot_axis: the reference axis to get the max and min. :param transform: what was the transformation of the data :param log_pseudocount: :param y_axis: ‘tranformed’ or ‘original’ :param only_at_ticks: False: only min_max are diplayed
True: only ticks values are displayed
Returns:
- prepare_config(file_configs, add_spacer=True, spacer_height=0.5)[source]¶
Prepare pyGenomeTracks config string.
- Parameters
file_configs – A list of file paths, or a list of file config dicts, containing file path and other config. See pyGenomeTracks documentation for possible parameters.
add_spacer – Whether add spacer between tracks
spacer_height – spacer height in cm
- Returns
- Return type
a single config string that can be read by PlotTracks