use of uk.ac.ebi.spot.goci.model.AncestralGroup in project goci by EBISPOT.
the class AncestryMappingService method processAncestries.
public void processAncestries() {
printOutOntologyContent();
;
List<Ancestry> allAncestries = getAllAncestries();
for (Ancestry ancestry : allAncestries) {
Long id = ancestry.getId();
String coo = null;
if (ancestry.getCountryOfOrigin() != null) {
for (Country c : ancestry.getCountryOfOrigin()) {
if (coo == null) {
coo = c.getCountryName();
} else {
coo = coo.concat(", ").concat(c.getCountryName());
}
}
} else {
coo = "NR";
}
String cor = null;
if (ancestry.getCountryOfRecruitment() != null) {
for (Country c : ancestry.getCountryOfRecruitment()) {
if (cor == null) {
cor = c.getCountryName();
} else {
cor = cor.concat(", ").concat(c.getCountryName());
}
}
} else {
cor = "NR";
}
String ancestralGroup = null;
if (ancestry.getAncestralGroups() != null) {
for (AncestralGroup a : ancestry.getAncestralGroups()) {
if (ancestralGroup == null) {
ancestralGroup = a.getAncestralGroup();
} else {
ancestralGroup = ancestralGroup.concat(", ").concat(a.getAncestralGroup());
}
}
} else {
ancestralGroup = "NR";
}
if (ancestralGroup != null) {
if (ancestralGroup.contains(",")) {
String[] groups = ancestralGroup.split(",");
for (String group : groups) {
mapAncestralGroup(id, group.toLowerCase());
}
} else {
mapAncestralGroup(id, ancestralGroup.toLowerCase());
}
}
if (coo != null) {
if (coo.contains(",")) {
String[] countries = coo.split(",");
for (String country : countries) {
mapCoO(id, country.toLowerCase());
}
} else {
mapCoO(id, coo.toLowerCase());
}
}
if (cor != null) {
if (cor.contains(",")) {
String[] countries = cor.split(",");
for (String country : countries) {
mapCoR(id, country.toLowerCase());
}
} else {
mapCoR(id, cor.toLowerCase());
}
}
}
getErrors().info("All ancestries processed");
printResult();
}
Aggregations