Hi There,
I’m currently wanting to make some changes to some phylogenies in R by reading
in the newick text as a string, rather than as a phylo object. The reason is
that the trees are large (~10,000 tips and another set with ~5000 tips) and I
must make changes to a complete set of these tree
Hi Karen.
One option is to use the function strsplit to split the Newick string by
character then identify the characters between each ) and the
following : and remove them. I have posted an example here on my blog:
Hi Karen,
You can use R's gsub function to do this. gsub replaces all occurrences of
a pattern(not just the first one, like sub) and you can use Regular
Expressions to match anything between ) and : or ;. You can try this
out:
gsub((?=\\)).*?(?=\\:|\\;), , my_newick_string, perl=T)
Have a
Hi Everyone,
Thanks for all the responses to my question about “find and replace” for my
very large newick strings. This function (thanks to Christie):
gsub((?=\\)).*?(?=\\:|\\;), , my_newick_string, perl=T) seems to do the
the trick. But thanks to everyone else who responded with other