Skip to content

Commit

Permalink
Importer: On Mods, allow position when N or C term flag is set.
Browse files Browse the repository at this point in the history
When N or C term flag is set, the position in the input will be ignored
and the position will continue to hard coded in the DB to be position 1
and the length of the peptide.
  • Loading branch information
danjasuw committed Sep 3, 2019
1 parent ddb33bc commit 44a9370
Showing 1 changed file with 48 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,41 +86,40 @@ public void validateModificationsOnReportedPeptides( ProxlInput proxlInput ) thr
}

if ( modification.isIsNTerminal() != null && modification.isIsNTerminal() ) {
// Comment out to allow position
// if ( modification.getPosition() != null ) {
// String msg = "Peptide Modification Position is populated when modification is marked as 'n' terminal. Position: " + modification.getPosition().intValue()
// + " Reported Peptide: " + reportedPeptide.getReportedPeptideString();
// log.error( msg );
// throw new ProxlImporterDataException( msg );
// }
// Since allowing position, validate it. Not really needed since will be ignored.
if ( modification.getPosition() != null ) {
String msg = "Peptide Modification Position is populated when modification is marked as 'n' terminal. Position: " + modification.getPosition().intValue()
+ " Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
validatePositionValue( modification, peptideSequenceLength, reportedPeptide);
}
// No changed needed outside this class since in the import code the position is overlaid if the N or C terminus flag is set
} else if ( modification.isIsCTerminal() != null && modification.isIsCTerminal() ) {
if ( modification.getPosition()!= null ) {
String msg = "Peptide Modification Position is populated when modification is marked as 'c' terminal. Position: " + modification.getPosition().intValue()
+ " Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
// Comment out to allow position
// if ( modification.getPosition()!= null ) {
// String msg = "Peptide Modification Position is populated when modification is marked as 'c' terminal. Position: " + modification.getPosition().intValue()
// + " Reported Peptide: " + reportedPeptide.getReportedPeptideString();
// log.error( msg );
// throw new ProxlImporterDataException( msg );
// }
// Since allowing position, validate it. Not really needed since will be ignored.
if ( modification.getPosition() != null ) {
validatePositionValue( modification, peptideSequenceLength, reportedPeptide);
}
// No changed needed outside this class since in the import code the position is overlaid if the N or C terminus flag is set
} else {

if ( modification.getPosition() == null ) {
String msg = "Peptide Modification Position is null or not assigned and at least one of 'is_n_terminal' or 'is_c_terminal' is not populated and true. Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
}
if ( modification.getPosition().intValue() < 1 ) {
String msg = "Peptide Modification Position is < 1. peptide Modification Position: "
+ modification.getPosition()
+ ", Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
}
if ( modification.getPosition().intValue() > peptideSequenceLength ) {
String msg = "Peptide Modification Position is > peptide Sequence Length. peptide Modification Position: "
+ modification.getPosition()
+ ", peptide Sequence Length: " + peptideSequenceLength
+ ", Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
}

validatePositionValue( modification, peptideSequenceLength, reportedPeptide );
}
}
}
Expand All @@ -130,4 +129,29 @@ public void validateModificationsOnReportedPeptides( ProxlInput proxlInput ) thr
}
}
}

/**
* @param modification
* @param peptideSequenceLength
* @param reportedPeptide
* @throws ProxlImporterDataException
*/
private void validatePositionValue( Modification modification, int peptideSequenceLength, ReportedPeptide reportedPeptide ) throws ProxlImporterDataException {

if ( modification.getPosition().intValue() < 1 ) {
String msg = "Peptide Modification Position is < 1. peptide Modification Position: "
+ modification.getPosition()
+ ", Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
}
if ( modification.getPosition().intValue() > peptideSequenceLength ) {
String msg = "Peptide Modification Position is > peptide Sequence Length. peptide Modification Position: "
+ modification.getPosition()
+ ", peptide Sequence Length: " + peptideSequenceLength
+ ", Reported Peptide: " + reportedPeptide.getReportedPeptideString();
log.error( msg );
throw new ProxlImporterDataException( msg );
}
}
}

0 comments on commit 44a9370

Please sign in to comment.