I have three strings as shown below:
"GO:0016559~peroxisome fission,"
"GO:0006122~mitochondrial electron transport, ubiquinol to cytochrome c,"
"GO:0006122~mitochondrial electron transport, ubiquinol to cytochrome c,GO:0006334~nucleosome assembly,"
How do I extract all occurrences of substrings after "~" and before "," (which is either the end of the string or is succeeded by GO:.........,)?
Desired output:
"peroxisome fission"
"mitochondrial electron transport, ubiquinol to cytochrome c"
"mitochondrial electron transport, ubiquinol to cytochrome c" "nucleosome assembly"
This is to be achieved in one generalised statement in R.
I tried using this:
strapplyc(str, "[~](.*?)[,]", simplify = c)
(where str is a variable which stores each of the three strings, one at a time, in a loop)
But the output I got is:
"peroxisome fission"
"mitochondrial electron transport"
"mitochondrial electron transport" "nucleosome assembly"