ALLCools.plot.genome_track
Contents
ALLCools.plot.genome_track
¶
Submodules¶
Package Contents¶
- 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
- static get_available_tracks()¶
- get_tracks_height(self, start_region=None, end_region=None)¶
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)¶
- plot_vlines(self, axis_list, chrom_region, start_region, end_region)¶
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)¶
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
- close_files(self)¶
Close all opened files
- static check_file_exists(track_dict, tracks_path, is_hic=False)¶
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)¶
- 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
- static cm2inch(*tupl)¶
- static print_elapsed(start)¶
- 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