View source: R/visualise_methylation.R
| extract_methylation_from_dataframe | R Documentation |
This function takes a dataframe that contains methylation information in the form of
locations (indices along the read signifying bases at which modification probability
was assessed) and probabilities (the probability of modification at each assessed
location, as an integer from 0 to 255).
Each observation/row in the dataframe represents one sequence (e.g. a Nanopore read).
In the locations and probabilities column, each sequence (row) has many numbers associated.
These are stored as one string per observation e.g. "3,6,9,12", with the column representing
a character vector of such strings (e.g. c("3,6,9,12", "1,2,3,4")).
This function calls extract_and_sort_sequences() on each of these three columns and returns
a list of vectors stored in $locations, $probabilities, and $lengths.
These can then be used as input for visualise_methylation().
Default arguments are set up to work with the included example_many_sequences data.
extract_methylation_from_dataframe(
modification_data,
locations_colname = "methylation_locations",
probabilities_colname = "methylation_probabilities",
lengths_colname = "sequence_length",
grouping_levels = c(family = 8, individual = 2),
sort_by = "sequence_length",
desc_sort = TRUE
)
modification_data |
|
locations_colname |
|
probabilities_colname |
|
lengths_colname |
|
grouping_levels |
|
sort_by |
|
desc_sort |
|
list, containing $locations (character vector), $probabilities (character vector), and $lengths (numeric vector).
## See documentation for extract_and_sort_sequences()
## for more examples of changing sorting/grouping
extract_methylation_from_dataframe(
example_many_sequences,
locations_colname = "methylation_locations",
probabilities_colname = "methylation_probabilities",
lengths_colname = "sequence_length",
grouping_levels = c("family" = 8, "individual" = 2),
sort_by = "sequence_length",
desc_sort = TRUE
)
extract_methylation_from_dataframe(
example_many_sequences,
locations_colname = "hydroxymethylation_locations",
probabilities_colname = "hydroxymethylation_probabilities",
lengths_colname = "sequence_length",
grouping_levels = c("family" = 8, "individual" = 2),
sort_by = "sequence_length",
desc_sort = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.