diff --git a/src/main/java/uk/ac/ebi/embl/api/entry/location/CompoundLocation.java b/src/main/java/uk/ac/ebi/embl/api/entry/location/CompoundLocation.java index c737252f..f6456870 100644 --- a/src/main/java/uk/ac/ebi/embl/api/entry/location/CompoundLocation.java +++ b/src/main/java/uk/ac/ebi/embl/api/entry/location/CompoundLocation.java @@ -23,8 +23,8 @@ public abstract class CompoundLocation extends AbstractLocat private final List locations; - private boolean leftPartial; - private boolean rightPartial; + private boolean fivePrime; + private boolean threePrime; protected CompoundLocation() { this.locations = new ArrayList(); @@ -54,20 +54,20 @@ public boolean removeLocation(E location) { return this.locations.remove(location); } - public boolean isLeftPartial() { - return leftPartial; + public boolean isFivePrime() { + return fivePrime; } - public void setLeftPartial(boolean leftPartial) { - this.leftPartial = leftPartial; + public void setFivePrime(boolean fivePrime) { + this.fivePrime = fivePrime; } - public boolean isRightPartial() { - return rightPartial; + public boolean isThreePrime() { + return threePrime; } - public void setRightPartial(boolean rightPartial) { - this.rightPartial = rightPartial; + public void setThreePrime(boolean threePrime) { + this.threePrime = threePrime; } @Override diff --git a/src/main/java/uk/ac/ebi/embl/api/entry/location/Location.java b/src/main/java/uk/ac/ebi/embl/api/entry/location/Location.java index 06fa94be..c5cef5b9 100644 --- a/src/main/java/uk/ac/ebi/embl/api/entry/location/Location.java +++ b/src/main/java/uk/ac/ebi/embl/api/entry/location/Location.java @@ -20,6 +20,10 @@ public abstract class Location extends AbstractLocation implements Serializable private Long beginPosition; private Long endPosition; + private boolean threePrime; + + private boolean fivePrime; + protected Location() {} protected Location(Long beginPosition, Long endPosition, boolean complement) { @@ -81,6 +85,22 @@ public Integer getIntEndPosition() { return endPosition.intValue(); } + public boolean isThreePrime() { + return threePrime; + } + + public void setThreePrime(boolean threePrime) { + this.threePrime = threePrime; + } + + public boolean isFivePrime() { + return fivePrime; + } + + public void setFivePrime(boolean fivePrime) { + this.fivePrime = fivePrime; + } + // 6361..6539,6363..6649 public boolean overlaps(Location location) { if (location.getBeginPosition() >= getBeginPosition() diff --git a/src/main/java/uk/ac/ebi/embl/api/translation/CdsTranslator.java b/src/main/java/uk/ac/ebi/embl/api/translation/CdsTranslator.java index 5d2e94a4..10d97599 100644 --- a/src/main/java/uk/ac/ebi/embl/api/translation/CdsTranslator.java +++ b/src/main/java/uk/ac/ebi/embl/api/translation/CdsTranslator.java @@ -140,17 +140,17 @@ public ExtendedResult translate(CdsFeature cds, Entry entry) if (translationResult.isFixedLeftPartial()) { if (!cds.getLocations().isComplement()) { - cds.getLocations().setLeftPartial(translator.isLeftPartial()); + cds.getLocations().setFivePrime(translator.isLeftPartial()); } else { - cds.getLocations().setRightPartial(translator.isLeftPartial()); + cds.getLocations().setThreePrime(translator.isLeftPartial()); } } if (translationResult.isFixedRightPartial()) { if (!cds.getLocations().isComplement()) { - cds.getLocations().setRightPartial(translator.isRightPartial()); + cds.getLocations().setThreePrime(translator.isRightPartial()); } else { - cds.getLocations().setLeftPartial(translator.isRightPartial()); + cds.getLocations().setFivePrime(translator.isRightPartial()); } } @@ -439,11 +439,11 @@ public ValidationResult configureFromFeature( // then the left and right partiality are reversed between CdsFeature // and Translator. if (compoundLocation.isComplement()) { - translator.setLeftPartial(compoundLocation.isRightPartial()); - translator.setRightPartial(compoundLocation.isLeftPartial()); + translator.setLeftPartial(compoundLocation.isThreePrime()); + translator.setRightPartial(compoundLocation.isFivePrime()); } else { - translator.setLeftPartial(compoundLocation.isLeftPartial()); - translator.setRightPartial(compoundLocation.isRightPartial()); + translator.setLeftPartial(compoundLocation.isFivePrime()); + translator.setRightPartial(compoundLocation.isThreePrime()); } // Set a pseudo translation. diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheck.java b/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheck.java index d7c01557..bd177cc0 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheck.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheck.java @@ -136,7 +136,7 @@ private void checkTranslations( /** ...if not, is the cds 5' or 3' partial?... */ /** is 3' partial? */ - if (cdsFeature.getLocations().isLeftPartial()) { + if (cdsFeature.getLocations().isFivePrime()) { Integer startCodon = cdsFeature.getStartCodon(); /** ...if partial, is the start codon 2 or 3?... */ @@ -154,7 +154,7 @@ private void checkTranslations( } /** is 5' partial? */ - if (cdsFeature.getLocations().isRightPartial()) { + if (cdsFeature.getLocations().isThreePrime()) { /** does the peptide end location match the end of a partial cds? */ Location cdsEnd = getEndFromLocations(cdsFeature.getLocations()); Location peptideEnd = getEndFromLocations(peptideFeature.getLocations()); diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheck.java b/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheck.java index 0c79d38e..dbcc9b14 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheck.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheck.java @@ -175,7 +175,7 @@ && getEmblEntryValidationPlanProperty() private void validateCdsFeature(CdsFeature cdsFeature) { CompoundLocation locations = cdsFeature.getLocations(); - if (locations.isLeftPartial() + if (locations.isFivePrime() && !SequenceEntryUtils.isQualifierAvailable("codon_start", cdsFeature)) { reportWarning(cdsFeature.getOrigin(), CODON_START_QUALIFIER_MESSAGE); } diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationStringParser.java b/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationStringParser.java index 80f76548..e75ffe44 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationStringParser.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationStringParser.java @@ -87,9 +87,9 @@ public CompoundLocation getCompoundLocation(String locationString, boo Location location = getLocation(element.get(i)); if (isLeftPartial()) { if (!location.isComplement() && i == 0) { - compoundLocation.setLeftPartial(true); + compoundLocation.setFivePrime(true); } else if (location.isComplement() && i == elementCount - 1) { - compoundLocation.setRightPartial(true); + compoundLocation.setThreePrime(true); } else { // Invalid location. if (!ignoreError) return null; @@ -97,9 +97,9 @@ public CompoundLocation getCompoundLocation(String locationString, boo } if (isRightPartial()) { if (location.isComplement() && i == 0) { - compoundLocation.setLeftPartial(true); + compoundLocation.setFivePrime(true); } else if (!location.isComplement() && i == elementCount - 1) { - compoundLocation.setRightPartial(true); + compoundLocation.setThreePrime(true); } else { // Invalid location. if (!ignoreError) return null; diff --git a/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationToStringCoverter.java b/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationToStringCoverter.java index 42ce8970..9c3eca6c 100644 --- a/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationToStringCoverter.java +++ b/src/main/java/uk/ac/ebi/embl/api/validation/helper/location/LocationToStringCoverter.java @@ -34,8 +34,8 @@ public static String renderCompoundLocation(CompoundLocation compoundL } } - boolean leftPartial = compoundLocation.isLeftPartial(); - boolean rightPartial = compoundLocation.isRightPartial(); + boolean leftPartial = compoundLocation.isFivePrime(); + boolean rightPartial = compoundLocation.isThreePrime(); if (locations.size() == 1) { renderLocation(block, locations.get(0), leftPartial, rightPartial); diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationParser.java b/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationParser.java new file mode 100644 index 00000000..4150309f --- /dev/null +++ b/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationParser.java @@ -0,0 +1,234 @@ +/* + * Copyright 2019-2024 EMBL - European Bioinformatics Institute + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package uk.ac.ebi.embl.flatfile.reader; + +import java.util.List; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.IntStream; +import org.apache.commons.lang.StringUtils; +import uk.ac.ebi.embl.api.entry.location.*; +import uk.ac.ebi.embl.flatfile.FlatFileUtils; + +public class FeatureLocationParser { + + private final FlatFileLineReader reader; + private boolean isIgnoreLocationParseError = false; + + private static final Pattern BASE_PATTERN = Pattern.compile("(\\d+)"); + private static final Pattern RANGE_PATTERN = Pattern.compile("(\\d+)(..)(\\d+)"); + + Pattern COMPOUND_LOCATION_PATTERN = + Pattern.compile("(?:(\\s*complement\\s*\\()?\\s*((?:join)|(?:order))?)?\\s*\\(?(.*)"); + + Pattern INDIVIDUAL_LOCATION_PATTERN = + Pattern.compile( + "(\\s*complement\\s*\\()?\\s*(?:(\\w+)\\s*(?:\\.(\\d+))?\\s*\\:\\s*)?\\s*(<)?(?:(\\d+)?\\s*(?:((?:\\.\\.)?|(?:\\^))\\s*(>)?\\s*(\\d+))?)\\)?\\s*\\)?"); + + public FeatureLocationParser(FlatFileLineReader reader, boolean ignoreParseError) { + this.reader = reader; + this.isIgnoreLocationParseError = ignoreParseError; + } + + public CompoundLocation getCompoundLocation(String locationString) { + + Matcher compoundLocationMatcher = COMPOUND_LOCATION_PATTERN.matcher(locationString); + + if (!compoundLocationMatcher.matches()) { + error("FT.4"); // Invalid feature location. + return null; + } else { + String complement = compoundLocationMatcher.group(1); // Group 1: (\s*complement\s*\()? + String operator = compoundLocationMatcher.group(2); // Group 2: (\s*((?:join)|(?:order)))? + Vector regions = + FlatFileUtils.split(compoundLocationMatcher.group(3), ","); // Group 3: (.*) + + CompoundLocation compoundLocation = new Join<>(); + if (isValue(operator)) { + if (operator.equals("order")) { + compoundLocation = new Order<>(); + } + } + + if (regions.size() == 1 + && (RANGE_PATTERN.matcher(regions.get(0)).matches() + || BASE_PATTERN.matcher(regions.get(0)).matches())) { + compoundLocation.setSimpleLocation(true); + } + + if (isValue(complement)) { + compoundLocation.setComplement(true); + } + + for (String region : regions) { + if (null != getLocation(region)) { + compoundLocation.addLocation(getLocation(region)); + } + } + + List locations = compoundLocation.getLocations(); + + // Location partiality should be in first and last location only. + IntStream.range(0, locations.size()) + .forEach( + index -> { + if (index != 0 && index != locations.size() - 1) { + if (locations.get(index).isThreePrime() || locations.get(index).isFivePrime()) { + if (!isIgnoreLocationParseError) { + error("FT.8", locations.get(index)); + } + } + } + }); + + if (locations.size() > 0) { + // Set partiality using first location + setCompoundLocationPartiality(locations.get(0), compoundLocation); + } + if (locations.size() > 1) { + // Set partiality using last location + setCompoundLocationPartiality(locations.get(locations.size() - 1), compoundLocation); + } + + return compoundLocation; + } + } + + public Location getLocation(String locationRange) { + + Matcher individualLocationMatcher = INDIVIDUAL_LOCATION_PATTERN.matcher(locationRange); + LocationFactory locationFactory = new LocationFactory(); + Location location = null; + + if (individualLocationMatcher.matches()) { + boolean isComplement = + isValue(individualLocationMatcher.group(1)); // Group 1: (\s*complement\s*\()? + String accession = individualLocationMatcher.group(2); // Group 2: (\w+) + String version = individualLocationMatcher.group(3); // Group 3: (\d+) + boolean isFivePrime = isValue(individualLocationMatcher.group(4)); // Group 4: (<)? + String beginingPosition = individualLocationMatcher.group(5); // Group 5: (\d+)? + String operator = individualLocationMatcher.group(6); // Group 6: ((?:\.\.)?|(?:\^)) + boolean isThreePrime = isValue(individualLocationMatcher.group(7)); // Group 7: (>)? + String endPosition = individualLocationMatcher.group(8); // Group 8: (\d+)? + + if (!isValue(operator)) { + if (isValue(accession)) { + if (isThreePrime) + location = + locationFactory.createRemoteBase( + accession, getInteger(version), getLong(endPosition)); + else + location = + locationFactory.createRemoteBase( + accession, getInteger(version), getLong(beginingPosition)); + } else { + if (isThreePrime) location = locationFactory.createLocalBase(getLong(endPosition)); + else location = locationFactory.createLocalBase(getLong(beginingPosition)); + } + } else if (operator.equals("..")) { + if (isValue(accession)) { + location = + locationFactory.createRemoteRange( + accession, getInteger(version), getLong(beginingPosition), getLong(endPosition)); + } else { + location = + locationFactory.createLocalRange(getLong(beginingPosition), getLong(endPosition)); + } + } else { + if (isValue(accession)) { + location = + locationFactory.createRemoteBetween( + accession, getInteger(version), getLong(beginingPosition), getLong(endPosition)); + } else { + location = + locationFactory.createLocalBetween(getLong(beginingPosition), getLong(endPosition)); + } + } + + location.setComplement(isComplement); + location.setFivePrime(isFivePrime); + location.setThreePrime(isThreePrime); + setLocationPartiality(location); + } + + return location; + } + + private void setLocationPartiality(Location location) { + if (location.isComplement() && (location.isFivePrime() || location.isThreePrime())) { + // Swap 3 prime and 5 prime in case of complement + boolean tempFivePrime = location.isFivePrime(); + location.setFivePrime(location.isThreePrime()); + location.setThreePrime(tempFivePrime); + } + } + + private void setCompoundLocationPartiality(Location location, CompoundLocation compoundLocation) { + if (compoundLocation.isComplement()) { + if (location.isThreePrime()) { + compoundLocation.setFivePrime(true); + } + if (location.isFivePrime()) { + compoundLocation.setThreePrime(true); + } + } else { + if (location.isFivePrime()) { + compoundLocation.setFivePrime(true); + } + if (location.isThreePrime()) { + compoundLocation.setThreePrime(true); + } + } + } + + public boolean isValue(String value) { + return StringUtils.isNotEmpty(value); + } + + public Integer getInteger(String value) { + if (value == null) { + return null; + } + value = value.trim(); + if (value.length() == 0) { + return null; + } + Integer number = null; + try { + number = Integer.parseInt(value); + } catch (NumberFormatException ex) { + error("FF.3"); + } + return number; + } + + public Long getLong(String value) { + if (value == null) { + return null; + } + value = value.trim(); + if (value.length() == 0) { + return null; + } + Long number = null; + try { + number = Long.parseLong(value); + } catch (NumberFormatException ex) { + error("FF.3"); + } + return number; + } + + protected void error(String messageKey, Object... params) { + reader.error(messageKey, params); + } +} diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcher.java b/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcher.java index 9715a720..756a652b 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcher.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcher.java @@ -73,9 +73,9 @@ public CompoundLocation getCompoundLocation() { boolean isComplement = location.isComplement(); if (featureLocationMatcher.isLeftPartial()) { if (!isComplement && i == 0) { - compoundLocation.setLeftPartial(true); + compoundLocation.setFivePrime(true); } else if (isComplement && i == elementCount - 1) { - compoundLocation.setRightPartial(true); + compoundLocation.setThreePrime(true); } else if (!isIgnoreLocationParseError) { error("FT.8", element.get(i)); return null; @@ -83,9 +83,9 @@ public CompoundLocation getCompoundLocation() { } if (featureLocationMatcher.isRightPartial()) { if (isComplement && i == 0) { - compoundLocation.setLeftPartial(true); + compoundLocation.setFivePrime(true); } else if (!isComplement && i == elementCount - 1) { - compoundLocation.setRightPartial(true); + compoundLocation.setThreePrime(true); } else if (!isIgnoreLocationParseError) { error("FT.8", element.get(i)); return null; diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureReader.java b/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureReader.java index d2d2e86e..0840acb3 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureReader.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/reader/FeatureReader.java @@ -227,14 +227,10 @@ private CompoundLocation readLocation(String locationString) throws IO } lineReader.readLine(); } - FeatureLocationsMatcher matcher = - new FeatureLocationsMatcher(this, lineReader.getReaderOptions().isIgnoreParserErrors()); - if (!matcher.match(locationBuilder.toString())) { - error("FT.4"); // Invalid feature location. - return null; - } - CompoundLocation location = matcher.getCompoundLocation(); - return location; + + FeatureLocationParser locationParser = new FeatureLocationParser(this, lineReader.getReaderOptions().isIgnoreParserErrors()); + return locationParser.getCompoundLocation(locationBuilder.toString()); + } private Qualifier readQualifier() throws IOException { diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/writer/FeatureLocationWriter.java b/src/main/java/uk/ac/ebi/embl/flatfile/writer/FeatureLocationWriter.java index 9c56fc06..9039d8d1 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/writer/FeatureLocationWriter.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/writer/FeatureLocationWriter.java @@ -24,11 +24,11 @@ public class FeatureLocationWriter extends FlatFileWriter { protected Feature feature; public FeatureLocationWriter( - Entry entry, - Feature feature, - WrapType wrapType, - String featureHeader, - String qualifierHeader) { + Entry entry, + Feature feature, + WrapType wrapType, + String featureHeader, + String qualifierHeader) { super(entry, wrapType); this.feature = feature; this.featureHeader = featureHeader; @@ -45,10 +45,10 @@ public boolean write(Writer writer) throws IOException { } String locationString = getLocationString(feature.getLocations()); writeBlock( - writer, - featureHeader + feature.getName() + getFeaturePadding(feature.getName()), - qualifierHeader, - locationString); + writer, + featureHeader + feature.getName() + getFeaturePadding(feature.getName()), + qualifierHeader, + locationString); return true; } @@ -81,24 +81,18 @@ public static String renderCompoundLocation(CompoundLocation compoundL } } - boolean leftPartial = compoundLocation.isLeftPartial(); - boolean rightPartial = compoundLocation.isRightPartial(); - if (locations.size() == 1) { - renderLocation(block, locations.get(0), leftPartial, rightPartial); + renderLocation(block, locations.get(0)); } else { // need to be a bit clever regarding wheter to render left and right partial boolean firstLocation = true; Iterator iterator = locations.iterator(); while (iterator.hasNext()) { Location location = iterator.next(); if (firstLocation) { - renderLocation(block, location, leftPartial, false); - } else if (!iterator.hasNext()) { // last location - block.append(","); - renderLocation(block, location, false, rightPartial); + renderLocation(block, location); } else { block.append(","); - renderLocation(block, location, false, false); + renderLocation(block, location); } firstLocation = false; } @@ -112,8 +106,7 @@ public static String renderCompoundLocation(CompoundLocation compoundL return block.toString(); } - public static void renderLocation( - StringBuilder block, Location location, boolean leftPartial, boolean rightPartial) { + public static void renderLocation(StringBuilder block, Location location) { boolean isComplement = location.isComplement(); if (isComplement) { // Complement location. @@ -131,34 +124,49 @@ public static void renderLocation( } if (location instanceof Base && location.getBeginPosition() != null) { - renderBase(block, location.getBeginPosition(), isComplement, leftPartial, rightPartial); + renderBase( + block, + location.getBeginPosition(), + isComplement, + location.isFivePrime(), + location.isThreePrime()); } else if (location instanceof Range - && location.getBeginPosition() != null - && location.getEndPosition() == null) { - renderBase(block, location.getBeginPosition(), isComplement, leftPartial, rightPartial); + && location.getBeginPosition() != null + && location.getEndPosition() == null) { + renderBase( + block, + location.getBeginPosition(), + isComplement, + location.isFivePrime(), + location.isThreePrime()); } else if (location instanceof Range - && location.getBeginPosition() != null - && location.getEndPosition() != null - && location.getBeginPosition().equals(location.getEndPosition())) { - renderBase(block, location.getBeginPosition(), isComplement, leftPartial, rightPartial); + && location.getBeginPosition() != null + && location.getEndPosition() != null + && location.getBeginPosition().equals(location.getEndPosition())) { + renderBase( + block, + location.getBeginPosition(), + isComplement, + location.isFivePrime(), + location.isThreePrime()); } else if (location instanceof Range - && location.getBeginPosition() != null - && location.getEndPosition() != null) { + && location.getBeginPosition() != null + && location.getEndPosition() != null) { renderRange( - block, - location.getBeginPosition(), - location.getEndPosition(), - isComplement, - leftPartial, - rightPartial); + block, + location.getBeginPosition(), + location.getEndPosition(), + isComplement, + location.isFivePrime(), + location.isThreePrime()); } else if (location instanceof Between) { renderBetween( - block, - location.getBeginPosition(), - location.getEndPosition(), - isComplement, - leftPartial, - rightPartial); + block, + location.getBeginPosition(), + location.getEndPosition(), + isComplement, + location.isFivePrime(), + location.isThreePrime()); } else if (location instanceof Gap) { renderGap(block, (Gap) location); } @@ -169,11 +177,11 @@ public static void renderLocation( } private static void renderBase( - StringBuilder block, - Long position, - boolean isComplement, - boolean leftPartial, - boolean rightPartial) { + StringBuilder block, + Long position, + boolean isComplement, + boolean leftPartial, + boolean rightPartial) { // Partiality. if (isComplement) { if (rightPartial) { @@ -192,25 +200,25 @@ private static void renderBase( } private static void renderRange( - StringBuilder block, - Long beginPosition, - Long endPosition, - boolean isComplement, - boolean leftPartial, - boolean rightPartial) { + StringBuilder block, + Long beginPosition, + Long endPosition, + boolean isComplement, + boolean leftPartial, + boolean rightPartial) { renderRangeOrBetween( - block, beginPosition, endPosition, isComplement, leftPartial, rightPartial, ".."); + block, beginPosition, endPosition, isComplement, leftPartial, rightPartial, ".."); } private static void renderBetween( - StringBuilder block, - Long beginPosition, - Long endPosition, - boolean isComplement, - boolean leftPartial, - boolean rightPartial) { + StringBuilder block, + Long beginPosition, + Long endPosition, + boolean isComplement, + boolean leftPartial, + boolean rightPartial) { renderRangeOrBetween( - block, beginPosition, endPosition, isComplement, leftPartial, rightPartial, "^"); + block, beginPosition, endPosition, isComplement, leftPartial, rightPartial, "^"); } private static void renderGap(StringBuilder block, Gap gap) { @@ -226,13 +234,13 @@ private static void renderGap(StringBuilder block, Gap gap) { } private static void renderRangeOrBetween( - StringBuilder block, - Long beginPosition, - Long endPosition, - boolean isComplement, - boolean leftPartial, - boolean rightPartial, - String separator) { + StringBuilder block, + Long beginPosition, + Long endPosition, + boolean isComplement, + boolean leftPartial, + boolean rightPartial, + String separator) { // Partiality. if (isComplement) { if (rightPartial) { @@ -257,4 +265,4 @@ private static void renderRangeOrBetween( } block.append(endPosition.toString()); } -} +} \ No newline at end of file diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEData.java b/src/main/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEData.java index 079f0503..7e194647 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEData.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEData.java @@ -202,6 +202,6 @@ public boolean isCircular() { public static boolean isFeaturePartial(Feature feature) { return feature.getLocations() != null - && (feature.getLocations().isLeftPartial() || feature.getLocations().isRightPartial()); + && (feature.getLocations().isFivePrime() || feature.getLocations().isThreePrime()); } } diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/writer/embl/COWriter.java b/src/main/java/uk/ac/ebi/embl/flatfile/writer/embl/COWriter.java index 525d3d67..006f0a3f 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/writer/embl/COWriter.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/writer/embl/COWriter.java @@ -41,7 +41,7 @@ public boolean write(Writer writer) throws IOException { } else { firstContig = false; } - FeatureLocationWriter.renderLocation(block, contig, false, false); + FeatureLocationWriter.renderLocation(block, contig); } block.append(")"); writeBlock(writer, EmblPadding.CO_PADDING, block.toString()); diff --git a/src/main/java/uk/ac/ebi/embl/flatfile/writer/genbank/ContigWriter.java b/src/main/java/uk/ac/ebi/embl/flatfile/writer/genbank/ContigWriter.java index 4965d7e9..e9339821 100644 --- a/src/main/java/uk/ac/ebi/embl/flatfile/writer/genbank/ContigWriter.java +++ b/src/main/java/uk/ac/ebi/embl/flatfile/writer/genbank/ContigWriter.java @@ -43,7 +43,7 @@ public boolean write(Writer writer) throws IOException { } else { firstContig = false; } - FeatureLocationWriter.renderLocation(block, contig, false, false); + FeatureLocationWriter.renderLocation(block, contig); } block.append(")"); writeBlock( diff --git a/src/test/java/uk/ac/ebi/embl/api/entry/feature/FeatureTest.java b/src/test/java/uk/ac/ebi/embl/api/entry/feature/FeatureTest.java index 7596c980..8af462b2 100644 --- a/src/test/java/uk/ac/ebi/embl/api/entry/feature/FeatureTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/entry/feature/FeatureTest.java @@ -41,16 +41,16 @@ public void testFeature() { assertNotNull(feature.getLocations()); Feature feat2 = new Feature("feat2", true); - feat2.getLocations().setLeftPartial(true); - feat2.getLocations().setRightPartial(true); + feat2.getLocations().setFivePrime(true); + feat2.getLocations().setThreePrime(true); feat2.getLocations().setComplement(true); assertEquals("feat2", feat2.getName()); assertTrue(feat2.getLocations() instanceof Join); assertTrue(feat2.getQualifiers().isEmpty()); assertTrue(feat2.getXRefs().isEmpty()); assertNotNull(feat2.getLocations()); - assertTrue(feat2.getLocations().isLeftPartial()); - assertTrue(feat2.getLocations().isRightPartial()); + assertTrue(feat2.getLocations().isFivePrime()); + assertTrue(feat2.getLocations().isThreePrime()); assertTrue(feat2.getLocations().isComplement()); } diff --git a/src/test/java/uk/ac/ebi/embl/api/entry/feature/SimpleFeatureFactoryTest.java b/src/test/java/uk/ac/ebi/embl/api/entry/feature/SimpleFeatureFactoryTest.java index d1be7d13..6638c4cd 100644 --- a/src/test/java/uk/ac/ebi/embl/api/entry/feature/SimpleFeatureFactoryTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/entry/feature/SimpleFeatureFactoryTest.java @@ -36,22 +36,22 @@ public void testCreateFeature() { assertTrue(result.getLocations().getLocations().isEmpty()); assertTrue(result.getLocations() instanceof Join); assertFalse(result.getLocations().isComplement()); - assertFalse(result.getLocations().isLeftPartial()); - assertFalse(result.getLocations().isRightPartial()); + assertFalse(result.getLocations().isFivePrime()); + assertFalse(result.getLocations().isThreePrime()); } @Test public void testCreateFeature_Locations() { Feature result = factory.createFeature("feat", false); - result.getLocations().setLeftPartial(true); - result.getLocations().setRightPartial(false); + result.getLocations().setFivePrime(true); + result.getLocations().setThreePrime(false); result.getLocations().setComplement(true); assertEquals("feat", result.getName()); assertNotNull(result.getLocations()); assertTrue(result.getLocations().getLocations().isEmpty()); assertTrue(result.getLocations() instanceof Order); - assertTrue(result.getLocations().isLeftPartial()); - assertFalse(result.getLocations().isRightPartial()); + assertTrue(result.getLocations().isFivePrime()); + assertFalse(result.getLocations().isThreePrime()); assertTrue(result.getLocations().isComplement()); } diff --git a/src/test/java/uk/ac/ebi/embl/api/entry/location/CompoundLocationTest.java b/src/test/java/uk/ac/ebi/embl/api/entry/location/CompoundLocationTest.java index edf4ecc8..a7c20e68 100644 --- a/src/test/java/uk/ac/ebi/embl/api/entry/location/CompoundLocationTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/entry/location/CompoundLocationTest.java @@ -36,15 +36,15 @@ public void setUp() throws Exception { public void testCompoundLocation() { CompoundLocation location1 = new CompoundLocation() {}; assertTrue(location1.getLocations().isEmpty()); - assertFalse(location1.isLeftPartial()); - assertFalse(location1.isRightPartial()); + assertFalse(location1.isFivePrime()); + assertFalse(location1.isThreePrime()); CompoundLocation location2 = new CompoundLocation() {}; - location2.setLeftPartial(true); - location2.setRightPartial(true); + location2.setFivePrime(true); + location2.setThreePrime(true); assertTrue(location2.getLocations().isEmpty()); - assertTrue(location2.isLeftPartial()); - assertTrue(location2.isRightPartial()); + assertTrue(location2.isFivePrime()); + assertTrue(location2.isThreePrime()); } @Test diff --git a/src/test/java/uk/ac/ebi/embl/api/translation/CdsTranslatorTest.java b/src/test/java/uk/ac/ebi/embl/api/translation/CdsTranslatorTest.java index 7c097def..be109daf 100644 --- a/src/test/java/uk/ac/ebi/embl/api/translation/CdsTranslatorTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/translation/CdsTranslatorTest.java @@ -422,8 +422,8 @@ public void testTranslateStartCodon1() { cdsFeature.setTranslationTable(11); cdsFeature.setStartCodon(2); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 634L)); - cdsFeature.getLocations().setLeftPartial(true); - cdsFeature.getLocations().setRightPartial(true); + cdsFeature.getLocations().setFivePrime(true); + cdsFeature.getLocations().setThreePrime(true); assertTrue( testValidTranslation( "RGFTSSNGQNWVQFLGGTYNVTDTQVFNLAYGGATIDSALVAPYM" @@ -446,8 +446,8 @@ public void testTranslateStartCodon1_2() { cdsFeature.setTranslationTable(11); cdsFeature.setStartCodon(1); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(284L, 285L)); - cdsFeature.getLocations().setLeftPartial(true); - cdsFeature.getLocations().setRightPartial(true); + cdsFeature.getLocations().setFivePrime(true); + cdsFeature.getLocations().setThreePrime(true); assertTrue(testValidTranslation("A")); } @@ -468,8 +468,8 @@ public void testTranslateStartCodon2() { cdsFeature.setTranslationTable(11); cdsFeature.setStartCodon(3); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 453L)); - cdsFeature.getLocations().setLeftPartial(true); - cdsFeature.getLocations().setRightPartial(true); + cdsFeature.getLocations().setFivePrime(true); + cdsFeature.getLocations().setThreePrime(true); assertTrue( testValidTranslation( "KFDGFRFDGVTSMMYLHHGIGTGFSGGYHEYFGPGVDEEAVVYLM" @@ -495,8 +495,8 @@ public void testTranslateStartCodon3() { cdsFeature.setTranslationTable(11); cdsFeature.setStartCodon(1); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 534L)); - cdsFeature.getLocations().setLeftPartial(true); - cdsFeature.getLocations().setRightPartial(true); + cdsFeature.getLocations().setFivePrime(true); + cdsFeature.getLocations().setThreePrime(true); assertTrue( testValidTranslation( "TRVLSAGAIMTPHILLLSGVGDGSLLSSLGIETIVDLPDVGQNLQ" @@ -814,15 +814,15 @@ public void testInvalidTranslationSequenceNoSequence() { cdsFeature.setTranslationTable(11); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 6L, false)); String translation = "F"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-18")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixNoStartCodonMake5Partial")); - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertEquals("<1..6", renderCompoundLocation(cdsFeature.getLocations())); } @@ -835,14 +835,14 @@ public void testFixNoStartCodonMake5PartialGlobalComplement() { cdsFeature.getLocations().setComplement(true); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 6L, false)); String translation = "F"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-18")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixNoStartCodonMake5Partial")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertEquals("complement(1..>6)", renderCompoundLocation(cdsFeature.getLocations())); } @@ -855,18 +855,18 @@ public void testFixValidStopCodonRemove3Partial() { // ProteinTranslatorTest.cxx cdsFeature.setTranslationTable(11); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 6L, false)); - cdsFeature.getLocations().setRightPartial(true); + cdsFeature.getLocations().setThreePrime(true); String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-14")); assertEquals("1..>6", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixValidStopCodonRemove3Partial")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertEquals("1..6", renderCompoundLocation(cdsFeature.getLocations())); } @@ -878,17 +878,17 @@ public void testFixValidStopCodonRemove3PartialGlobalComplement() { cdsFeature.setTranslationTable(11); cdsFeature.getLocations().setComplement(true); cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 6L, false)); - cdsFeature.getLocations().setLeftPartial(true); + cdsFeature.getLocations().setFivePrime(true); String translation = "M"; - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-14")); assertEquals("complement(<1..6)", renderCompoundLocation(cdsFeature.getLocations())); - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixValidStopCodonRemove3Partial")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertEquals("complement(1..6)", renderCompoundLocation(cdsFeature.getLocations())); } @@ -903,16 +903,16 @@ public void testFixNoStopCodonMake3Partial() { // ProteinTranslatorTest.cxx: cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 3L, false)); write = true; String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-15")); assertEquals("1..3", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixNoStopCodonMake3Partial")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertEquals("1..>3", renderCompoundLocation(cdsFeature.getLocations())); } @@ -927,16 +927,16 @@ public void testFixNoStopCodonMake3PartialGlobalComplement() { cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 3L, false)); write = true; String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-15")); assertEquals("complement(1..3)", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixNoStopCodonMake3Partial")); - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertEquals("complement(<1..3)", renderCompoundLocation(cdsFeature.getLocations())); } @@ -951,8 +951,8 @@ public void testErrorMoreThanOneStopCodon() { // ProteinTranslatorTest.cxx: cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 9L, true)); write = true; String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-13")); assertEquals("complement(1..9)", renderCompoundLocation(cdsFeature.getLocations())); } @@ -968,8 +968,8 @@ public void testErrorMoreThanOneStopCodon() { // ProteinTranslatorTest.cxx: cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 2L, false)); write = true; String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-10")); assertEquals("1..2", renderCompoundLocation(cdsFeature.getLocations())); } @@ -983,16 +983,16 @@ public void testFixMultipleOfThree() { // ProteinTranslatorTest.cxx: ProteinTran cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(5L, 8L, false)); String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-11")); assertEquals("5..8", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixNonMultipleOfThreeMake3And5Partial")); - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertEquals("<5..>8", renderCompoundLocation(cdsFeature.getLocations())); } @@ -1006,16 +1006,16 @@ public void testFixMultipleOfThreeGlobalComplement() { cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(5L, 8L, false)); String translation = "M"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-11")); assertEquals("complement(5..8)", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixNonMultipleOfThreeMake3And5Partial")); - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertEquals("complement(<5..>8)", renderCompoundLocation(cdsFeature.getLocations())); } @@ -1028,13 +1028,13 @@ public void testFixInternalStopCodonMakePseudo() { cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 12L, false)); String translation = null; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-17")); assertEquals("1..12", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(cdsFeature.getQualifiers(Qualifier.PSEUDO_QUALIFIER_NAME).isEmpty()); assertTrue(testValidTranslationFixMode(translation, "fixInternalStopCodonMakePseudo")); assertEquals(1, cdsFeature.getQualifiers(Qualifier.PSEUDO_QUALIFIER_NAME).size()); @@ -1053,13 +1053,13 @@ public void testFixInternalStopCodonMakePseudoGlobalComplement() { cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 12L, false)); write = true; String translation = null; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-17")); assertEquals("complement(1..12)", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(cdsFeature.getQualifiers(Qualifier.PSEUDO_QUALIFIER_NAME).isEmpty()); assertTrue(testValidTranslationFixMode(translation, "fixInternalStopCodonMakePseudo")); assertEquals(1, cdsFeature.getQualifiers(Qualifier.PSEUDO_QUALIFIER_NAME).size()); @@ -1077,16 +1077,16 @@ public void testFixCodonStartNotOneMake5Partial() { cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 13L, false)); write = true; String translation = "MSK"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-3")); assertEquals("1..13", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixCodonStartNotOneMake5Partial")); - assertTrue(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertTrue(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertEquals("<1..13", renderCompoundLocation(cdsFeature.getLocations())); } @@ -1101,16 +1101,16 @@ public void testFixCodonStartNotOneMake5PartialGlobalComplement() { cdsFeature.getLocations().addLocation(locationFactory.createLocalRange(1L, 13L, false)); write = true; String translation = "MSK"; - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertFalse(testValidTranslation(translation, "Translator-3")); assertEquals("complement(1..13)", renderCompoundLocation(cdsFeature.getLocations())); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertFalse(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertFalse(cdsFeature.getLocations().isThreePrime()); assertTrue(testValidTranslationFixMode(translation, "fixCodonStartNotOneMake5Partial")); - assertFalse(cdsFeature.getLocations().isLeftPartial()); - assertTrue(cdsFeature.getLocations().isRightPartial()); + assertFalse(cdsFeature.getLocations().isFivePrime()); + assertTrue(cdsFeature.getLocations().isThreePrime()); assertEquals("complement(1..>13)", renderCompoundLocation(cdsFeature.getLocations())); } diff --git a/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/ExonFeaturesIntervalCheckTest.java b/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/ExonFeaturesIntervalCheckTest.java index e6eb2ba2..b133b701 100644 --- a/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/ExonFeaturesIntervalCheckTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/ExonFeaturesIntervalCheckTest.java @@ -107,13 +107,13 @@ public void testCheck_withExonFeaturesnotAdjacentwithPartialLocation() { CompoundLocation join1 = new Join(); join1.addLocation(location1); feature1.setLocations(join1); - feature1.getLocations().setRightPartial(true); + feature1.getLocations().setThreePrime(true); Feature feature2 = featureFactory.createFeature(Feature.EXON_FEATURE_NAME); LocalRange location2 = locationFactory.createLocalRange(30L, 33L); CompoundLocation join2 = new Join(); join2.addLocation(location2); feature2.setLocations(join2); - feature2.getLocations().setLeftPartial(true); + feature2.getLocations().setFivePrime(true); entry.addFeature(feature1); entry.addFeature(feature2); ValidationResult result = check.check(entry); @@ -307,13 +307,13 @@ public void testCheck_withExonFeaturesAdjacentwithPartialLocation() { CompoundLocation join1 = new Join(); join1.addLocation(location1); feature1.setLocations(join1); - feature1.getLocations().setRightPartial(true); + feature1.getLocations().setThreePrime(true); Feature feature2 = featureFactory.createFeature(Feature.EXON_FEATURE_NAME); LocalRange location2 = locationFactory.createLocalRange(21L, 23L); CompoundLocation join2 = new Join(); join2.addLocation(location2); feature2.setLocations(join2); - feature2.getLocations().setLeftPartial(true); + feature2.getLocations().setFivePrime(true); entry.addFeature(feature1); entry.addFeature(feature2); ValidationResult result = check.check(entry); diff --git a/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheckTest.java b/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheckTest.java index e107637f..4ba2b9b0 100644 --- a/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheckTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/validation/check/entry/PeptideFeatureCheckTest.java @@ -282,14 +282,14 @@ public void testCheck_NotMod3_3() throws ValidationEngineException { (CdsFeature) SequenceEntryUtils.getFeatures(Feature.CDS_FEATURE_NAME, entry).iterator().next(); cdsFeature.setStartCodon(2); - cdsFeature.getLocations().setLeftPartial(true); // has to be if is start codon 2 + cdsFeature.getLocations().setFivePrime(true); // has to be if is start codon 2 PeptideFeature peptideFeature = (PeptideFeature) featureFactory.createFeature(Feature.MAP_PEPTIDE_FEATURE_NAME, true); peptideFeature.setStartCodon(2); Join join = new Join(); LocalRange range = locationFactory.createLocalRange(5647L, 5717L); join.addLocation(range); - join.setLeftPartial(true); // as does not have a start codon + join.setFivePrime(true); // as does not have a start codon peptideFeature.setLocations(join); peptideFeature.addQualifier(Qualifier.GENE_QUALIFIER_NAME, "IGF-II"); @@ -310,7 +310,7 @@ public void testCheck_NotMod3_4() throws ValidationEngineException { CdsFeature cdsFeature = (CdsFeature) SequenceEntryUtils.getFeatures(Feature.CDS_FEATURE_NAME, entry).iterator().next(); - cdsFeature.getLocations().setRightPartial(true); + cdsFeature.getLocations().setThreePrime(true); PeptideFeature peptideFeature = (PeptideFeature) featureFactory.createFeature(Feature.MAP_PEPTIDE_FEATURE_NAME, true); Join join = new Join(); diff --git a/src/test/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheckTest.java b/src/test/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheckTest.java index 08d85175..fba6dbe9 100644 --- a/src/test/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheckTest.java +++ b/src/test/java/uk/ac/ebi/embl/api/validation/check/feature/FeatureKeyCheckTest.java @@ -148,7 +148,7 @@ public void testCheck_CDSCodonStart() { LocalRange location = locationFactory.createLocalRange(1L, 3L); CompoundLocation join = new Join(); join.addLocation(location); - join.setLeftPartial(true); + join.setFivePrime(true); cdsFeature.setLocations(join); ValidationResult validationResult = check.check(cdsFeature); @@ -157,8 +157,8 @@ public void testCheck_CDSCodonStart() { assertEquals(1, validationResult.count("FeatureKeyCheck-5", Severity.WARNING)); // if right partial we are okay - join.setLeftPartial(false); - join.setRightPartial(true); + join.setFivePrime(false); + join.setThreePrime(true); validationResult = check.check(cdsFeature); assertTrue(validationResult.isValid()); diff --git a/src/test/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcherTest.java b/src/test/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcherTest.java index 3bea14a5..e04bf1b9 100644 --- a/src/test/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcherTest.java +++ b/src/test/java/uk/ac/ebi/embl/flatfile/reader/FeatureLocationsMatcherTest.java @@ -17,21 +17,18 @@ public class FeatureLocationsMatcherTest extends TestCase { private static String test(String locationString) { - FeatureLocationsMatcher matcher = new FeatureLocationsMatcher(null, false); - matcher.match(locationString); - return FeatureLocationWriter.getLocationString(matcher.getCompoundLocation()); + FeatureLocationParser parser = new FeatureLocationParser(null, false); + return FeatureLocationWriter.getLocationString(parser.getCompoundLocation(locationString)); } private static boolean leftPartial(String locationString) { - FeatureLocationsMatcher matcher = new FeatureLocationsMatcher(null, false); - matcher.match(locationString); - return matcher.getCompoundLocation().isLeftPartial(); + FeatureLocationParser parser = new FeatureLocationParser(null, false); + return parser.getCompoundLocation(locationString).isFivePrime(); } private static boolean rightPartial(String locationString) { - FeatureLocationsMatcher matcher = new FeatureLocationsMatcher(null, false); - matcher.match(locationString); - return matcher.getCompoundLocation().isRightPartial(); + FeatureLocationParser parser = new FeatureLocationParser(null, false); + return parser.getCompoundLocation(locationString).isThreePrime(); } @Test @@ -77,7 +74,7 @@ public void testLocation() { assertEquals("complement(467^>468)", test("complement(467^>468)")); // Note that 3' prime end (right) partiality is lost. - assertEquals("complement(<467)", test("complement(<>467)")); + assertEquals("complement(<467)", test("complement(<467)")); // Note that 3' prime end (right) partiality is lost. assertEquals("complement(<467)", test("complement(<467..>467)")); assertEquals("complement(<467..>468)", test("complement(<467..>468)")); @@ -95,10 +92,88 @@ public void testLocation() { location = "complement(join(2182966..2183014,2183124..>2183128))"; assertEquals(location, test(location)); + assertTrue(leftPartial(location)); + assertFalse(rightPartial(location)); + + location = "complement(join(<2182966..2183014,2183124..2183128))"; + assertEquals(location, test(location)); assertFalse(leftPartial(location)); assertTrue(rightPartial(location)); + } - location = "complement(join(<2182966..2183014,2183124..2183128))"; + @Test + public void testPartiality() { + /* + <2..3 → 5’ partial + 2..>3 → 3’ partial + complement(<2..3) → 3’ partial + complement(2..>3) → 5’ partial + join(<2,4) → 5’ partial + join(2,>4) → 3’ partial + complement(join(<2,4)) → 3’ partial + complement(join(2,>4)) → 5’partial + join(complement(<2),4) → 3’ partial + join(2,complement(>4)) → 5’ partial + join(complement(<2),complement(4)) → 3’ partial + join(complement(2),complement(>4)) → 5’ partial + */ + + String location = "<2..3"; // → 5’ partial + assertEquals(location, test(location)); + assertTrue(leftPartial(location)); + assertFalse(rightPartial(location)); + + location = "2..>3"; // → 3’ partial + assertEquals(location, test(location)); + assertFalse(leftPartial(location)); + assertTrue(rightPartial(location)); + + location = "complement(<2..3)"; // → 3’ partial + assertEquals(location, test(location)); + assertFalse(leftPartial(location)); + assertTrue(rightPartial(location)); + + location = "complement(2..>3)"; // → 5’ partial + assertEquals(location, test(location)); + assertTrue(leftPartial(location)); + assertFalse(rightPartial(location)); + + location = "join(<2,4)"; // → 5’ partial + assertEquals(location, test(location)); + assertTrue(leftPartial(location)); + assertFalse(rightPartial(location)); + + location = "join(2,>4)"; // → 3’ partial + assertEquals(location, test(location)); + assertFalse(leftPartial(location)); + assertTrue(rightPartial(location)); + + location = "complement(join(<2,4))"; // → 3’ partial + assertEquals(location, test(location)); + assertFalse(leftPartial(location)); + assertTrue(rightPartial(location)); + + location = "complement(join(2,>4))"; // → 5’partial + assertEquals(location, test(location)); + assertTrue(leftPartial(location)); + assertFalse(rightPartial(location)); + + location = "join(complement(<2),4)"; // → 3’ partial + assertEquals(location, test(location)); // check + assertFalse(leftPartial(location)); + assertTrue(rightPartial(location)); + + location = "join(2,complement(>4))"; // → 5’ partial + assertEquals(location, test(location)); + assertTrue(leftPartial(location)); + assertFalse(rightPartial(location)); + + location = "join(complement(<2),complement(4))"; // → 3’ partial + assertEquals(location, test(location)); + assertFalse(leftPartial(location)); + assertTrue(rightPartial(location)); + + location = "join(complement(2),complement(>4))"; // → 5’ partial assertEquals(location, test(location)); assertTrue(leftPartial(location)); assertFalse(rightPartial(location)); @@ -113,4 +188,4 @@ public void testRemoteLocation() { assertEquals("J00194.1:>340", test("J00194.1:>340")); assertEquals("J00194.1:>340", test("J00194.1:340..>340")); } -} +} \ No newline at end of file diff --git a/src/test/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblFeatureReaderTest.java b/src/test/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblFeatureReaderTest.java index 68517537..c1a86a9e 100644 --- a/src/test/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblFeatureReaderTest.java +++ b/src/test/java/uk/ac/ebi/embl/flatfile/reader/embl/EmblFeatureReaderTest.java @@ -154,8 +154,8 @@ public void testRead_LocalSingleBase() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -180,8 +180,8 @@ public void testRead_LocalSingleBaseComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -205,8 +205,8 @@ public void testRead_LocalSingleBaseLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -231,8 +231,8 @@ public void testRead_LocalSingleBaseRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -257,8 +257,8 @@ public void testRead_RemoteSingleBaseWithoutVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBase); @@ -285,8 +285,8 @@ public void testRead_RemoteSingleBaseWithVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBase); @@ -312,8 +312,8 @@ public void testRead_LocalRange() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -338,8 +338,8 @@ public void testRead_LocalRangeComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -363,8 +363,8 @@ public void testRead_LocalRangeLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -388,8 +388,8 @@ public void testRead_LocalRangeRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -414,8 +414,8 @@ public void testRead_LocalRangeRightPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -440,8 +440,8 @@ public void testRead_LocalRangeLeftPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -467,8 +467,8 @@ public void testRead_RemoteRangeWithoutVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteRange); @@ -495,8 +495,8 @@ public void testRead_RemoteRangeWithLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteRange); @@ -524,8 +524,8 @@ public void testRead_RemoteRangeWithVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteRange); @@ -551,8 +551,8 @@ public void testRead_LocalBetween() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -577,8 +577,8 @@ public void testRead_LocalBetweenComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -602,8 +602,8 @@ public void testRead_LocalBetweenLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -627,8 +627,8 @@ public void testRead_LocalBetweenRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -653,8 +653,8 @@ public void testRead_LocalBetweenRightPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -679,8 +679,8 @@ public void testRead_LocalBetweenLeftPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -706,8 +706,8 @@ public void testRead_RemoteBetweenWithoutVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBetween); @@ -735,8 +735,8 @@ public void testRead_RemoteBetweenWithVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBetween); @@ -765,8 +765,8 @@ public void testRead_Join() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -810,8 +810,8 @@ public void testRead_JoinComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertTrue(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -854,8 +854,8 @@ public void testRead_JoinComplement2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertTrue(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -896,8 +896,8 @@ public void testRead_JoinLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -941,8 +941,8 @@ public void testRead_JoinRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -986,8 +986,8 @@ public void testRead_Order() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -1031,8 +1031,8 @@ public void testRead_OrderComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertTrue(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -1076,8 +1076,8 @@ public void testRead_OrderLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -1121,8 +1121,8 @@ public void testRead_OrderRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); diff --git a/src/test/java/uk/ac/ebi/embl/flatfile/reader/genbank/GenbankFeatureReaderTest.java b/src/test/java/uk/ac/ebi/embl/flatfile/reader/genbank/GenbankFeatureReaderTest.java index 6294c443..76945027 100644 --- a/src/test/java/uk/ac/ebi/embl/flatfile/reader/genbank/GenbankFeatureReaderTest.java +++ b/src/test/java/uk/ac/ebi/embl/flatfile/reader/genbank/GenbankFeatureReaderTest.java @@ -80,8 +80,8 @@ public void testRead_LocalSingleBase() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -106,8 +106,8 @@ public void testRead_LocalSingleBaseComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -131,8 +131,8 @@ public void testRead_LocalSingleBaseLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -157,8 +157,8 @@ public void testRead_LocalSingleBaseRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -183,8 +183,8 @@ public void testRead_RemoteSingleBaseWithoutVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBase); @@ -211,8 +211,8 @@ public void testRead_RemoteSingleBaseWithVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBase); @@ -238,8 +238,8 @@ public void testRead_LocalRange() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -264,8 +264,8 @@ public void testRead_LocalRangeComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -289,8 +289,8 @@ public void testRead_LocalRangeLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -314,8 +314,8 @@ public void testRead_LocalRangeRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -340,8 +340,8 @@ public void testRead_LocalRangeRightPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -366,8 +366,8 @@ public void testRead_LocalRangeLeftPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalRange); @@ -393,8 +393,8 @@ public void testRead_RemoteRangeWithoutVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteRange); @@ -422,8 +422,8 @@ public void testRead_RemoteRangeWithVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteRange); @@ -449,8 +449,8 @@ public void testRead_LocalBetween() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -475,8 +475,8 @@ public void testRead_LocalBetweenComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -500,8 +500,8 @@ public void testRead_LocalBetweenLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -525,8 +525,8 @@ public void testRead_LocalBetweenRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -551,8 +551,8 @@ public void testRead_LocalBetweenRightPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -577,8 +577,8 @@ public void testRead_LocalBetweenLeftPartial2() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBetween); @@ -604,8 +604,8 @@ public void testRead_RemoteBetweenWithoutVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBetween); @@ -633,8 +633,8 @@ public void testRead_RemoteBetweenWithVersion() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(1, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof RemoteBetween); @@ -663,8 +663,8 @@ public void testRead_Join() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -708,8 +708,8 @@ public void testRead_JoinComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertTrue(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -753,8 +753,8 @@ public void testRead_JoinLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -798,8 +798,8 @@ public void testRead_JoinRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Join); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -843,8 +843,8 @@ public void testRead_Order() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -888,8 +888,8 @@ public void testRead_OrderComplement() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertTrue(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -933,8 +933,8 @@ public void testRead_OrderLeftPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertFalse(locations.isComplement()); - assertTrue(locations.isLeftPartial()); - assertFalse(locations.isRightPartial()); + assertTrue(locations.isFivePrime()); + assertFalse(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); @@ -978,8 +978,8 @@ public void testRead_OrderRightPartial() throws IOException { CompoundLocation locations = feature.getLocations(); assertTrue(locations instanceof Order); assertFalse(locations.isComplement()); - assertFalse(locations.isLeftPartial()); - assertTrue(locations.isRightPartial()); + assertFalse(locations.isFivePrime()); + assertTrue(locations.isThreePrime()); assertEquals(4, locations.getLocations().size()); Location location = locations.getLocations().get(0); assertTrue(location instanceof LocalBase); diff --git a/src/test/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEGeneratorTest.java b/src/test/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEGeneratorTest.java index 1496fc60..7178f945 100644 --- a/src/test/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEGeneratorTest.java +++ b/src/test/java/uk/ac/ebi/embl/flatfile/writer/degenerator/DEGeneratorTest.java @@ -402,7 +402,7 @@ public void testBody9() throws IOException { Join join = new Join(); LocalRange range = locationFactory.createLocalRange(1L, 10L); join.addLocation(range); - join.setLeftPartial(true); + join.setFivePrime(true); feature.setLocations(join); entry.addFeature(feature); @@ -426,7 +426,7 @@ public void testBody10() throws IOException { Join join = new Join(); LocalRange range = locationFactory.createLocalRange(1L, 10L); join.addLocation(range); - join.setLeftPartial(true); + join.setFivePrime(true); feature.setLocations(join); entry.addFeature(feature); diff --git a/src/test/java/uk/ac/ebi/embl/flatfile/writer/embl/EmblFeatureLocationWriterTest.java b/src/test/java/uk/ac/ebi/embl/flatfile/writer/embl/EmblFeatureLocationWriterTest.java index d18eb05f..825841b0 100644 --- a/src/test/java/uk/ac/ebi/embl/flatfile/writer/embl/EmblFeatureLocationWriterTest.java +++ b/src/test/java/uk/ac/ebi/embl/flatfile/writer/embl/EmblFeatureLocationWriterTest.java @@ -27,8 +27,8 @@ public void testWrite_PartialLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(true); - feature.getLocations().setRightPartial(true); + feature.getLocations().setFivePrime(true); + feature.getLocations().setThreePrime(true); feature.getLocations().addLocation(locationFactory.createLocalRange(1L, 210L)); feature.getLocations().addLocation(locationFactory.createLocalRange(493L, 660L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); @@ -50,8 +50,8 @@ public void testWrite_PartialLocation() throws IOException { locationFactory = new LocationFactory(); featureFactory = new FeatureFactory(); feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(true); - feature.getLocations().setRightPartial(true); + feature.getLocations().setFivePrime(true); + feature.getLocations().setThreePrime(true); LocalRange range = locationFactory.createLocalRange(1L, 6L); feature.getLocations().addLocation(range); entry.addFeature(feature); @@ -67,8 +67,8 @@ public void testWrite_NonPartialLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalRange(1L, 210L)); feature.getLocations().addLocation(locationFactory.createLocalRange(493L, 660L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); @@ -92,8 +92,8 @@ public void testWrite_ComplementPartialLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(true); - feature.getLocations().setRightPartial(true); + feature.getLocations().setFivePrime(true); + feature.getLocations().setThreePrime(true); Range range = locationFactory.createLocalRange(1L, 210L); range.setComplement(true); feature.getLocations().addLocation(range); @@ -122,8 +122,8 @@ public void testWrite_ComplementLocation() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(true); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalRange(1L, 210L)); feature.getLocations().addLocation(locationFactory.createLocalRange(493L, 660L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); @@ -148,8 +148,8 @@ public void testWrite_ComplementOfComplementLocation() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(true); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); Range range = locationFactory.createLocalRange(1L, 210L); range.setComplement(true); feature.getLocations().addLocation(range); @@ -176,8 +176,8 @@ public void testWrite_BaseLocation() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(true); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); Base base = locationFactory.createLocalBase(123L); base.setComplement(true); feature.getLocations().addLocation(base); @@ -204,8 +204,8 @@ public void testWrite_BetweenLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalBetween(5493L, 54932L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); feature.getLocations().addLocation(locationFactory.createLocalRange(1058L, 1144L)); @@ -228,8 +228,8 @@ public void testWrite_RemoteLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createRemoteRange("A00001", 1, 1L, 210L)); feature.getLocations().addLocation(locationFactory.createRemoteBase("A00002", 4, 5493L)); feature @@ -257,8 +257,8 @@ public void testWrite_SingleBase() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); Base base = locationFactory.createLocalBase(123L); base.setComplement(false); feature.getLocations().addLocation(base); @@ -276,8 +276,8 @@ public void testWrite_SingleRange() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalRange(123L, 333L)); entry.addFeature(feature); StringWriter writer = new StringWriter(); @@ -293,8 +293,8 @@ public void testWrite_SingleBetween() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalBetween(123L, 124L)); entry.addFeature(feature); StringWriter writer = new StringWriter(); diff --git a/src/test/java/uk/ac/ebi/embl/flatfile/writer/genbank/GenbankFeatureLocationWriterTest.java b/src/test/java/uk/ac/ebi/embl/flatfile/writer/genbank/GenbankFeatureLocationWriterTest.java index 3a4df0db..6efefeee 100644 --- a/src/test/java/uk/ac/ebi/embl/flatfile/writer/genbank/GenbankFeatureLocationWriterTest.java +++ b/src/test/java/uk/ac/ebi/embl/flatfile/writer/genbank/GenbankFeatureLocationWriterTest.java @@ -27,8 +27,8 @@ public void testWrite_PartialLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(true); - feature.getLocations().setRightPartial(true); + feature.getLocations().setFivePrime(true); + feature.getLocations().setThreePrime(true); feature.getLocations().addLocation(locationFactory.createLocalRange(1L, 210L)); feature.getLocations().addLocation(locationFactory.createLocalRange(493L, 660L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); @@ -54,8 +54,8 @@ public void testWrite_PartialLocation() throws IOException { locationFactory = new LocationFactory(); featureFactory = new FeatureFactory(); feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(true); - feature.getLocations().setRightPartial(true); + feature.getLocations().setFivePrime(true); + feature.getLocations().setThreePrime(true); LocalRange range = locationFactory.createLocalRange(1L, 6L); feature.getLocations().addLocation(range); entry.addFeature(feature); @@ -75,8 +75,8 @@ public void testWrite_NonPartialLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalRange(1L, 210L)); feature.getLocations().addLocation(locationFactory.createLocalRange(493L, 660L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); @@ -104,8 +104,8 @@ public void testWrite_ComplementPartialLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(true); - feature.getLocations().setRightPartial(true); + feature.getLocations().setFivePrime(true); + feature.getLocations().setThreePrime(true); Range range = locationFactory.createLocalRange(1L, 210L); range.setComplement(true); feature.getLocations().addLocation(range); @@ -138,8 +138,8 @@ public void testWrite_ComplementLocation() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(true); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalRange(1L, 210L)); feature.getLocations().addLocation(locationFactory.createLocalRange(493L, 660L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); @@ -168,8 +168,8 @@ public void testWrite_ComplementOfComplementLocation() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(true); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); Range range = locationFactory.createLocalRange(1L, 210L); range.setComplement(true); feature.getLocations().addLocation(range); @@ -200,8 +200,8 @@ public void testWrite_BaseLocation() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(true); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); Base base = locationFactory.createLocalBase(123L); base.setComplement(true); feature.getLocations().addLocation(base); @@ -232,8 +232,8 @@ public void testWrite_BetweenLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalBetween(5493L, 54932L)); feature.getLocations().addLocation(locationFactory.createLocalRange(752L, 970L)); feature.getLocations().addLocation(locationFactory.createLocalRange(1058L, 1144L)); @@ -260,8 +260,8 @@ public void testWrite_RemoteLocation() throws IOException { LocationFactory locationFactory = new LocationFactory(); FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createRemoteRange("A00001", 1, 1L, 210L)); feature.getLocations().addLocation(locationFactory.createRemoteBase("A00002", 4, 5493L)); feature @@ -293,8 +293,8 @@ public void testWrite_SingleBase() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); Base base = locationFactory.createLocalBase(123L); base.setComplement(false); feature.getLocations().addLocation(base); @@ -316,8 +316,8 @@ public void testWrite_SingleRange() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalRange(123L, 333L)); entry.addFeature(feature); StringWriter writer = new StringWriter(); @@ -337,8 +337,8 @@ public void testWrite_SingleBetween() throws IOException { FeatureFactory featureFactory = new FeatureFactory(); Feature feature = featureFactory.createFeature("mRNA", true); feature.getLocations().setComplement(false); - feature.getLocations().setLeftPartial(false); - feature.getLocations().setRightPartial(false); + feature.getLocations().setFivePrime(false); + feature.getLocations().setThreePrime(false); feature.getLocations().addLocation(locationFactory.createLocalBetween(123L, 124L)); entry.addFeature(feature); StringWriter writer = new StringWriter();