Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions R/StructuralVariants.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#' @aliases exampleDoubleInversion1 exampleDoubleInversion2
#' @aliases exampleDoubleInversion3 exampleDoubleInversion4
#' @aliases exampleTwinInversions exampleNotTwinInversions
#' @aliases exampleInversionGarg2019 exampleInversionBader2001
#' @aliases exampleInversionHP1999fig4a exampleInversionHP1999fig4b
#' @aliases exampleInversionBergeron2005a exampleInversionBergeron2005b
#' @aliases exampleTranslocation exampleTranslocation2
#' @aliases exampleInsertion exampleDeletion
#'
Expand All @@ -35,6 +38,12 @@
#' exampleNestedInversions
#' exampleDoubleInversion1
#' exampleTwinInversions
#' exampleInversionGarg2019
#' exampleInversionBader2001
#' exampleInversionHP1999fig4a
#' exampleInversionHP1999fig4b
#' exampleInversionBergeron2005a
#' exampleInversionBergeron2005b
#' exampleTranslocation
#' exampleTranslocation2
#'
Expand Down
24 changes: 21 additions & 3 deletions R/breakpointGraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ breakpoint_graph <- function(p_extended) {

#' Interleaving Check
#'
#' This function checks if two edges are interleaving.
#'
#' @param p_extended The extended permutation.
#' @param graph_1 A cycle in the breakpoint graph.
#' @param graph_2 A cycle in the breakpoint graph.
#' @param edge_1 An edge in the breakpoint graph.
#' @param edge_2 An edge in the breakpoint graph.
#'
#' @importFrom igraph E V E<- V<- ends
#'
#' @author Bruna Fistarol
Expand Down Expand Up @@ -118,7 +126,7 @@ bp_count <- function(p_extended){
#'
#' This function computes the number of cycles in a breakpoint graph.
#'
#' @param p_extended The extended permutation.
#' @param g The breakpoint graph.
#'
#' @return The number of cycles in a breakpoint graph.
#'
Expand Down Expand Up @@ -202,7 +210,10 @@ components_graph <- function(g, p_extended) {

#' Count hurdles
#'
#' Count hurdles in the breakpoint graph.
#' This function finds hurdles in the breakpoint graph and returns them.
#'
#' @param g The breakpoint graph.
#' @param query_sequence_unsig The extended permutation.
#'
#' @importFrom igraph E V E<- V<- components ends
#'
Expand Down Expand Up @@ -325,7 +336,11 @@ hurdles_count <- function(g, query_sequence_unsig){

#' Count superhurdles
#'
#' Counts superhurdles in the breakpoint graph.
#' This function finds superhurdles in the breakpoint graph by checking which hurdles are superhurdles.
#'
#' @param info Object that stores the hurdles in the breakpoint graph.
#' @param g The breakpoint graph.
#' @param query_sequence_unsig The extended permutation.
#'
#' @importFrom igraph E V E<- V<- components ends
#'
Expand Down Expand Up @@ -492,6 +507,9 @@ superhurdles_count <- function(info, g, query_sequence_unsig){
#' Check fortrees
#'
#' Check whether or not the permutation is a fortress.
#' A permutation is a fortress if the number of hurdles is odd and all hurdles are superhurdles.
#'
#' @param superhurdles Object that stores the counts of hurdles and superhurdles in the breakpoint graph.
#'
#' @author Bruna Fistarol
#'
Expand Down
3 changes: 2 additions & 1 deletion R/inversionDistance.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#' inversionDistance(c(1, 3, -2, 4))
#'
#' # Example using a GBreaks object.
#' # This example is based on Figure 4(a) from Hannehalli and Pevzner (1999). The inversion distance is 8.
#' # This example is based on Figure 4(a) from Hannehalli and Pevzner (1999).
#' # The inversion distance is 8.
#' inversionDistance(exampleInversionHP1999fig4a)
#'
#' @seealso \code{\link{permutationVector}} for generating the permutation vector.
Expand Down
15 changes: 10 additions & 5 deletions R/inversionEstimate_BD.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,22 +280,27 @@ inversionEstimate_BD_many <- function(n, obs_nb_cycles, cyc_all=NA){
#'
#' @examples
#' \dontrun{
#'
#' # Create a chromosome mapping given a GBreaks object (useful when genomes are multichromosomal).
#' chrMapping <- matchPairs(exampleInversionBader2001)
#' # Compute the expected number of inversions using the method from Berestycki and Durrett (2006).
#' expNbInversions <- inversionEstimate_BD(chrMapping)
#' # Compute the minimum number of inversions using the method from Hannehalli and Pevzner (1999).
#' minNbInversions <- inversionDistance(chrMapping)
#' # Output: Example from Bader et al. (2001): Inversion distance = 7 , Expected nb. of inversions = 7
#' cat(paste("Example from Bader et al. (2001): Inversion distance =", minNbInversions, ", Expected nb. of inversions =", expNbInversions[[1]]$expinv_BD$k_avg))
#' # Output: Example from Bader et al. (2001):
#' # - Inversion distance = 7 , Expected nb. of inversions = 7
#' cat("Example from Bader et al. (2001):")
#' cat(paste("- Inversion distance =", minNbInversions))
#' cat(paste("- Expected nb. of inversions =", expNbInversions[[1]]$expinv_BD$k_avg))
#'
#' # Another example, this time without computing the chromosome mapping.
#' # The chromosome mapping is not needed if genomes are unichromosomal.
#' expNbInversions <- inversionEstimate_BD(exampleInversionBergeron2005b)
#' minNbInversions <- inversionDistance(exampleInversionBergeron2005b)
#' # Output: Example used in the book ``Mathematics of Evolution and Phylogeny`` (2005) (Figure 10.6): Inversion distance = 13 , Expected nb. of inversions = 15
#' cat(paste("Example used in the book ``Mathematics of Evolution and Phylogeny`` (2005) (Figure 10.6): Inversion distance =", minNbInversions, ", Expected nb. of inversions =", expNbInversions[[1]]$expinv_BD$k_avg))
#' # Output: Example used in the book ``Mathematics of Evolution and Phylogeny`` (2005) (Figure 10.6):
#' # - Inversion distance = 13 , Expected nb. of inversions = 15
#' cat("Example used in the book ``Mathematics of Evolution and Phylogeny`` (2005) (Figure 10.6):")
#' cat(paste("- Inversion distance =", minNbInversions))
#' cat(paste("- Expected nb. of inversions =", expNbInversions[[1]]$expinv_BD$k_avg))
#' }
#'
#' @seealso \code{\link{breakpointGraphProperties}} for computing key properties of the breakpoint graph needed for this estimate.
Expand Down
12 changes: 12 additions & 0 deletions man/StructuralVariants.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cycle_count.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/hurdles_count.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/inversionDistance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions man/inversionEstimate_BD.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/is_fortress.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion man/is_interleaving.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion man/superhurdles_count.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading