# HG changeset patch # User earlhaminst # Date 1481544743 18000 # Node ID dbc49bd1a3e9eb636dc5b8f7ab2f3cce5c835833 planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty diff -r 000000000000 -r dbc49bd1a3e9 hcluster_sg_parser.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hcluster_sg_parser.pl Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,25 @@ +#!/usr/bin/perl +# +use strict; +use warnings; +# A simple perl parser to convert hcluster_sg 3-column output into list of ids in separate files +# hcluster_sg_parser.pl + +my $file1 = $ARGV[0]; +open my $fh1, '<', $file1; + +while (my $line = <$fh1>) { + chomp $line; + my @row = split(/\t/, $line); + + my $cluster_id = $row[0]; + my $id_list = $row[2]; + # Change commas to newlines + $id_list =~ s/\,/\n/g; + + my $outfile = $cluster_id."_output.txt"; + open(my $fh, '>', $outfile) or die "Could not open file '$outfile' for writing: $!"; + print $fh $id_list; + close $fh; +} +close $fh1; diff -r 000000000000 -r dbc49bd1a3e9 hcluster_sg_parser.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hcluster_sg_parser.xml Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,35 @@ + + Converts hcluster_sg 3-column output into lists of ids + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r dbc49bd1a3e9 test-data/0_output.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/0_output.txt Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,20 @@ +90 +52 +76 +48 +88 +78 +31 +46 +4 +29 +6 +60 +80 +37 +33 +64 +66 +62 +42 +57 diff -r 000000000000 -r dbc49bd1a3e9 test-data/1_output.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/1_output.txt Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,10 @@ +70 +21 +72 +84 +26 +86 +14 +10 +19 +53 diff -r 000000000000 -r dbc49bd1a3e9 test-data/2_output.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/2_output.txt Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,5 @@ +74 +68 +2 +24 +58 diff -r 000000000000 -r dbc49bd1a3e9 test-data/3_output.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/3_output.txt Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,5 @@ +82 +18 +9 +12 +39 diff -r 000000000000 -r dbc49bd1a3e9 test-data/hcluster_sg.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/hcluster_sg.tabular Mon Dec 12 07:12:23 2016 -0500 @@ -0,0 +1,4 @@ +0 20 90,52,76,48,88,78,31,46,4,29,6,60,80,37,33,64,66,62,42,57, +1 10 70,21,72,84,26,86,14,10,19,53, +2 5 74,68,2,24,58, +3 5 82,18,9,12,39,