From 19bb2c924ce5a95a8bf7617538baebe19457ae07 Mon Sep 17 00:00:00 2001 From: Anton Nekrutenko Date: Mon, 9 Feb 2009 23:57:41 -0500 Subject: [PATCH] A simple tool for merging columns. Surprisingly useful for some analyses and also requested by a user lest Friday --- static/welcome.html | 16 +++++----- tool_conf.xml.sample | 3 +- tools/filters/mergeCols.py | 25 ++++++++++++++++ tools/filters/mergeCols.xml | 47 ++++++++++++++++++++++++++++++ tools/sr_mapping/lastz_wrapper.xml | 18 ++++++------ 5 files changed, 91 insertions(+), 18 deletions(-) create mode 100644 tools/filters/mergeCols.py create mode 100644 tools/filters/mergeCols.xml diff --git a/static/welcome.html b/static/welcome.html index fa9b2ee91a1..8f8ebf1cc87 100644 --- a/static/welcome.html +++ b/static/welcome.html @@ -32,7 +32,7 @@
Introducing Galactic Quickies
- Galactic quickies are super-short screencasts that are always under 5 minutes. We thought it may be a good way to spread the word about Galaxy's functionality while keeping the "annoyance factor" to the minimum. The quickies will be updated weekly. + Galactic quickies are super-short screencasts that are always under 5 minutes. We thought it may be a good way to spread the word about Galaxy's functionality while keeping the "annoyance factor" to the minimum. The quickies are updated weekly. For previous quickies click here.
@@ -40,8 +40,8 @@

- For a high resolution version click here. + For a high resolution version click here.

diff --git a/tool_conf.xml.sample b/tool_conf.xml.sample index b70330e3a0d..a047871b85e 100644 --- a/tool_conf.xml.sample +++ b/tool_conf.xml.sample @@ -41,7 +41,8 @@ - + + diff --git a/tools/filters/mergeCols.py b/tools/filters/mergeCols.py new file mode 100644 index 00000000000..7fb26348dfd --- /dev/null +++ b/tools/filters/mergeCols.py @@ -0,0 +1,25 @@ +import sys, re + +def stop_err( msg ): + sys.stderr.write( msg ) + sys.exit() + +def __main__(): + infile = open ( sys.argv[1], 'r') + cols = ( re.sub( '\s*','',sys.argv[2] ) ).split( ',' ) + outfile = open ( sys.argv[3], 'w') + + for line in infile: + line = line.rstrip( '\r\n' ) + if line and not line.startswith( '#' ): + fields = line.split( '\t' ) + line += '\t' + for col in cols: + try: + line += fields[ int( col.lstrip( 'c' ) ) -1 ] + except: + stop_err( 'Column %s does not appear in the input file' % str( col ) ) + print >>outfile, line + + +if __name__ == "__main__" : __main__() \ No newline at end of file diff --git a/tools/filters/mergeCols.xml b/tools/filters/mergeCols.xml new file mode 100644 index 00000000000..26d98a861af --- /dev/null +++ b/tools/filters/mergeCols.xml @@ -0,0 +1,47 @@ + + together + mergeCols.py $input "$columnList" $out_file1 + + + + + + + + + + + + + + + + +**What it does** + +This tool merges columns together + +- Columns are specified as **c1**, **c2**, and so on. Column count begins with **1** +- Columns can be specified in any order (e.g., **c2,c1,c6**) + + +----- + +**Example** + +Input dataset (five columns: c1, c2, c3, c4, and c5):: + + 1 10 1000 gene1 chr + 2 100 1500 gene2 chr + +merging columns "**c5,c1**" will return:: + + 1 10 1000 gene1 chr chr1 + 2 100 1500 gene2 chr chr2 + +.. class:: infomark + +Note that all original columns are preserved and the result of merge is added as the rightmost column. + + + diff --git a/tools/sr_mapping/lastz_wrapper.xml b/tools/sr_mapping/lastz_wrapper.xml index f29d5fb7168..48e0eec12ea 100644 --- a/tools/sr_mapping/lastz_wrapper.xml +++ b/tools/sr_mapping/lastz_wrapper.xml @@ -1,14 +1,14 @@ map short reads against reference sequence - #if ($params.source_select=="pre_set" and $seq_name.how_to_name=="No" and $out_format.value=="diffs"):#lastz $input1 ${input2}[fullnames] --${params.pre_set_options} --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="pre_set" and $seq_name.how_to_name=="Yes" and $out_format.value=="diffs"):#lastz $seq_name.ref_name::$input1 ${input2}[fullnames] --${params.pre_set_options} --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="full" and $seq_name.how_to_name=="No" and $out_format.value=="diffs"):#lastz $input1 ${input2}[fullnames] $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="full" and $seq_name.how_to_name=="Yes" and $out_format.value=="diffs"):#lastz $seq_name.ref_name::$input1 ${input2}[fullnames] $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="pre_set" and $seq_name.how_to_name=="No" and $out_format.value=="maf"):#lastz $input1 read::${input2} --${params.pre_set_options} --ambiguousn --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="pre_set" and $seq_name.how_to_name=="Yes" and $out_format.value=="maf"):#lastz $seq_name.ref_name::$input1 read::${input2} --${params.pre_set_options} --ambiguousn --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="full" and $seq_name.how_to_name=="No" and $out_format.value=="maf"):#lastz $input1 read::${input2} $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 - #elif ($params.source_select=="full" and $seq_name.how_to_name=="Yes" and $out_format.value=="maf"):#lastz $seq_name.ref_name::$input1 read::${input2} $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --identity=${min_ident}..${max_ident} --census=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #if ($params.source_select=="pre_set" and $seq_name.how_to_name=="No" and $out_format.value=="diffs"):#lastz $input1 ${input2}[fullnames] --${params.pre_set_options} --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="pre_set" and $seq_name.how_to_name=="Yes" and $out_format.value=="diffs"):#lastz $seq_name.ref_name::$input1 ${input2}[fullnames] --${params.pre_set_options} --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="full" and $seq_name.how_to_name=="No" and $out_format.value=="diffs"):#lastz $input1 ${input2}[fullnames] $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="full" and $seq_name.how_to_name=="Yes" and $out_format.value=="diffs"):#lastz $seq_name.ref_name::$input1 ${input2}[fullnames] $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --nolaj --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="pre_set" and $seq_name.how_to_name=="No" and $out_format.value=="maf"):#lastz $input1 read::${input2} --${params.pre_set_options} --ambiguousn --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="pre_set" and $seq_name.how_to_name=="Yes" and $out_format.value=="maf"):#lastz $seq_name.ref_name::$input1 read::${input2} --${params.pre_set_options} --ambiguousn --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="full" and $seq_name.how_to_name=="No" and $out_format.value=="maf"):#lastz $input1 read::${input2} $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 + #elif ($params.source_select=="full" and $seq_name.how_to_name=="Yes" and $out_format.value=="maf"):#lastz $seq_name.ref_name::$input1 read::${input2} $params.strand $params.seed $params.transition O=$params.O E=$params.E X=$params.X Y=$params.Y K=$params.K L=$params.L $params.entropy --ambiguousn --identity=${min_ident}..${max_ident} --census32=$output2 --coverage=$min_cvrg --format=$out_format > $output1 #end if @@ -16,7 +16,7 @@ - +