plot_genome

GRATIOSA.plot_genome.plot_region(gen, beg, end, RNASeq_cond=[], signals_cond=[], gene_names=True, output_dir='/home/usr/documents/resdir/Genome_plot/', output_file='Genome_2025-01-21 14:21:03.329860', file_extension='.pdf', *args, **kwargs)

Plots experimental information (one subplot per experiment) and gene annotations for a region. The genes annotation subplot is created with the subplot_genes function. RNASeq subplots and Chipseq subplots are created with the subplot_rnaseq_coverage and subplot_signal functions respectively.

Parameters:
  • gen – Genome instance

  • beg (int.) – beginning of the region to be plotted

  • end (int.) – end of the region to be plotted

  • RNASeq_cond (list of str.) – list of the RNASeq conditions names to represent. Left empty by default ie no cover is plotted.

  • tr_object (Transcriptome instance) – Transcriptome instance with loaded RNASeq coverages

  • signals_cond (list of str.) – list of the Chipseq conditions names to represent. Left empty by default ie no signal is plotted.

  • ch_object (Chipseq instance) – Chipseq instance with loaded signals.

  • gene_names (Optional [Bool.]) – If true, the name of the genes is noted on their representation. (True by default).

  • output_dir (Optional [str.]) – output directory

  • output_file (Optional [str.]) – output filename for plot

  • file_extension (Optional [str.]) – Graphic file extension type (.pdf by default)

  • R_ylabels (Optional [list of str.]) – y-axis label for RNASeq data subplots. By default, conditions names given in input with the RNASeq_cond argument.

  • S_ylabels (Optional [list of str.]) – y-axis label for RNASeq data subplots. By default, conditions names given in input with the signals_cond argument.

  • vlines (Optional [dict.]) – Dictionnary of shape {position: annotation text}. One green vertical line and its annotation are plotted for each item of this dictionnary.

  • figsize (Optional [(float,float)]) – width and height in inches (by default: (3.5,n) with n the number of suplots)

  • hratios (Optional [array-like]) – Relative heights of the subplots. If not given, all rows will have the same height except the genes subplot.

  • hspace (Optional [float]) – Height space between subplots, expressed as a fraction of the average axis height. By default: 0.05

  • figpos (Optional [array-like of length 4]) – Position of the subplots as a fraction of figure width or height. The array contains the positions in the following order: bottom, top, left and right.

Warning

This method needs a genomic annotation. If no annotation is loaded to the Genome instance, the load_annotation method of with the default “sequence.gff3” file is computed. To use another annotation, please load an annotation to your Genome instance before using this method.

Warning

To plot a ChIPseq coverage, all the selected conditions must first be loaded on the Chipseq instance using one of the ChipSeq method (for example load_signal or load_signals_average). This Chipseq instance must then be given as input with the argument “ch_object”.

Warning

To plot a RNAseq coverage, all the selected conditions must first be loaded on the Transcriptome instance using tr.load_rnaseq_cov() and this instance must be given as input with the argument “tr_object”.

Example

>>> from GRATIOSA import Genome, Transcriptome, Chipseq, plot_genome
>>> g = Genome.Genome("ecoli")
>>> g.load_annotation()
>>> tr = Transcriptome.Transcriptome("ecoli")
>>> tr.load_rnaseq_cov()
>>> ch = Chipseq.Chipseq("ecoli")
>>> ch.load_signals_average(list_cond=["cond1","cond2"],
...                         average_name="cond12")
>>> plot_genome.plot_region(g,2101000,2106000,
                            RNASeq_cond = ["WT"],
                            signals_cond=["cond12"],
                            R_ylabels=["WT"],
                            S_ylabels=["cond12"],
                            tr_object=tr,
                            ch_object=ch,
                            hratios = [1,2,2,1],
                            figsize=(6,5),
                            figpos=[0.1,0.98,0.15,0.95])
GRATIOSA.plot_genome.subplot_genes(ax, gen, beg, end, xticks=None, gene_names=True)

Plots a subplot with the annoted oriented genes that are located in the selected region.

Parameters:
  • ax (matplotlib Axes instance) –

  • gen (Genome instance) –

  • beg (int.) – beginning of the region to be plotted

  • end (int.) – end of the region to be plotted

  • xticks (list of float) – xaxis’ tick locations. None by default ie. the xaxis is left empty.

  • gene_names (Bool.) – If true, the name of the genes is noted on their representation. (True by default).

Warning

This method needs a genomic annotation. If no annotation is loaded to the Genome instance, the load_annotation method of with the default “sequence.gff3” file is computed. To use another annotation, please load an annotation to your Genome instance before using this method.

GRATIOSA.plot_genome.subplot_rnaseq_coverage(ax, tr, cond, beg, end, ylabel=None, xticks=None)

Plots a subplot with the with the experimental data (RNASeq coverages on both DNA strands) of the selected region.

Parameters:
  • ax (matplotlib Axes instance) –

  • tr (Transcriptome instance) – Transcriptome instance with loaded RNASeq coverages

  • cond (str.) – RNASeq condition name to represent. WARNING: This condition must first be loaded on the Transcriptome instance using tr.load_rnaseq_cov().

  • beg (int.) – beginning of the region to be plotted

  • end (int.) – end of the region to be plotted

  • ylabel (str.) – y-axis label. By default, the condition name given in input with the cond argument.

  • xticks (list of float) – xaxis’ tick locations. None by default ie. the xaxis is left empty.

GRATIOSA.plot_genome.subplot_signal(ax, ch, cond, beg, end, ylabel=None, xticks=None)

Plots a subplot with the with the experimental data (Chipseq signal) of the selected region.

Parameters:
  • ax (matplotlib Axes instance) –

  • ch (Chipseq instance) – Chipseq instance with loaded signals.

  • cond (str.) – Chipseq condition name to represent. WARNING: This condition must first be loaded on the Chipseq instance using one of the ChipSeq method (for example load_signal or load_signals_average).

  • beg (int.) – beginning of the region to be plotted

  • end (int.) – end of the region to be plotted

  • ylabel (str.) – y-axis label. By default, the condition name given in input with the cond argument.

  • xticks (list of float) – xaxis’ tick locations. None by default ie. the xaxis is left empty.