diff --git a/tools/filters/trimmer.py b/tools/filters/trimmer.py index 800a515e349..d1126822a01 100644 --- a/tools/filters/trimmer.py +++ b/tools/filters/trimmer.py @@ -88,6 +88,9 @@ options (listed below) default to 'None' if omitted if col == 0: if int( options.end ) > 0: line = line[ int( options.start )-1 : int( options.end ) ] + elif int( options.end ) < 0: + endposition = len(line)+int( options.end ) + line = line[ int( options.start )-1 : endposition ] else: line = line[ int( options.start )-1 : ] else: @@ -97,6 +100,9 @@ options (listed below) default to 'None' if omitted if int( options.end ) > 0: fields[col - 1] = fields[col - 1][ int( options.start )-1 : int( options.end ) ] + elif int( options.end ) < 0: + endposition = len(fields[col - 1])+int( options.end ) + fields[col - 1] = fields[col - 1][ int( options.start )-1 : endposition ] else: fields[col - 1] = fields[col - 1][ int( options.start )-1 : ] line = '\t'.join(fields) diff --git a/tools/filters/trimmer.xml b/tools/filters/trimmer.xml index da33c0d810e..786e29c1766 100644 --- a/tools/filters/trimmer.xml +++ b/tools/filters/trimmer.xml @@ -6,9 +6,9 @@ - - - + + + @@ -53,7 +53,15 @@ - + + + + + + + + + @@ -72,7 +80,7 @@ Trimming this dataset:: 1234567890 abcdefghijk -by setting **Trim from the beginning to this position** to *2* and **Remove everything from this position to the end** to *6* will produce:: +by setting **Trim from the beginning up to this position** to *2* and **Remove everything from this position to the end** to *6* will produce:: 23456 bcdef @@ -86,13 +94,27 @@ Trimming column 2 of this dataset:: abcde 12345 fghij 67890 fghij 67890 abcde 12345 -by setting **Trim content of this column only** to *2*, **Trim from the beginning to this position** to *2*, and **Remove everything from this position to the end** to *4* will produce:: +by setting **Trim content of this column only** to *2*, **Trim from the beginning up to this position** to *2*, and **Remove everything from this position to the end** to *4* will produce:: abcde 234 fghij 67890 fghij 789 abcde 12345 ----- +**Example 3** + +Trimming column 2 of this dataset:: + + abcde 12345 fghij 67890 + fghij 67890 abcde 12345 + +by setting **Trim content of this column only** to *2*, **Trim from the beginning up to this position** to *2*, and **Remove everything from this position to the end** to *-2* will produce:: + + abcde 23 fghij 67890 + fghij 78 abcde 12345 + +---- + **Trimming FASTQ datasets** This tool can be used to trim sequences and quality strings in fastq datasets. This is done by selected *Yes* from the **Is input dataset in fastq format?** dropdown. If set to *Yes*, the tool will skip all even numbered lines (see warning below). For example, trimming last 5 bases of this dataset::