SkillAgentSearch skills...

PyCircos

python Circos

Install / Use

/learn @ponnhide/PyCircos
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

pyCircos

Circos is one of the most popular software for visualizing genomic similarities and features. However, its execution process is complicated and requires multiple original config files for the visualizations. Additionally, Circos is written in Perl, which limits its integration with other software for biological analysis. On the other hand, Python has been applied for various biological software packages. Therefore, by combining these packages, researchers can complete most of the required analysis. Nevertheless, Python lacks a library for drawing Circos plots, even though Circos software has been developed for more than a decade. Here, we provide a python Matplotlib based circular genome visualization package '"pyCircos." Users easily and quickly visualize genomic features and comparative genome analysis results by specifying annotated sequence files such as GenBank files.

Join Our Team: Bioinformatics Researcher Wanted.

We are currently seeking a skilled researcher with expertise in bioinformatics to join our lab.
For more details and to apply, please visit the following URL.

Gallery

<img src="img/example.png" width="800x800">

Dependencies

  • python 3.7later

Installation

For normal users, we recommended you to install the official release as follows.
pip install python-circos

If you want to use developmental version, it can be installed using the following single command:
pip install git+https://github.com/ponnhide/pyCircos.git

Usage

pyCircos provides the “Gcircle class” and "Garc class". A "Gcircle" class object holds the dictionary of Garc class objefcts and provides functions to place Garc classs object on the circular map. Each Garc class object manages numeric and genomic data to be visualized on the circular map.

News

  • Tutorial codes are moved to https://github.com/ponnhide/pyCircos-examples .

Version 0.3.0 is released.

  • Tarc class and Tcircle class are added.
    Tarc class and Tcircle class is implemented as subclass of Garc and Gcircle class, respectivily.
    By using these class, you can draw circular phylogenetic tree as the following example.
<img src="img/tree-example.png" width="400x400">

You can execute the example code to draw the circular phylogenetic tee on the Google colab.

<details> <summary> <b>Version 0.2.0 is released. The `fig` parameter is added for Gcircle.__init__, so it is now possible to specify your own figure object. </b> </summary>

If you want to arrange multiple circos plots, I reccomend to use patchworklib.
Please see the following example code.
https://colab.research.google.com/drive/1tkn7pxRqh9By5rTFqRbVNDVws-o-ySz9?usp=sharing

Example result of multiple circos plots <img src="img/pycircos_patchwork.png" width="800x800">

</details>

Gcircle class

A Gcircle class object provides a circle whose diameter is 1000 (a.u.) as a drawing space. Any graph (line plot, scatter plot, barplot, heatmap, and chordplot) can be placed on the space by specifying the raxis_range (from 0 to 1000) and the corresponding Garc class object.

Parameters

  • .garc_dict: dict (default:None) Dictionary of the Garc class objects in Gcircle object. The keys of the dictionary are id values of the Garc class objects.

  • .figsize: tuple (dfault:) Figure size for the circular map.

