Mercurial > repos > earlhaminst > hcluster_sg_parser
annotate hcluster_sg_parser.pl @ 0:dbc49bd1a3e9 draft
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
author | earlhaminst |
---|---|
date | Mon, 12 Dec 2016 07:12:23 -0500 |
parents | |
children |
rev | line source |
---|---|
0
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
1 #!/usr/bin/perl |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
2 # |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
3 use strict; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
4 use warnings; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
5 # A simple perl parser to convert hcluster_sg 3-column output into list of ids in separate files |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
6 # hcluster_sg_parser.pl <file> |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
7 |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
8 my $file1 = $ARGV[0]; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
9 open my $fh1, '<', $file1; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
10 |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
11 while (my $line = <$fh1>) { |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
12 chomp $line; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
13 my @row = split(/\t/, $line); |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
14 |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
15 my $cluster_id = $row[0]; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
16 my $id_list = $row[2]; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
17 # Change commas to newlines |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
18 $id_list =~ s/\,/\n/g; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
19 |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
20 my $outfile = $cluster_id."_output.txt"; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
21 open(my $fh, '>', $outfile) or die "Could not open file '$outfile' for writing: $!"; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
22 print $fh $id_list; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
23 close $fh; |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
24 } |
dbc49bd1a3e9
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/hcluster_sg_parser commit 75c6b4d9bd23cdd5f8e5626b1b01f2abba32c274-dirty
earlhaminst
parents:
diff
changeset
|
25 close $fh1; |