User Tools

Site Tools


doc:filter

Filter

Tool version

1.1.0

Keywords

Selection, Lines, Pattern, Operation, Comparison

Summary

Filters the data depending on a user specified conditional statement.

Description

This tool selects the data for which a specified conditional statement is right.

General comments (Warning/Tips)

If your data is not tab-delimited, use Text Manipulation→Convert.

Make sure that every line of the column being filtered fits the condition. If a line is invalid for a filter condition, it will be skipped. The number of skipped lines is displayed in the history item.

Synthax of the conditional statement:
Double equal signs, ==, must be used as “equal to”.
Make sure that multi-character logical operators contain no white space ( e.g., <= is valid while < = is not valid )
Non-numerical values (text) must be surrounded by single or double quotes.

Input

  • Filter: select the input file. It must be tab-delimited.
  • With following condition: enter the filtering condition. It can be either a calculation ( + - / * ) or a comparison ( < <= > >= == != ). So, the filtering condition can include logical operators. The operators need to be lower case. Note also that columns are referenced with c followed by a number. For example, c1 refers to the first column.

Examples:

  c1=='chr1' selects lines in which the first column is chr1
  c3-c2<c4 selects lines where subtracting column 2 from column 3 is less than the value of column 4
  len(c2.split(',')) < 4 selects lines where the second column has less than four comma separated elements
  c2*100>=400 selects lines in which the value of column 2 times 100 is greater than or equal to 400
  • Number of header lines to skip: give the corresponding number. These lines will be conserved in the output.

Output

The tab-delimited output dataset contains the lines selected by the condition.

Example

Usage Example: selecting all genes located between the positions 150 and 500.

Input

Filter: file_filter.txt

With following condition: 150<c2<500

Number of header lines to skip: 0

With file_filter.txt containing :

Output

Edited on

July 18th, 2014

doc/filter.txt · Last modified: 2014/11/28 17:03 by slegras