{"id":14601885,"url":"https://github.com/schneebergerlab/plotsr","last_synced_at":"2025-09-05T20:30:53.776Z","repository":{"id":37416987,"uuid":"440846725","full_name":"schneebergerlab/plotsr","owner":"schneebergerlab","description":"Tool to plot synteny and structural rearrangements between genomes","archived":false,"fork":false,"pushed_at":"2024-05-22T15:58:14.000Z","size":176138,"stargazers_count":262,"open_issues_count":7,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-22T16:28:25.818Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schneebergerlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-22T12:13:42.000Z","updated_at":"2024-07-10T22:59:52.390Z","dependencies_parsed_at":"2023-01-20T23:01:25.156Z","dependency_job_id":"7d6819c8-cefe-46ec-9751-2b58e7d82e6d","html_url":"https://github.com/schneebergerlab/plotsr","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/schneebergerlab/plotsr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneebergerlab%2Fplotsr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneebergerlab%2Fplotsr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneebergerlab%2Fplotsr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneebergerlab%2Fplotsr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schneebergerlab","download_url":"https://codeload.github.com/schneebergerlab/plotsr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schneebergerlab%2Fplotsr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273804377,"owners_count":25171556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-08T19:01:25.967Z","updated_at":"2025-09-05T20:30:48.875Z","avatar_url":"https://github.com/schneebergerlab.png","language":"Python","funding_links":[],"categories":["A list of software capable of analyzing mainly **eukaryotic** genomes for pangenomics.","Comparative"],"sub_categories":[],"readme":"![python package](https://github.com/schneebergerlab/plotsr/actions/workflows/python-package.yml/badge.svg?event=push)\n[![Conda Downloads](https://img.shields.io/conda/dn/bioconda/plotsr.svg?label=Conda%20downloads)](\nhttps://anaconda.org/bioconda/plotsr)\n[![Anaconda-Server Badge](https://anaconda.org/bioconda/plotsr/badges/latest_release_date.svg)](https://anaconda.org/bioconda/plotsr)\n\n## Introduction\nPlotsr generates high-quality visualisation of synteny and structural rearrangements between multiple genomes. For this, it uses the genomic structural annotations between multiple chromosome-level assemblies.\n\n\n![Example](./example/ampril_col0_chr3_6600000_10000000.png)\n\n## Installation:\nThe easiest method to install plotsr is using anaconda:\n```\nconda install -c bioconda plotsr \n```\nFor manual installation the pre-requisites are:\n1. Python \u003e= 3.8\n2. Python libraries. These can be installed in a conda environment using:\n```\nconda install numpy=1.21.2 pandas=1.2.4 matplotlib=3.3.4 setuptools\n```\nThen download plotsr and install:\n```\ngit clone https://github.com/schneebergerlab/plotsr.git\ncd plotsr\npython setup.py install\n```\n\nAfter this plotsr should be installed and in your environment. Test it by printing the help message:\n```\nplotsr -h\n```\n\n## Inputs requirements\n#### Minimal requirements\n1. Chromosome-level assemblies for the genomes to be compared \n2. Pairwise structural annotations between genomes\n\nFor example, if genomes A, B, and C are to be visualised in this order, then structural annotations of A vs B and B vs C genome comparisons would be required.\n\n#### Additional inputs\n* GFF/BED/bedGraph files for adding tracks to the visualisation, like the tracks for genes and SNPs in the [example](Example) plot above.\n* Bed file containing genomic coordinates to add markers, like the markers for Inversion 3, Not aligned 1 in the [example](Example) plot above.\n\n## Example visualisation\n\nAs example, we would visualise structural rearrangements between four accessions of \u003ci\u003eArabidopsis thaliana\u003c/i\u003e (Col-0, L\u003ci\u003eer\u003c/i\u003e, Cvi, and Eri). All required files are in the [example](./example/) folder. Following is the list of the important input files:\n| File name|  File Description   |\n|----|--------|\n| `*.chrlen` | Table containing chromosome lengths |\n| `*syri.filtered.out` | Pairwise structural annotation information between genomes |\n| `genomes.txt` | [Genomes information file](#genomes) |\n| `tracks.txt` | [Tracks information file](#visualising-tracks) |\n| `markers.bed` | [Markers information file](#visualising-markers) |\n| `base.cfg` | Configuration file for adjusting visual properties of the plot |\n\nThe structural rearrangements between the genomes can be visualised using the following commands:\n```\ncd example\n# Unzip gene annotation and SNPs file. These would be plotted as tracks.\ngzip -d TAIR10_GFF3_genes.gff.gz\ngzip -d 1001genomes.snps.sorted.bed.gz\n# Plot using plotsr\nplotsr --sr col_lersyri.filtered.out \\\n       --sr ler_cvisyri.filtered.out \\\n       --sr cvi_erisyri.filtered.out \\\n       --genomes genomes.txt \\\n       --tracks tracks.txt \\\n       --markers markers.bed \\\n       --cfg base.cfg \\\n       -o output_plot.png \\\n       -S 0.5 -W 7 -H 10 -f 8 \n```\nThis would create the output_plot.png.\n\n[plotsr.sh](./example/plotsr.sh) file contains ten different commands corresponding to different modes of visualisation (stacked vs itx mode), different selection of genomic regions (all chromosomes, some chromosomes, or specific region), and different orientation of chromosomes (horizontal vs stacked).\n\n## Pipeline for visualising genomic differences\n\nLet's say that we want to visualise genomic differences between four genome assemblies: A.fa, B.fa, C.fa, and D.fa. Further, we want to visualsize the genomes in the order A \u003e B \u003e C \u003e D. Then, following steps are involved in visualising structural rearrangements between these genomes using plotsr:\n\n#### Step 1: Align the genomes\n* Genomes need to aligned using a whole-genome alignment tool. Here, we align the genomes using [minimap2](https://github.com/lh3/minimap2) and index the alignment BAM file using [samtools](https://www.htslib.org/download/): \n```\n# Align genomes\nminimap2 -ax asm5 -t 4 --eqx A.fa B.fa \\\n | samtools sort -O BAM - \u003e A_B.bam\nsamtools index A_B.bam\nminimap2 -ax asm5 -t 4 --eqx B.fa C.fa \\\n | samtools sort -O BAM - \u003e B_C.bam\nsamtools index B_C.bam\nminimap2 -ax asm5 -t 4 --eqx C.fa D.fa \\\n | samtools sort -O BAM - \u003e C_D.bam\nsamtools index C_D.bam\n```\n\n#### Step 2: Finding structural annotations between genomes\n* Next we need to find synteny and structural rearrangements between the genomes. For this, we use [SyRI](https://github.com/schneebergerlab/syri):\n```\n# Running syri for finding structural rearrangements between A and B\nsyri -c A_B.bam -r A.fa -q B.fa -F B --prefix A_B \u0026\n# Running syri for finding structural rearrangements between B and C\nsyri -c B_C.bam -r B.fa -q C.fa -F B --prefix B_C \u0026\n# Running syri for finding structural rearrangements between C and D\nsyri -c C_D.bam -r C.fa -q D.fa -F B --prefix C_D \u0026\n```\nThis will generate A_Bsyri.out, B_Csyri.out, and C_Dsyri.out files that contain the structural annotations between genomes and will be used as input to plotsr.\n\nIf other methods are used for finding structural annotations, then their output can be parsed to plotsr using the BEDPE format which should have the following columns:\n```\nReference chromosome name\nReference start position\nReference end position\nQuery chromosome name\nQuery start position\nQuery end position\nAnnotation type\n```\nValid values for annotation type: SYN, INV, TRA, INVTR, DUP, INVDP. Here:\n\n| \u003c!-- --\u003e |  \u003c!-- --\u003e   |\n|----------|--------|\n| SYN      | Syntenic |\n| INV      | Inversion |\n| TRANS    | Translocation |\n| INVTR    | Inverted translocation |\n| DUP      | Duplication |\n| INVDP    | Inverted duplication |\n\n\u003cb\u003e\u003ci\u003eNOTE\u003c/b\u003e: The BEDPE file must have syntenic region annotations. These are required to group homologous chromosomes from different genomes. Syntenic regions can only be between homologous chromosomes. In case, syntenic regions between homologous chromosomes are not available, then entire homologous chromosomes can be added as syntenic in the BEDPE file manually to allow clustering of homologous chromosomes by plotsr. While plotting, use the `--nosyn` option to skip plotting of these manually added syntenic regions.  \u003c/i\u003e\n\n\n#### Step 3: Running plotsr\nPlotsr can be run using the following command: \n```\nplotsr \\\n    --sr A_Bsyri.out \\\n    --sr B_Csyri.out \\\n    --sr C_Dsyri.out \\\n    --genomes genomes.txt \\\n    -o output_plot.png\n```\n\n\u003ca name=\"genomes\"\u003e\nHere, genomes.txt is a tab-separated file containing the path and names for the genomes. A third column can also be added to customise the visualisation of genomes.\n\u003c/a\u003e\n\n```\n$genomes.txt\n#file\tname\ttags\nA.fa\tA\tlw:1.5\nB.fa\tB\tlw:1.5\nC.fa\tC\tlw:1.5\nD.fa\tD\tlw:1.5\n```\n\nCurrently, the following tags are available for genomes.\n\n```\nft = File type (fa/cl for fasta/chromosome_length, default = fa); cl files must be in tsv format with chromosome name in column 1 and chromosome length in column 2; using cl files is much faster than using fasta files\nlw = line width\nlc = line colour\n```\nCheck the [genomes.txt](./example/genomes.txt) for a working example.\n\n\n\u003cb\u003e\u003ci\u003eNOTE\u003c/b\u003e: It is required that the order of the genomes is the same as the order in which genomes are compared. For example, if the first genome annotation file uses A as a reference and B as query, and the second genome annotation file uses B as a reference and C as query, then the genomes.txt file should list the genomes in the order A, B, C.\u003c/i\u003e\n\n## Customisation alignments\nAdditional column can be added in the input structural annotation files to customise specific alignments. Currently, following tags are available:  \n```\ncl = colour\nlw = line width\nz  = vertical location (higher value would plot the alignment over other plot elements)\n```\n\nExamples:\n```\n# Example modified syri.out. Inversions on Chr3 would be black. Inversions on Chr4 would be red and have thick line width \nChr3\t18112802\t18114029\t-\t-\tChr3\t18084583\t18085805\tINV662\t-\tINV\t-\tcl:black\nChr3\t20464781\t20466696\t-\t-\tChr3\t20458463\t20460390\tINV663\t-\tINV\t-\tcl:black\nChr4\t1347612\t1353808\t-\t-\tChr4\t1437445\t1445482\tINV664\t-\tINV\t-\tcl:red;lw:5;z:4\nChr4\t1612606\t2782621\t-\t-\tChr4\t1746533\t2898561\tINV665\t-\tINV\t-\tcl:red;lw:5;z:4\n\n# Example BEDPE file\nChr1\t1771291\t1771585\tChr1\t1774045\t1774339\tINV\tcl:black;lw:2;z:4\nChr1\t2294260\t2296795\tChr1\t2297217\t2299752\tINV\tcl:black;lw:2;z:4\nChr1\t2455543\t2464808\tChr1\t2458652\t2467917\tINV\tcl:black;lw:2;z:4\n```\n\n\n\u003cb\u003e\u003ci\u003eNOTE\u003c/b\u003e: If using alignment customisation, then each row should either have one (or more) of the available tags or have an ```-``` \u003c/i\u003e\n\n\n## Tracks and markers\nIn addition to structural annotations, plotsr can also be used for visualising tracks for genomics features as well as for marking specific positions in the genomes.\n\n#### Visualising tracks\n\nFeature track information should be in BED or bedGraph format and should correspond to the first genome in visualisation. For example, the [tracks.txt](./example/tracks.txt) contains tracks corresponding to the col-0 genome. Plotsr would then calculate and plot the relative frequency of these features in bins along the chromosomes.\nFeature tracks are parsed to plotsr as a tab-separated file containing the path and names for the tracks. The visualisation properties of the tracks can be adjusted by providing a third column containing different tags and corresponding values.\n\n```\n$tracks.txt\n# file\tname\ttags\nTAIR10_GFF3_genes.gff   Genes   ft:gff;bw:10000;nc:black;ns:8;nf:Arial;lc:blue;lw:4;bc:lightblue;ba:0.5\n1001genomes.snps.sorted.bed     SNPs    bw:10000;nc:black;ns:8;nf:Arial;lc:sienna;lw:1;bc:peachpuff;ba:0.5\nGiraut2011_centromeres.bed     Centromeres     bw:10000;nc:black;ns:8;nf:Arial;lc:olive;lw:1;bc:palegreen;ba:0.5\n```\nCurrently, the following tags are available for tracks.\n```\nft = File type (bed/bedgraph/gff, default = bed)\nbw = bin width (default=100000)\nnc = name colour\nns = name size\nnf = name font\nnm = name margin      # Additional margin between name and track. Fraction between [0,1]\nlc = line colour\nlw = line width\nbc = background colour\nba = background alpha\nti = track index      # Numbers starting from 1. Tracks with same index are plotted on top of each other. Tracks with index will be plotted above tracks without index\ntt = track type       # f: for plotting a filled plot, l: for plotting a line plot\nta = track alpha      # track transparency. Fraction between [0,1]\n```\n\n#### Visualising Markers\nPlotsr can mark positions of interest in the genomes. Markers are provided as an extended BED file with five columns: chromosome name, start position, end position, genome name, tags (optional).\n\n```\n$markers.bed\n#chr\tstart\tend genome_id\ttags\nChr3\t4035330\t4035331\teri\tmt:v;mc:black;ms:3;tt:Inversion 1;tp:0.02;ts:8;tf:Arial;tc:black\nChr4\t2322547\t2322548\tler\tmt:^;mc:black;ms:3;tt:Inversion 2;tp:-0.07;ts:8;tf:Arial;tc:black\nChr3\t8792851\t8792852\tcol-0\tmt:.;mc:red;ms:10;tt:Notal aligned;tp:0.02;ts:8;tf:Arial;tc:black\n```\nThe visualisation properties of the markers can be adjusted by adjusting tag values. Currently, the following tags are available for tracks.\n```\nmt = marker type\nmc = marker colour\nms = marker size\ntt = text\ntc = text colour\nts = text size\ntf = text font\ntp = text position\n```\nCheck [markers.txt](./config/marker_point_type.txt) for the list of available markers.\n\n## Adjusting other parameters\nAdditional parameters (colors, spacing, legends) of the plot can be adjusted by parsing a config file to the `--cfg` parameter. Description and default values present in the example [base.cfg](./example/base.cfg) file.   \n\n## Citation:\nIf you find plotsr helpful, please [cite](https://doi.org/10.1093/bioinformatics/btac196):\n\n`Manish Goel, Korbinian Schneeberger, plotsr: visualizing structural similarities and rearrangements between multiple genomes, Bioinformatics, 2022; btac196, https://doi.org/10.1093/bioinformatics/btac196`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschneebergerlab%2Fplotsr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschneebergerlab%2Fplotsr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschneebergerlab%2Fplotsr/lists"}