# NOT RUN {
info.txt.gz <- system.file(
"extdata", "SweeD_Info.txt.gz", package="nc")
info.vec <- readLines(info.txt.gz)
info.vec[24:40]
## For each Alignment there are many fields which have a similar
## pattern, and occur in the same order. One way to capture these
## fields is by coding a pattern that says to look for all of those
## fields in that order. Each field is defined using this helper
## function.
g <- function(name, fun=identity, suffix=list()){
list(
"\t+",
name,
":\t+",
nc::group(name, ".*"),
fun,
suffix,
"\n+")
}
nc::capture_all_str(
info.vec,
"Alignment ",
alignment="[0-9]+",
"\n+",
g("Chromosome"),
g("Sequences", as.integer),
g("Sites", as.integer),
g("Discarded sites", as.integer),
g("Processing", as.integer, " seconds"),
g("Position", as.integer),
g("Likelihood", as.numeric),
g("Alpha", as.numeric))
# }
Run the code above in your browser using DataLab