Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactored OrthoMCLParser

  • Loading branch information...
commit 68d592cfc2f5461f448f54eae3e1be810d228d17 1 parent c2d8170
@viklund viklund authored
Showing with 6 additions and 8 deletions.
  1. +6 −7 OrthoMCLParser.pm
  2. +0 −1  t/01_orthomcl_parser.t
View
13 OrthoMCLParser.pm
@@ -61,15 +61,14 @@ sub parse_groups {
foreach my $group (@passedGroups) {
# Stores positives in a 2d hasharray [X][Y] where Y=0-1 for a spec. X
# gives the organism-protein pair
- $group =~ /my_prefix(\d+)\:/;
- my $orthoID = $1;
- my @group = split /\||\s/, $group;
- my $lineSize = @group;
+ my ($orthoID, $proteinStr) = $group =~ /my_prefix(\d+):\s+(.*)$/;
+ my @proteins = split /\s+/, $proteinStr;
my @clusterArray;
-
- for(my $i=1;$i <=($lineSize-2); $i += 2){
- push @clusterArray, ["$group[$i]" , "$group[$i+1]"];
+
+ for my $protein ( @proteins ) {
+ push @clusterArray, [ split /\|/, $protein ];
}
+
$orthoHash{$orthoID} = \@clusterArray; #makes the hash an array ref.
}
return %orthoHash
View
1  t/01_orthomcl_parser.t
@@ -3,7 +3,6 @@ use strict;
use warnings;
use Test::More;
-use Data::Printer;
use OrthoMCLParser qw( parse_groups );
Please sign in to comment.
Something went wrong with that request. Please try again.