{
continue;
}
-
- for (String label : Constants.SECONDARY_STRUCTURE_LABELS.keySet())
+
+ if (isSecondaryStructureFrom(selectedSSSource, aa))
{
+ ssAlignmentAnnotationForSequences
+ .computeIfAbsent(aa.sequenceRef.getDatasetSequence(),
+ k -> new ArrayList<>())
+ .add(aa);
+ }
+ }
- if (label.equals(aa.label))
- {
+ return ssAlignmentAnnotationForSequences;
- if (Constants.SS_ALL_PROVIDERS.equals(selectedSSSource))
- {
- ssAlignmentAnnotationForSequences
- .computeIfAbsent(aa.sequenceRef.getDatasetSequence(),
- k -> new ArrayList<>())
- .add(aa);
- break;
- }
+ }
- String ssSource = AlignmentUtils
- .extractSSSourceFromAnnotationDescription(aa);
- if (ssSource != null && ssSource.equals(selectedSSSource))
- {
++ /**
++ *
++ * @param selectedSSSource
++ * @param aa
++ * @return true if aa is from a provider or all providers as specified by selectedSSSource
++ */
+ public static boolean isSecondaryStructureFrom(String selectedSSSource,
+ AlignmentAnnotation aa)
+ {
- ssAlignmentAnnotationForSequences
- .computeIfAbsent(aa.sequenceRef.getDatasetSequence(),
- k -> new ArrayList<>())
- .add(aa);
- break;
- }
+ for (String label : Constants.SECONDARY_STRUCTURE_LABELS.keySet())
+ {
+
+ if (label.equals(aa.label))
+ {
+
+ if (selectedSSSource.equals(Constants.SS_ALL_PROVIDERS))
+ {
+ return true;
+ }
+ String ssSource = AlignmentUtils
+ .extractSSSourceFromAnnotationDescription(aa);
+ if (ssSource != null && ssSource.equals(selectedSSSource))
+ {
+ return true;
}
}
}
ssAnnotDescriptionInPDB = ssAnnotationsInPDB[0].description;
}
- //Match the PDB entry using file path in the pdb data model and get the provider
- if(seq.getDatasetSequence() != null) {
- Vector<PDBEntry> pdbEntries = seq.getDatasetSequence().getAllPDBEntries();
- if(pdbEntries != null) {
- for(PDBEntry pdbEntry : pdbEntries) {
- if(pdbEntry.getFile()!=null) {
- if(ssStructFilePathNameInPDB.startsWith(pdbEntry.getFile())) {
- provider = pdbEntry.getProvider();
- break;
- }
+ // Match the PDB entry using file path in the pdb data model and get the
+ // provider
- if (seq.getDatasetSequence() != null)
++ if (ssStructFilePathNameInPDB != null
++ && seq.getDatasetSequence() != null)
+ {
+ Vector<PDBEntry> pdbEntries = seq.getDatasetSequence()
+ .getAllPDBEntries();
- for (PDBEntry pdbEntry : pdbEntries)
++ if (pdbEntries != null)
+ {
- if (ssStructFilePathNameInPDB != null
- && pdbEntry.getFile() != null && ssStructFilePathNameInPDB
- .startsWith(pdbEntry.getFile()))
++ for (PDBEntry pdbEntry : pdbEntries)
+ {
- provider = pdbEntry.getProvider();
- break;
++ if (pdbEntry.getFile() != null && ssStructFilePathNameInPDB
++ .startsWith(pdbEntry.getFile()))
++ {
++ provider = pdbEntry.getProvider();
++ break;
+ }
}
- }
- // Add provider value as property to the ss annotation
- if (provider != null)
- {
- AlignmentAnnotation[] ssAnnotList = ds
- .getAnnotation(Constants.SS_ANNOTATION_LABEL);
- if (ssAnnotList != null)
-
-
- //Add provider value as property to the ss annotation
- if(provider != null) {
- AlignmentAnnotation[] ssAnnotList = ds.getAnnotation(Constants.SS_ANNOTATION_LABEL);
- if(ssAnnotList != null) {
- for(AlignmentAnnotation ssAnnot : ssAnnotList) {
- //Match the annotation description with the annotation in pdb data object
- if(ssAnnot.getProperty(Constants.SS_PROVIDER_PROPERTY) == null
- && ssAnnot.description.equals(ssAnnotDescriptionInPDB)) {
- ssAnnot.setProperty(Constants.SS_PROVIDER_PROPERTY, provider);
++ // Add provider value as property to the ss annotation
++ if (provider != null)
+ {
- for (AlignmentAnnotation ssAnnot : ssAnnotList)
++ // TODO - JAL-2880 JAL-4441 this should be applied to all structure derived annotations, not just secondary structure!
++ AlignmentAnnotation[] ssAnnotList = ds
++ .getAnnotation(Constants.SS_ANNOTATION_LABEL);
++ if (ssAnnotList != null)
+ {
- // Match the annotation description with the annotation in pdb
- // data object
- if (ssAnnot
- .getProperty(Constants.SS_PROVIDER_PROPERTY) == null
- && ssAnnot.description
- .equals(ssAnnotDescriptionInPDB))
++ for (AlignmentAnnotation ssAnnot : ssAnnotList)
+ {
- ssAnnot.setProperty(Constants.SS_PROVIDER_PROPERTY,
- provider);
++ // Match the annotation description with the annotation in pdb
++ // data object
++ if (ssAnnot
++ .getProperty(Constants.SS_PROVIDER_PROPERTY) == null
++ && ssAnnot.description
++ .equals(ssAnnotDescriptionInPDB))
++ {
++ ssAnnot.setProperty(Constants.SS_PROVIDER_PROPERTY,
++ provider);
+ }
}
}
}