Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ public class GigwaRestController extends ControllerInterface {
static public final String VARIANTS_BY_IDS = "/variants/byIds";
static public final String VARIANTS_LOOKUP = "/variants/lookup";
static public final String GENES_LOOKUP = "/genes/lookup";
static public final String GALAXY_HISTORY_PUSH = "/pushToGalaxyHistory";
static public final String GALAXY_HISTORY_PUSH = "/pushToGalaxyHistory";
static public final String DISTINCT_INDIVIDUAL_METADATA = "/distinctIndividualMetadata";
static public final String FILTER_INDIVIDUAL_METADATA = "/filterIndividualsFromMetadata";
static public final String INSTANCE_CONTENT_SUMMARY = "/instanceContentSummary";
static final public String snpclustEditionURL = "/snpclustEditionURL";
static final public String snpclustEditionURL = "/snpclustEditionURL";

/**
* get a unique processID
Expand Down Expand Up @@ -1630,7 +1630,7 @@ public void run() {

if (brapiUrlList.size() > 0) { // we've got BrAPI endpoints to pull metadata from
storeSessionAttributes(session); // in case external source info was just added
HashMap<String /*BrAPI url*/, HashMap<String /*remote germplasmDbId*/, String /*individual*/>> brapiUrlToIndividualsMap = new HashMap<>();
HashMap<String /*BrAPI url*/, HashMap<String /*remote germplasmDbId*/, Set<String> /*individual*/>> brapiUrlToIndividualsMap = new HashMap<>();
if (metadataType.equals("individual")) {
Collection<Individual> individuals = MgdbDao.getInstance().loadIndividualsWithAllMetadata(sModule, sFinalUsername, null, null, null).values();
for (Individual individual : individuals)
Expand All @@ -1648,13 +1648,16 @@ public void run() {
if (brapiUrlToIndividualsMap.get(endPointUrl) == null)
brapiUrlToIndividualsMap.put(endPointUrl, new HashMap<>());

HashMap<String, String> individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl);
HashMap<String, Set<String>> individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl);
if (individualsCurrentEndpointHasDataFor == null) {
individualsCurrentEndpointHasDataFor = new HashMap<>();
brapiUrlToIndividualsMap.put(endPointUrl, individualsCurrentEndpointHasDataFor);
}

individualsCurrentEndpointHasDataFor.put(extRefIdValue, individual.getId());
if (individualsCurrentEndpointHasDataFor.get(extRefIdValue) == null) {
individualsCurrentEndpointHasDataFor.put(extRefIdValue, new HashSet<>());
}
individualsCurrentEndpointHasDataFor.get(extRefIdValue).add(individual.getId());
}
}
else {
Expand All @@ -1674,13 +1677,16 @@ public void run() {
if (brapiUrlToIndividualsMap.get(endPointUrl) == null)
brapiUrlToIndividualsMap.put(endPointUrl, new HashMap<>());

HashMap<String, String> individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl);
HashMap<String, Set<String>> individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl);
if (individualsCurrentEndpointHasDataFor == null) {
individualsCurrentEndpointHasDataFor = new HashMap<>();
brapiUrlToIndividualsMap.put(endPointUrl, individualsCurrentEndpointHasDataFor);
}

individualsCurrentEndpointHasDataFor.put(extRefIdValue, sample.getSampleName());
if (individualsCurrentEndpointHasDataFor.get(extRefIdValue) == null) {
individualsCurrentEndpointHasDataFor.put(extRefIdValue, new HashSet<>());
}
individualsCurrentEndpointHasDataFor.get(extRefIdValue).add(sample.getSampleName());
}
}

Expand Down Expand Up @@ -2568,7 +2574,7 @@ public List<Comparable> searchableVariantsLookup(

return null;
}

@ApiIgnore
@RequestMapping(value = BASE_URL + DISTINCT_INDIVIDUAL_METADATA + "/{module}", method = RequestMethod.POST, produces = "application/json")
public LinkedHashMap<String, Set<String>> distinctIndividualMetadata(HttpServletRequest request, HttpServletResponse response, @PathVariable String module, @RequestParam(required = false) final Integer projID, @RequestBody HashMap<String, Object> reqBody) throws IOException {
Expand All @@ -2584,7 +2590,7 @@ public Collection<Individual> filterIndividualMetadata(HttpServletRequest reques
String sUserName = auth != null && auth.getAuthorities().contains(new SimpleGrantedAuthority(IRoleDefinition.ROLE_ADMIN)) ? null : AbstractTokenManager.getUserNameFromAuthentication(auth);
return MgdbDao.getInstance().loadIndividualsWithAllMetadata(module, sUserName, Arrays.asList(projID), null, filters).values();
}

@ApiOperation(authorizations = { @Authorization(value = "AuthorizationToken") }, value = GENES_LOOKUP , notes = "Get genes names ")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = List.class),
@ApiResponse(code = 400, message = "wrong parameters"),
Expand Down Expand Up @@ -2652,6 +2658,6 @@ public List<String> searchableGenesLookup(

i++;
}
return resultObjects;
return resultObjects;
}
}