Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split character column based on regular expression or delimiter #6755

Closed
KristinaGomoryova opened this issue Feb 13, 2025 · 2 comments
Closed

Comments

@KristinaGomoryova
Copy link

It would be nice to have a tool allowing to split a character column into (multiple) new columns based on a separator or regex.

An example would be I have dataframe like this:

var	value
Ubi4_1	26.17
Ubi4_2	26.30
Ubi4_3	22.88

I would like to split var column by "_" into condition and replicate columns, so the final result would be:

cond	rep 	value
Ubi4	1	26.17
Ubi4	2	26.30
Ubi4	3	22.88

In R, this can be achieved using e.g. the separate function from tidyr package or its modifications.

Thanks for considering!

@KristinaGomoryova
Copy link
Author

@hechth

@bernt-matthias
Copy link
Contributor

https://usegalaxy.eu/root?tool_id=toolshed.g2.bx.psu.edu/repos/galaxyp/regex_find_replace/regexColumn1/1.0.3

Something like the following should work:

  • use column 1
  • regex would be (.+)_(.+)
  • replacement \1\t\2

For the header column you need a second rule:

  • regex: cond
  • replacement cond\trep

Feel free to reopen if you have further questions

Maybe https://help.galaxyproject.org/ is also a good place for questions of this kind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants