Skip to content
Snippets Groups Projects
Commit a77d2f46 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

some JavaDoc provided

parent c3fd3ed9
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!545Import from sbgn issue
Pipeline #7949 passed
......@@ -246,6 +246,18 @@ public class CellDesignerElementCollection {
private Map<String, String> modificationResidueIdByHash = new HashMap<>();
private Set<String> usedModificationResidueIds = new HashSet<>();
/**
* This method computes modificationResidueId that should be used when exporting
* modification residue to CellDesigner. The identifier relies on type and
* position on the list of modification
*
* @param region
* {@link ModificationResidue} for which we want to find out identifier
* @param number
* position on which this {@link ModificationResidue} is located in
* species
* @return identifier that can be used in CellDesigner
*/
public String getModificationResidueId(ModificationResidue region, int number) {
String hash = region.getClass().getSimpleName() + "\n" + number;
String result = modificationResidueIdByHash.get(hash);
......
......@@ -31,7 +31,7 @@ public class ModificationResidueXmlParser extends XmlParser {
}
/**
* Transforms AntisenseRnaRegion into CellDEsigner xml representation.
* Transforms ModificationResidue into CellDssigner xml representation.
*
* @param region
* object to be transformed
......@@ -86,28 +86,37 @@ public class ModificationResidueXmlParser extends XmlParser {
return result;
}
/**
* This method computes modificationResidueId that should be used when exporting
* modification residue to CellDesigner. It cannot be taken from data structure
* because we have to merge elements when exporting to CellDesigner and this
* might introduce inconsistent identifiers.
*
* @param region {@link ModificationResidue} for which we want to find out identifier
* @return identifier that can be used in CellDesigner
*/
private String computeModificationResidueId(ModificationResidue region) {
List<? extends ModificationResidue> modificationResidues;
if (region.getSpecies() instanceof Protein) {
modificationResidues = ((Protein)region.getSpecies()).getModificationResidues();
modificationResidues = ((Protein) region.getSpecies()).getModificationResidues();
} else if (region.getSpecies() instanceof Rna) {
modificationResidues = ((Rna)region.getSpecies()).getRegions();
modificationResidues = ((Rna) region.getSpecies()).getRegions();
} else if (region.getSpecies() instanceof AntisenseRna) {
modificationResidues = ((AntisenseRna)region.getSpecies()).getRegions();
modificationResidues = ((AntisenseRna) region.getSpecies()).getRegions();
} else if (region.getSpecies() instanceof Gene) {
modificationResidues = ((Gene)region.getSpecies()).getModificationResidues();
modificationResidues = ((Gene) region.getSpecies()).getModificationResidues();
} else {
throw new NotImplementedException();
}
int number = -1;
int i=0;
for (ModificationResidue mr: modificationResidues) {
int i = 0;
for (ModificationResidue mr : modificationResidues) {
if (mr.getIdModificationResidue().equals(region.getIdModificationResidue())) {
number= i;
number = i;
}
i++;
}
if (i<0) {
if (i < 0) {
throw new InvalidArgumentException("ModificationResidue is not on the species list");
}
return elements.getModificationResidueId(region, number);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment