From 5383c68bc6041a8e8eaab4258e7901b64d4cc081 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Sun, 29 May 2011 03:20:14 +0000 Subject: [PATCH] avoid multiple same dcs --- .../src/org/forester/surfacing/SurfacingUtil.java | 37 +++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/forester/java/src/org/forester/surfacing/SurfacingUtil.java b/forester/java/src/org/forester/surfacing/SurfacingUtil.java index a8e966d..8b1ffe7 100644 --- a/forester/java/src/org/forester/surfacing/SurfacingUtil.java +++ b/forester/java/src/org/forester/surfacing/SurfacingUtil.java @@ -1145,6 +1145,7 @@ public final class SurfacingUtil { counts.put( id, 1 ); } } + final Set dcs = new HashSet(); for( int i = 1; i < domains.size(); ++i ) { for( int j = 0; j < i; ++j ) { Domain domain_n = domains.get( i ); @@ -1153,22 +1154,26 @@ public final class SurfacingUtil { domain_n = domains.get( j ); domain_c = domains.get( i ); } - sb.append( protein.getSpecies() ); - sb.append( separator ); - sb.append( protein_id ); - sb.append( separator ); - sb.append( domain_n.getDomainId().getId() ); - sb.append( separator ); - sb.append( domain_c.getDomainId().getId() ); - sb.append( separator ); - sb.append( domain_n.getPerDomainEvalue() ); - sb.append( separator ); - sb.append( domain_c.getPerDomainEvalue() ); - sb.append( separator ); - sb.append( counts.get( domain_n.getDomainId().getId() ) ); - sb.append( separator ); - sb.append( counts.get( domain_c.getDomainId().getId() ) ); - sb.append( ForesterUtil.LINE_SEPARATOR ); + final String dc = domain_n.getDomainId().getId() + domain_c.getDomainId().getId(); + if ( !dcs.contains( dc ) ) { + dcs.add( dc ); + sb.append( protein.getSpecies() ); + sb.append( separator ); + sb.append( protein_id ); + sb.append( separator ); + sb.append( domain_n.getDomainId().getId() ); + sb.append( separator ); + sb.append( domain_c.getDomainId().getId() ); + sb.append( separator ); + sb.append( domain_n.getPerDomainEvalue() ); + sb.append( separator ); + sb.append( domain_c.getPerDomainEvalue() ); + sb.append( separator ); + sb.append( counts.get( domain_n.getDomainId().getId() ) ); + sb.append( separator ); + sb.append( counts.get( domain_c.getDomainId().getId() ) ); + sb.append( ForesterUtil.LINE_SEPARATOR ); + } } } } -- 1.7.10.2