The handling of ranges on the * strand (unoriented objects, and mapped regions such as the output of bridgeRegions()) is experimental: it may change in later versions without being considered a breaking change. Inversions are never flagged on such ranges, and functions that need orientation, such as permutationVector(), stop with an error.
New simulateRearrangements() function, which simulates a pair of genomes rearranged by random inversions and transpositions and records the events, and new permutationVectorToGBreaks() function, the inverse of permutationVector(). A set of 200 simulations is provided in inst/extdata/simulatedRearrangements.rds for tests and benchmarks.
Breaking change:flagTranslocations() now flags the two places where a moved range is seen in the order of the target genome: its payload region (tra flag, as before) and its site, the pair of adjacent ranges between which it is found on the query genome (new trs flag, on the first range of the pair). The both argument and the tra flag on the query ranges are removed: they computed the site by swapping the genomes and sorting again, which put the flag on the second range of the site when it was on the minus strand, and on the wrong row when target ranges were duplicated. flagAll() still uses only the tra flag.
coalesce_contigs() now coalesces over mapped regions: in an object that mixes oriented ranges and ranges on the * strand, such as the output of bridgeRegions() added to the alignments, the oriented ranges are coalesced and absorb the unstranded ranges that they contain on both genomes (experimental). Before, such objects were not coalesced at all, and mapped regions of width zero on one genome caused an error.
flagInversions() no longer flags triplets that contain a range on the * strand, such as a colinear + * + triplet made by adding the output of bridgeRegions() to an object: inversions can not be determined without orientation. flagDoubleInversions() and flagTwinInversions() already required known strands; this is now documented.
flagTranslocations() now tests unstranded ranges in both directions, instead of as plus-strand ranges, so that its result on unoriented objects no longer depends on the orientation of the query sequences. As orientation is unknown, more ranges can be flagged as moved (see the help page). flagAll() gives precedence to colinearity on such ranges, instead of failing (experimental).
flagPairs() no longer flags all pairs that involve a range on the * strand as boundaries (Bnd): they are now Col when adjacent in an order compatible with colinearity, Scr when not adjacent, and NA when adjacent but undetermined (experimental). The factor levels are unchanged.
Ranges of width zero on one or both genomes, such as the mapped regions that bridgeRegions() returns between adjacent alignments, broke the adjacency tests of flagColinearAlignments(), flagPairs() and the functions that flag structural variants: GenomicRanges::precede() and follow() report a zero-width range as adjacent to itself. The adjacency tests now place such ranges between the bases that surround them. Results on objects without zero-width ranges are unchanged.
Breaking change:dist2next() now returns the number of bases between two ranges, as GenomicRanges::distance() does (0 for adjacent or overlapping ranges), instead of that number plus one. The tol argument of coalesce_contigs(), flagColinearAlignments() and flagInversions() now bridges gaps of up to tol bases, as documented, instead of gaps shorter than tol. With a finite tol, results change where a gap is exactly tol bases wide; for example coalesce_contigs(gb, tol = 0) now merges adjacent colinear ranges. Results with the default tol = Inf are unchanged.
flagDoubleInversions() now requires the ranges before and after the triplet to be colinear with it: on the plus strand for the bcA and Cab patterns, and on the minus strand for BAc and aCB. Previously, it also flagged triplets that require three inversions, and triplets whose neighbours map elsewhere in the query genome. The flag is now set on the left flank, as in flagInversions() and flagTwinInversions(). As a consequence, filterDoubleInversions() now returns the central triplet (it returned its last two ranges and the right flank), and removeDoubleInversions() was adjusted to remove the same three ranges.
flagInversions() and flagPairs() ignored the first range of the object when testing whether two ranges are adjacent on the query genome. For example, flagPairs(exampleInversionGarg2019) now returns Scr instead of Inv for ranges 4 and 5, which are separated by range 1 on the query.
filterTranslocations(remove = TRUE) returned an empty object when no translocation was flagged; it now returns all the ranges.
leftInversionGaps() now returns one gap per inversion, as a zero-width range when the left flank and the central range are adjacent or overlap (these inversions were dropped), with a new flagIndex metadata column giving the position of the left flank. A new detect argument allows to reuse existing inv flags, for instance computed with a tol value.
New detect option in the show and filter functions for inversions and translocations, to re-compute flags automatically and simplify interactive use. Set to FALSE and flag manually when performance is an issue.
GenomicBreaks 0.14.10
New slidingWindow() function to compute similarity indices on windowed intervals.
New GBreaksToMatrix() function to apply image processing approaches on scrambling patterns.
New keepLongestPair() function to focus on the longest sequence feature in each genome.
New wholeGenomeClassification() function to classify isolated alignments, collinear alignments, bridge regions and breakpoint regions.
GenomicBreaks 0.14.1
Bug fixes
Correct a 1-nt shift in minus-strand coordinates of the query genome of GBreaks objects loaded from MAF files. This shift could cause overlapping ranges that crashed the coalescing algorithm.
bridgeRegions() now returns empty GBreaks objects if no bridge region was found. Closes issue #20.
Allow makeOxfordPlots() to work on genomes larger than the maximum 32-bit integer. Closes issue #24.
New functionalities
New flipInversions() function to remove detected inversions before searching for nested ones.
The load_genomic_breaks() function gains support for files in the Multiple Alignment Format (MAF).
GenomicBreaks 0.13.1
New functionalities
The makeOxfordPlots() function gains a col argument for choosing to color by strand or by score.
Bug fixes
In makeOxfordPlots(), the sequence names are now centered on their region.
GenomicBreaks 0.13.0
Important bug fixes
The flagColinearAlignments() and coalesce_contigs() functions were corrected so that strandless ranges are called colinear when they satisfy the conditions on any strand. Before, they would be treated like plus-strand ranges, causing failure to detect colinearity on the minus strand.
New functionalities
New getSeq() method for GRanges and GBreaks objects that have proper seqinfo for an installed BSgenome package.
makeOxfordPlots() includes strand information in the returned object.
New type = 'none' option for makeOxfordPlots(), for better customisation.
GenomicBreaks 0.12.1
The plotApairOfChrs() function now plots the name of the selected sequence levels instead of target and query. The labels can be overriden with the dna_seg_labels parameters. Closes issue #6.
New defaults for makeOxfordPlots(): fixed-ratio line plot with round ends and size of 1. Axis labels are now “target” and “query” by default. In any case, Seqname is displayed instead of genome name if there is only one sequence in the ranges object.
New isSorted() method to properly test with ignore.strand set to TRUE.
Default plotApairOfChrs() to the first sequence level of the GBreaks object.
plotApairOfChrs() now renders regions as blocks and not arrows as the strand information is encoded in the color and shape of the comparison bands. It also plots in light blue the blocks that are not matched. Closes issues #3 and #5.
Added example data, see ?StructuralVariants and `vignette(“Structural Variants”, package = “GenomicBreaks”) for details.