Title: | Genome Synteny Visualization |
---|---|
Description: | Draw syntenic relationships between genome assemblies. There are 3 functions which take a tab delimited file containing alignment data for syntenic blocks between genomes to produce either a linear alignment plot, an evolution highway style plot, or a painted ideogram representing syntenic relationships. There is also a function to convert alignment data in the DESCHRAMBLER/inferCAR format to the required data structure. |
Authors: | Marta Farre [aut, cre, cph], Sarah Quigley [aut], Joana Damas [aut], Denis Larkin [aut] |
Maintainer: | Marta Farre <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-02-10 05:29:52 UTC |
Source: | https://github.com/farre-lab/syntenyplotter |
Draw Evolution Highway Plots
draw.eh( output, chrRange, data_file, directory = NULL, fileformat = "png", colour = "lightblue", inverted.colour = "lightpink", w = 5.5, h = 10, ps = 10 )
draw.eh( output, chrRange, data_file, directory = NULL, fileformat = "png", colour = "lightblue", inverted.colour = "lightpink", w = 5.5, h = 10, ps = 10 )
output |
output file name |
chrRange |
range of chromosome numbers in the reference as numbers i.e. 1:29 |
data_file |
file containing the syntentic blocks from the alignments |
directory |
string containing file path to chosen directory to save image file |
fileformat |
output file format desired using the format |
colour |
set colour for non-inverted syntenic blocks using the format |
inverted.colour |
set colour for inverted syntenic blocks using the format |
w |
width of output image using the format |
h |
height of output image using the format |
ps |
point size of output image using the format |
This function draws Evolution Highway style plots.
It requires as input:
Desired output file name
The range of chromosomes of the reference species this is entered as either a single number i.e. 1 or a range of numbers i.e. 1:22. Note: if you are inputting sex chromosomes or chromosomes with characters in the name input a concatenated string i.e. c(1,2,3,"X")
File containing the syntenic blocks of alignments of one or more target species aligned to a single reference; following this format: reference chromosome, reference start position, reference end position, target chromosome, target start position, target end position, orient, reference species identifier, target species identifier
There are optional parameters for some customization of this function:
The format for saving the image i.e. png or pdf can be altered by inputting: fileformat = "pdf"
(the default value is "png")
The colour of the syntenic blocks (not inverted blocks) can be changed by inputting: colour = "red"
(the default value is "lightblue", see Rcolour pallette for colour options)
The colour of the inverted syntenic blocks can be changed by inputting: inverted.colour = "blue"
(the default value is "lightpink", see Rcolour pallette for colour options)
The width of the image created can be changed by inputting: w = 5.5
The height of the image created can be changed by inputting: h = 10
The point size of the image created can be changed by inputting: ps = 10
The directory where the image file should be saved, as default the image is saved to temporary directory, change by inputting: directory = "path/to/directory"
The function works creating a graph for each reference chromosome using their start and end positions to create a block for the reference and the target chromosome positions are used to colour the region where synteny was identified
Example: draw.eh("outputName",c(17,"X"), "example_eh_alignments_2.txt", directory = "path/to/directory", fileformat = "pdf")
An image file showing the comparative drawings
# Create object containing file path to external dataset # (see vignette to follow examples with personal data) file1 <- system.file("extdata", "example_eh_alignments_2.txt", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run draw.eh function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette draw.eh("outputName", c(17, "X"), file1, fileformat = "pdf")
# Create object containing file path to external dataset # (see vignette to follow examples with personal data) file1 <- system.file("extdata", "example_eh_alignments_2.txt", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run draw.eh function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette draw.eh("outputName", c(17, "X"), file1, fileformat = "pdf")
Draw synteny ideograms in Chromosome painting style
draw.ideogram( file_data, sizefile, output, directory = NULL, fileformat = "png", colours = colours.default, w = 8.5, h = 10, ps = 5 )
draw.ideogram( file_data, sizefile, output, directory = NULL, fileformat = "png", colours = colours.default, w = 8.5, h = 10, ps = 5 )
file_data |
Path to the syntenic blocks file |
sizefile |
Chromosome size file |
output |
output file name |
directory |
string containing file path to chosen directory to save image file |
fileformat |
output file format specified using |
colours |
concatenated string of chromosome IDs and assigned colours if desired using the format |
w |
width of output image using |
h |
height of output image using |
ps |
point size of output image using |
This function draws pairwise synteny plots in chromosome painting style.
Inputs are tab separated files;
It requires as input:
File containing the syntenic blocks following this format: reference chromosome, reference start position, reference end position, target chromosome, target start position, target end position, orient, reference species identifier, target species identifier
Tab separated file of all chromosome, scaffold, or contig lengths and the species identifier, in order from first target species in the alignment files followed by the first reference species in the alignment files – top of file – to the last target species and reference species in the alignment files – end of file. in this format: chromosome ID, chromosome length, species identifier
The desired output file name
Please separate files by tab and ensure any species identifiers used between length and alignment files are matching (same identifiers and caseing)
There are optional parameters for some customization of this function:
The format for saving the image i.e. png or pdf can be altered by inputting: fileformat = "pdf"
(the default value is "png")
The colour of the ideograms can be altered by inputting a concatenated string of chromosome IDs with assigned colour values which can be found with R colour Pallette
e.g. colours = c("1" = "red", "2" = "blue", "3" = "green","4" = "orange", "5" = "purple","X" = "grey")
if no colours are assigned default values will be used but colours MUST be assigned to all chromosomes
The width of the image created can be changed by inputting: w = 8.5
(default)
The height of the image created can be changed by inputting: h = 10
(default)
The point size of the image created can be changed by inputting: ps = 5
(default)
The directory where the image file should be saved, as default the image is saved to temporary directory, change by inputting: directory = "path/to/directory"
Target is the species which chromosomes will be painted. Reference will be used for painting and diagonals. Chromosomes will be in the same order as in the target chromosomes in the chromosome length file
Example: draw.ideogram("example_alignment_1.txt", "example_lengths.txt", "outputname", directory = "path/to/directory", fileformat = "pdf")
An image file showing the ideogram
# Create objects containing file paths to external dataset # (see vignette to follow examples with personal data) length.file <- system.file("extdata", "example_lengths.txt", package = "syntenyPlotteR") file1 <- system.file("extdata", "example_alignment_1.txt", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run draw.ideogram function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette draw.ideogram(file1, length.file, "outputName", fileformat = "pdf")
# Create objects containing file paths to external dataset # (see vignette to follow examples with personal data) length.file <- system.file("extdata", "example_lengths.txt", package = "syntenyPlotteR") file1 <- system.file("extdata", "example_alignment_1.txt", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run draw.ideogram function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette draw.ideogram(file1, length.file, "outputName", fileformat = "pdf")
Draw Linear Synteny Plots
draw.linear( output, sizefile, ..., directory = NULL, fileformat = "png", colours = colours.default, w = 13, h = 5, opacity = 0.5 )
draw.linear( output, sizefile, ..., directory = NULL, fileformat = "png", colours = colours.default, w = 13, h = 5, opacity = 0.5 )
output |
output file name |
sizefile |
Chromosome Size file |
... |
synteny files (any number of alignment files can be entered) |
directory |
string containing file path to chosen directory to save image file |
fileformat |
output file format specified using the format |
colours |
concatenated string of chromosome IDs and assigned colours if desired using the format |
w |
width of output image using the format |
h |
height of output image using the format |
opacity |
opacity of syntenic bands using the format |
This function draws linear synteny plots.
It requires:
The desired output file name;
Tab separated file of all chromosome, scaffold, or contig lengths and the species identifier, in order from first target species in the alignment files followed by the first reference species in the alignment files – top of file – to the last target species and reference species in the alignment files – end of file. in this format: chromosome ID, chromosome length, species identifier
files containing the syntenic blocks - one file per alignment, in order from first target/reference (most recent species pairwise alignment in ancestral reconstruction data) alignment file to last target/reference (ancestor pairwise alignment in ancestral reconstruction data) alignment file following this format: reference chromosome, reference start position, reference end position, target chromosome, target start position, target end position, orient, reference species identifier, target species identifier
Please separate files by tab and ensure any species identifiers used between length and alignment files are matching (same identifiers and caseing)
There are optional parameters for some customization of this function:
The format for saving the image i.e. png or pdf can be altered by inputting: fileformat = "pdf"
(the default value is "png")
The colour of the synteny bands can be altered by inputting a concatenated string of chromosome IDs with assigned colour values which can be found with R colour Pallette
e.g. colours = c("1" = "red", "2" = "blue", "3" = "green","4" = "orange", "5" = "purple","X" = "grey")
if no colours are assigned default values will be used but colours MUST be assigned to all chromosomes
The width of the image created can be changed by inputting: w = 13
(default)
The height of the image created can be changed by inputting: h = 5
(default)
The opacity of the ribbons can be changed by inputting: opacity = .5
(default)
The directory where the image file should be saved, as default the image is saved to temporary directory, change by inputting: directory = "path/to/directory"
The function works using the chromosome length file to order the Y axis and provide chromosome lengths to draw chromosome ideograms and the alignment files provides coordinates to draw the alignment bands between ideograms
Example: draw.linear("outputname", "example_lengths.txt", "example_alignment_1.txt", "example_alignment_2.txt", "example_alignment_3.txt", directory = "path/to/directory", fileformat = "pdf")
An image file showing the linear comparison drawings
# Create objects containing file paths to external dataset # (see vignette to follow examples with personal data) length.file <- system.file("extdata", "example_lengths.txt", package = "syntenyPlotteR") file1 <- system.file("extdata", "example_alignment_1.txt", package = "syntenyPlotteR") file2 <- system.file("extdata", "example_alignment_2.txt", package = "syntenyPlotteR") file3 <- system.file("extdata", "example_alignment_3.txt", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run draw.linear function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette draw.linear("outputName", length.file, file1, file2, file3, fileformat = "pdf")
# Create objects containing file paths to external dataset # (see vignette to follow examples with personal data) length.file <- system.file("extdata", "example_lengths.txt", package = "syntenyPlotteR") file1 <- system.file("extdata", "example_alignment_1.txt", package = "syntenyPlotteR") file2 <- system.file("extdata", "example_alignment_2.txt", package = "syntenyPlotteR") file3 <- system.file("extdata", "example_alignment_3.txt", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run draw.linear function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette draw.linear("outputName", length.file, file1, file2, file3, fileformat = "pdf")
Reformat synteny data
reformat.syntenyData( file_data, filename, directory = NULL, reference.species = reference.sps, target.species = target.sps )
reformat.syntenyData( file_data, filename, directory = NULL, reference.species = reference.sps, target.species = target.sps )
file_data |
input file name for descrambler .map data |
filename |
output file name for reformatted data |
directory |
string containing file path to chosen directory to save text file |
reference.species |
reference species identifier as a character string |
target.species |
target species identifier as a character string |
This function takes output from alignment softwares such as deschrambler and inferCARs and re-formats it for syntenyPlotteR - this does not curate files only re-formats it
It requires as input:
The data output from deschrambler or inferCARs
the desired output file name
There are optional parameters for some customization of this function:
reference.species allows you to set the reference species identifier that will be set in the final output table i.e. reference.species = "ref"
target.species allows you to set the target species identifier that will be set in the final output table i.e. target.species = "tar"
The directory where the text file should be saved, as default the file is saved to temporary directory, change by inputting: directory = "path/to/directory"
Example: reformat.syntenyData("deschrambler.output", "reformatted.data", directory = "path/to/directory", reference.species = "ref", target.species = "tar" )
A text file with the reformatted data
# Create object containing file path to external dataset # (see vignette to follow examples with personal data) file <- system.file("extdata", "example_map_1.map", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run reformat.syntenyData function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette reformat.syntenyData(file, "outputName")
# Create object containing file path to external dataset # (see vignette to follow examples with personal data) file <- system.file("extdata", "example_map_1.map", package = "syntenyPlotteR") # ----------------------------------------------------------------------------------- # Run reformat.syntenyData function # To run example and save file to working directory # add directory parameter and set working directory # To run example with personal data see vignette reformat.syntenyData(file, "outputName")