-
Notifications
You must be signed in to change notification settings - Fork 3
ENA-6078: Fixing partiality #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,10 @@ public abstract class Location extends AbstractLocation implements Serializable | |
| private Long beginPosition; | ||
| private Long endPosition; | ||
|
|
||
| private boolean threePrime; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have the partiality in one place only or they may have conflicting values. If we have getters and setters in both CompoundLocation and Location then CompoundLocation should call the Location getters and setters and not have partiality fields itself. In this case CompoundLocation partiality setting should fail if there are no Locations yet. |
||
|
|
||
| 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() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,17 +140,17 @@ public ExtendedResult<TranslationResult> translate(CdsFeature cds, Entry entry) | |
|
|
||
| if (translationResult.isFixedLeftPartial()) { | ||
| if (!cds.getLocations().isComplement()) { | ||
| cds.getLocations().setLeftPartial(translator.isLeftPartial()); | ||
| cds.getLocations().setFivePrime(translator.isLeftPartial()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| } else { | ||
| cds.getLocations().setRightPartial(translator.isLeftPartial()); | ||
| cds.getLocations().setThreePrime(translator.isLeftPartial()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| } | ||
| } | ||
|
|
||
| if (translationResult.isFixedRightPartial()) { | ||
| if (!cds.getLocations().isComplement()) { | ||
| cds.getLocations().setRightPartial(translator.isRightPartial()); | ||
| cds.getLocations().setThreePrime(translator.isRightPartial()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| } else { | ||
| cds.getLocations().setLeftPartial(translator.isRightPartial()); | ||
| cds.getLocations().setFivePrime(translator.isRightPartial()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -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()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| translator.setRightPartial(compoundLocation.isFivePrime()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| } else { | ||
| translator.setLeftPartial(compoundLocation.isLeftPartial()); | ||
| translator.setRightPartial(compoundLocation.isRightPartial()); | ||
| translator.setLeftPartial(compoundLocation.isFivePrime()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| translator.setRightPartial(compoundLocation.isThreePrime()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. Best would be to review change Translation left and right partiality as well. |
||
| } | ||
|
|
||
| // Set a pseudo translation. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. |
||
|
|
||
| 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()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. |
||
| /** does the peptide end location match the end of a partial cds? */ | ||
| Location cdsEnd = getEndFromLocations(cdsFeature.getLocations()); | ||
| Location peptideEnd = getEndFromLocations(peptideFeature.getLocations()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,7 +175,7 @@ && getEmblEntryValidationPlanProperty() | |
| private void validateCdsFeature(CdsFeature cdsFeature) { | ||
| CompoundLocation<Location> locations = cdsFeature.getLocations(); | ||
|
|
||
| if (locations.isLeftPartial() | ||
| if (locations.isFivePrime() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. |
||
| && !SequenceEntryUtils.isQualifierAvailable("codon_start", cdsFeature)) { | ||
| reportWarning(cdsFeature.getOrigin(), CODON_START_QUALIFIER_MESSAGE); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,19 +87,19 @@ public CompoundLocation<Location> getCompoundLocation(String locationString, boo | |
| Location location = getLocation(element.get(i)); | ||
| if (isLeftPartial()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isLeftPartial() should be changed as well before reviewing this code block. |
||
| 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; | ||
| } | ||
| } | ||
| if (isRightPartial()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isRightPartial() should be changed as well before reviewing this code block. |
||
| 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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,8 +34,8 @@ public static String renderCompoundLocation(CompoundLocation<Location> compoundL | |
| } | ||
| } | ||
|
|
||
| boolean leftPartial = compoundLocation.isLeftPartial(); | ||
| boolean rightPartial = compoundLocation.isRightPartial(); | ||
| boolean leftPartial = compoundLocation.isFivePrime(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. |
||
| boolean rightPartial = compoundLocation.isThreePrime(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially unsafe. |
||
|
|
||
| if (locations.size() == 1) { | ||
| renderLocation(block, locations.get(0), leftPartial, rightPartial); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to: