From db66e442dd7b479867e583739a4b62fbc48a5384 Mon Sep 17 00:00:00 2001 From: mikessh Date: Mon, 8 Feb 2016 20:50:59 +0300 Subject: [PATCH] Version UPD, fix bug with broken domains/piis --- pom.xml | 2 +- .../es/unav/oncofuse/legacy/Oncofuse.groovy | 41 ++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 2e74de1..f993c60 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ es.unav oncofuse - 1.1.0 + 1.1.1 jar oncofuse diff --git a/src/main/groovy/es/unav/oncofuse/legacy/Oncofuse.groovy b/src/main/groovy/es/unav/oncofuse/legacy/Oncofuse.groovy index 6558d92..51f92bf 100644 --- a/src/main/groovy/es/unav/oncofuse/legacy/Oncofuse.groovy +++ b/src/main/groovy/es/unav/oncofuse/legacy/Oncofuse.groovy @@ -623,6 +623,18 @@ def fpg2DomainFeaturesMap = Collections.synchronizedMap(new HashMap + if (fpgPart.fivePrimeFpg ? + (region.aaTo <= fpgPart.aaPos) : (region.aaFrom >= fpgPart.aaPos)) + return 1 + else if (fpgPart.fivePrimeFpg ? + (region.aaFrom >= fpgPart.aaPos) : (region.aaTo <= fpgPart.aaPos)) + return -1 + else + return 0 +} + GParsPool.withPool THREADS, { fpgSet.eachParallel { FpgPart fpgPart -> def domainFeatures = new DomainFeatures() @@ -631,19 +643,28 @@ GParsPool.withPool THREADS, { domainFeatures.domainProfileBroken = new double[nThemes] def domains = domainData[fpgPart.geneName] domains.each { - if ((it.aaTo <= fpgPart.aaPos) == fpgPart.fivePrimeFpg) - domainFeatures.domainsRetained.add(it.featureId) - else if ((it.aaFrom >= fpgPart.aaPos) == fpgPart.fivePrimeFpg) - domainFeatures.domainsLost.add(it.featureId) - else - domainFeatures.domainsBroken.add(it.featureId) + switch(getRegionState(fpgPart, it)) { + case 1: + domainFeatures.domainsRetained.add(it.featureId) + break + case -1: + domainFeatures.domainsLost.add(it.featureId) + break + default: + domainFeatures.domainsBroken.add(it.featureId) + break + } } def piis = piiData[fpgPart.geneName] piis.each { - if ((it.aaTo <= fpgPart.aaPos) == fpgPart.fivePrimeFpg) - domainFeatures.piisRetained.add(it.featureId) - else if ((it.aaFrom >= fpgPart.aaPos) == fpgPart.fivePrimeFpg) - domainFeatures.piisLost.add(it.featureId) + switch(getRegionState(fpgPart, it)) { + case 1: + domainFeatures.piisRetained.add(it.featureId) + break + case -1: + domainFeatures.piisLost.add(it.featureId) + break + } } fpg2DomainFeaturesMap.put(fpgPart, domainFeatures) }