Galaxy | Tool Preview

Regex Find And Replace (version 0.1.0)
Checks
Check 0

This tool goes line by line through the specified input file and replaces text which matches the specified regular expression patterns with its corresponding specified replacement.

This tool uses Python regular expressions. More information about Python regular expressions can be found here: http://docs.python.org/library/re.html.

To convert an Ilumina FATSQ sequence id from the CAVASA 8 format:

@EAS139:136:FC706VJ:2:2104:15343:197393 1:Y:18:ATCACG
GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACC
+EAS139:136:FC706VJ:2:2104:15343:197393 1:Y:18:ATCACG
IIIIIIIIIIIIIIIIIIIIIIIIIIIIII9IG9IC

To the CASAVA 7 format:

@EAS139_FC706VJ:2:2104:15343:197393#0/1
GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACC
+EAS139_FC706VJ:2:2104:15343:197393#0/1
IIIIIIIIIIIIIIIIIIIIIIIIIIIIII9IG9IC

Use Settings:

Find Regex: ^([@+][A-Z0-9]+):\d+:(\S+)\s(\d).*$
Replacement: \1_\2#0/\3

Note that the parentheses () capture patterns in the text that can be used in the replacement text by using a backslash-number reference: \1

The regex ^([@+][A-Z0-9]+):d+:(S+) (d).*$ means:

^  - start the match at the beginning of the line of text
(  - start a group (1), that is a string of matched text, that can be back-referenced in the replacement as \1
[@+]  - matches either a @ or + character
[A-Z0-9]+  - matches an uppercase letter or a digit, the plus sign means to match 1 or more such characters
)  - end a group (1), that is a string of matched text, that can be back-referenced in the replacement as \1
:\d+:   - matches a colon followed by one or more digits followed by a colon character
(\S+)  - matches one or more non-whitespace charcters,  the enclosing parentheses make this a group (2) that can back-referenced in the replacement text as \2
\s  - matches a whitespace character
(\d)  - matches a single digit character,  the enclosing parentheses make this a group (3) that can back-referenced in the replacement text as \3
.*  - dot means match any character, asterisk means zero more more matches
$  - the regex must match to the end of the line of text

Galaxy aggressively escapes input supplied to tools, so if something is not working please let us know and we can look into whether this is the cause. Also if you would like help constructing regular expressions for your inputs, please let us know at help@msi.umn.edu.