Skip to content

Commit

Permalink
Update protein update fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jmedinaebi committed Aug 20, 2024
1 parent f3c4b2c commit c7cce2a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public void updateByACs(List<String> protACsToUpdate) throws ProcessorException
for (String ac : chunkIntactProteins) {
log.fatal("FATAL: We failed to update the protein " + ac, e);
ProteinUpdateError fatalError = errorFactory.createFatalUpdateError(ac, null, e);
fireOnProcessErrorFound(new UpdateErrorEvent(this, dataContext, fatalError, null, ac));
fireOnProcessErrorFound(new UpdateErrorEvent(this, dataContext, fatalError, null, null, ac));
}
dataContext.rollbackTransaction(transactionStatus);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String getErrorMessage(){
}

if (uniprotAc != null){
error.append("attached to the uniprot entry ");
error.append(" attached to the uniprot entry ");
error.append(uniprotAc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,32 @@ public class UpdateErrorEvent extends EventObject implements ProteinProcessorEve
private DataContext dataContext;
private Protein protein;
private String uniprotAc;
private String proteinAc;

public UpdateErrorEvent(Object source, DataContext dataContext, ProteinUpdateError error, Protein protein) {
public UpdateErrorEvent(Object source,
DataContext dataContext,
ProteinUpdateError error,
Protein protein,
String uniprotAc,
String proteinAc) {
super(source);
this.error = error;
this.dataContext = dataContext;
this.protein = protein;
this.uniprotAc = null;
}

public UpdateErrorEvent(Object source, DataContext dataContext, ProteinUpdateError error, String uniprotAc) {
super(source);
this.error = error;
this.dataContext = dataContext;
this.protein = null;
this.uniprotAc = uniprotAc;
this.proteinAc = proteinAc;
}

public UpdateErrorEvent(Object source, DataContext dataContext, ProteinUpdateError error, Protein protein, String uniprotAc) {
super(source);
this.error = error;
this.dataContext = dataContext;
this.protein = protein;
this.uniprotAc = uniprotAc;
this(source, dataContext, error, protein, uniprotAc, null);
}

public UpdateErrorEvent(Object source, DataContext dataContext, ProteinUpdateError error, Protein protein) {
this(source, dataContext, error, protein, null, null);
}

public UpdateErrorEvent(Object source, DataContext dataContext, ProteinUpdateError error, String uniprotAc) {
this(source, dataContext, error, null, uniprotAc, null);
}

public ProteinUpdateError getError() {
Expand All @@ -73,4 +76,12 @@ public String getUniprotAc() {
public void setUniprotAc(String uniprotAc) {
this.uniprotAc = uniprotAc;
}

public String getProteinAc() {
return proteinAc;
}

public void setProteinAc(String proteinAc) {
this.proteinAc = proteinAc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,17 @@ public void onProcessErrorFound(UpdateErrorEvent evt) throws ProcessorException{
if (evt.getProtein() != null){
proteinAc = evt.getProtein().getAc();
proteinShortlablel = evt.getProtein().getShortLabel();
} else if (evt.getProteinAc() != null) {
proteinAc = evt.getProteinAc();
}

writer.writeHeaderIfNecessary("Protein ac",
"Protein shortlabel",
"Uniprot ac",
"error type",
"error description");
writer.writeColumnValues(proteinAc,
writer.writeColumnValues(
proteinAc,
proteinShortlablel,
uniprotAc,
errorType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public String toString(){
}

if (uniprotAc != null){
error.append("attached to the uniprot entry ");
error.append(" attached to the uniprot entry ");
error.append(uniprotAc);
}

Expand Down

0 comments on commit c7cce2a

Please sign in to comment.