This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Separate table by diferent string patterns.

Hello community

I hope you can help me with this problem I have the following data frame obtained form StarkLab lines of enhancer construction reporters.

Lines <- data.frame(VTID = c("VT0006", "VT0007", "VT0112") , Chr = c("chr2L", "chr3R", "chr3L"), pattern = c("ubitquitous;4", "procephalic_ectoderm_AISN;4|posterior;3", "dorsal ectoderm anlage; 4|posterior_endoderm_AISN;2|posterior_endoderm_AISN;2" )

I want to obtain from the column "pattern" just the string that has the higher value after ";", i dont know how to do it given some strings are also divided by | some by two "|" other by 3 "|". If you have a best idea of how tu classify all the strings im open to suggestion. How would you solve it on R?

Thank you very much.

chip-seq strings

1 answer

Not sure about R, but pattern searching and matching is a common Unix pattern. Read up on grep and regular expressions.

Log in to answer this question.