Methods

  • .add_garc (garc_object=Garc class object)
    Add a new Garc class object into garc_dict.

    • garc_object: Garc class object (default:None)
      Garc class object to be added.

    return None

  • .set_garcs(start=0, end=360)
    Visualize the arc rectangles of the Garc class objects in .garc_dict on the drawing space. After the execution of this method, a new Garc class object cannot be added to garc_dict and figure parameter representing maplotlib.pyplot.figure object will be created in Gcircle object. return None

    • start: int (defaut: 0)
      Start angle of the circos plot. The value range is -360 ~ 360.
    • end: int (default: 360)
      End angle of the circos plot. The value range is -360 ~ 360.
  • .lineplot (garc_id=str, data=list or numpy.ndarray , positions=list or numpy.ndarray, raxis_range=tuple, rlim=*tuple, linestyle=str, linecolor=str or tuple, linewidth=int)
    Plot a line in the sector corresponding to the arc of the Garc class object specified by garc_id.

    • garc_id: str (defaut: None)
      ID of the Garc class object. The ID shoud be in Gcircle object.garc_dict.
    • data: list or numpy.ndarray (default: None)
      Numerical data to be drawn with line.
    • positions: list or numpy.ndarray (default: None)
      The x coordinates of the values in data on the Garc class object when the plot is drawn on the rectangular coordinates. Each coordinate value should be in the range 0 to size of the Garc class object specified by garc_id. By the method execution, the coordinates are converted to proper angle coordinates. If positions are not given, proper coordinates values are generated according to the length of data.
    • raxis_range: tuple (top=int, bottom=int) (default: (550, 650))
      Radial axis range where line plot is drawn.
    • rlim: tuple (top=int, bottom=int) (default: (min(data), max(data)))
      The top and bottom r limits in data coordinates. If rlim value is not given, the maximum value and the minimum value in data will be set to top and bottom , respectively.
    • linestyle: str (default: "solid")
      Line style. Possible line styles can be reffered from https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html
    • linecolor: str or tuple representing color code (default: None)
      Color of the line plot. If linecolor value is not given, the color will be set according to the default color set of matplotlib. To specify the opasity for a line color, please use (r, g, b, a) or #XXXXXXXX format.
    • linewidth: float (default: 1)
      Line width.

    return None

  • .fillplot (garc_id=str, data=list or numpy.ndarray , positions=list or numpy.ndarray, raxis_range=tuple, rlim=tuple, base_value=float, facecolor=str or tuple, linecolor=str or tuple, linewidth=int)
    Fill a specified area in the sector corresponding to the arc of the Garc class object specified by garc_id.

    • garc_id :str (defaut: None)
      Same parameter with garc_id of lineplot().
    • data: list or numpy.ndarray (default: None)
      Same parameter with data of lineplot().
    • positions: list or numpy.ndarray (default: None)
      Same parameter with positions of lineplot().
    • raxis_range: tuple (top=int, bottom=int) (default: (550, 650))
      Same parameter with raxis_range of lineplot().
    • rlim: tuple (top=int, bottom=int) (default: (min(data), max(data))
      Same parameter with rlim of lineplot().
    • base_value: float (default: 0)
      Base line height in data coordinates. The area between the base line and the data line is filled by facecolor.
    • facecolor: str or tuple representing color code (default: None)
      Color for filling.
    • edgecolor: str or tuple representing color code (default: "#303030")
      Edge color of the filled area
    • linewidth: float (default: 0)
      Edge line width.

    return None

  • .scatterplot (garc_id=str, data=list or numpy.ndarray , positions=list or numpy.ndarray, raxis_range=tuple, rlim=tuple, markershape=str, facecolor=str or tuple, edgecolor =str or tuple, linewidth=int, markersize=int)
    Plot markers in the sector corresponding to the arc of the Garc class object specified by garc_id.

    • garc_id :str (defaut: None)
      Same parameter with garc_id of lineplot().
    • data: list or numpy.ndarray (default: None)
      Numerical data to be drawn by scatter plots.
    • positions: list or numpy.ndarray (default: None)
      Same parameter with positions of lineplot().
    • raxis_range: tuple (top=int, bottom=int) (default: (550, 650))
      Same parameter with raxis_range of lineplot().
    • rlim: tuple (top=int, bottom=int) (default: (min(data), max(data))
      Same parameter with rlim of lineplot().
    • makershape: str (default: "o")
      Marker shape. Possible marker shapes can be reffered from https://matplotlib.org/stable/gallery/lines_bars_and_markers/marker_reference.html.
    • markersize: float or list of float (default: None)
      Size(s) of the marker(s).
    • facecolor: str, tuple representing color code or list of color code (default: None)
      Face color(s) of the markers. If value type is list, the lenght of facecolor should be the same as the data length.
    • edgecolor: str or tuple representing color code (default: None)
      Edge color of the markers
    • linewidth: float (default: 0)
      Edge line width of the markers

    return None

  • .barplot (garc_id=str, data=list or numpy.ndarray , positions=list or numpy.ndarray, width=float or list, raxis_range=tuple, rlim=tuple, base_value=int, faceolor=str or tuple, edgecolor=str or tuple)

    Plot bars in the sector corresponding to the arc of the Garc class object specified by garc_id.

    • garc_id :str (defaut: None)
      Same parameter with garc_id of lineplot().
    • data: list or numpy.ndarray (default: None)
      Numerical data to be drawn by bar plots.
    • positions: list or numpy.ndarray (default: None)
      Same parameter with positions o

Related Skills

View on GitHub
GitHub Stars373
CategoryDevelopment
Updated1mo ago
Forks65

Languages

Python

Security Score

95/100

Audited on Feb 28, 2026

No findings