Skip to content

Commit

Permalink
Merge branch 'stage' into add_checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
oblodgett authored Jul 11, 2024
2 parents 970b35e + 5198e53 commit 21a4b47
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public List<AGMDiseaseAnnotation> getFiltered() {
SearchResponse<AGMDiseaseAnnotation> response = agmApi.findForPublic(page, batchSize, params);

for (AGMDiseaseAnnotation da: response.getResults()) {
if (isValidEntity(allModelIDs, da.getDiseaseAnnotationSubject().getIdentifier()) || hasNoObsoletedOrInternalEntities(da)) {
if (isValidEntity(allModelIDs, da.getDiseaseAnnotationSubject().getIdentifier()) && hasNoObsoletedOrInternalEntities(da)) {
if (hasValidEntities(da, allGeneIDs, allAlleleIds, allModelIDs)) {
if (da.getInferredGene() != null && da.getInferredGene().getConstructGenomicEntityAssociations() != null) {
da.getInferredGene().getConstructGenomicEntityAssociations().clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public List<AlleleDiseaseAnnotation> getFiltered() {
HashMap<String, Object> params = new HashMap<>();
params.put("internal", false);
params.put("obsolete", false);
// params.put("diseaseAnnotationSubject.modEntityId", "RGD:5144089");
//params.put("diseaseAnnotationSubject.modEntityId", "WB:WBVar00266693");

do {
SearchResponse<AlleleDiseaseAnnotation> response = alleleApi.findForPublic(page, batchSize, params);

for (AlleleDiseaseAnnotation da: response.getResults()) {
if (isValidEntity(allAlleleIds, da.getDiseaseAnnotationSubject().getIdentifier()) || hasNoObsoletedOrInternalEntities(da)) {
if (isValidEntity(allAlleleIds, da.getDiseaseAnnotationSubject().getIdentifier()) && hasNoObsoletedOrInternalEntities(da)) {
if (hasValidEntities(da, allGeneIDs, allAlleleIds, allModelIDs)) {
if (da.getInferredGene() != null && da.getInferredGene().getConstructGenomicEntityAssociations() != null) {
da.getInferredGene().getConstructGenomicEntityAssociations().clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public List<GeneDiseaseAnnotation> getFiltered() {
do {
SearchResponse<GeneDiseaseAnnotation> response = geneApi.findForPublic(page, batchSize, params);
for (GeneDiseaseAnnotation da : response.getResults()) {
if (isValidEntity(allGeneIDs, da.getDiseaseAnnotationSubject().getIdentifier()) || hasNoObsoletedOrInternalEntities(da)) {
if (isValidEntity(allGeneIDs, da.getDiseaseAnnotationSubject().getIdentifier()) && hasNoObsoletedOrInternalEntities(da)) {
if (hasValidGeneticModifiers(da, allGeneIDs, allAlleleIds, allModelIDs)) {
ret.add(da);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import java.util.stream.StreamSupport;

import org.alliancegenome.neo4j.entity.node.Allele;
import org.alliancegenome.neo4j.entity.node.Transcript;
import org.alliancegenome.neo4j.entity.node.Variant;
import org.apache.commons.collections4.CollectionUtils;
import org.neo4j.ogm.model.Result;

public class VariantRepository extends Neo4jRepository<Variant> {
Expand Down Expand Up @@ -44,7 +46,7 @@ public List<Variant> getVariantsOfAllele(String id) {
query += " OPTIONAL MATCH p2=(variant:Variant)<-[:COMPUTED_GENE]-(:Gene)-[:ASSOCIATION]->(:GenomicLocation)";
query += " WITH p1, collect(p2) AS p2, locs, consequences, synonyms, transcripts, transcriptConsequences, notes, crossRefs, pubs";
query += " RETURN p1, p2, locs, consequences, synonyms, transcripts, transcriptConsequences, notes, crossRefs, pubs ";

Iterable<Variant> alleles = query(query, map);
return StreamSupport.stream(alleles.spliterator(), false)
.collect(Collectors.toList());
Expand All @@ -60,20 +62,26 @@ public Variant getVariant(String variantID) {
query += " WHERE variant.primaryKey = $" + paramName;
query += " OPTIONAL MATCH consequence=(:GenomicLocation)--(variant:Variant)-[:ASSOCIATION]->(:TranscriptLevelConsequence)"
+ "<-[:ASSOCIATION]-(t:Transcript)<-[:TRANSCRIPT_TYPE]-(:SOTerm)";
query += " OPTIONAL MATCH gene=(t:Transcript)-[:TRANSCRIPT]-(:Gene)--(:GenomicLocation)";
query += " OPTIONAL MATCH gene=(t:Transcript)-[:TRANSCRIPT]-(ge:Gene)--(:GenomicLocation)";
query += " OPTIONAL MATCH geneSpecies=(ge:Gene)--(:Species)";
query += " OPTIONAL MATCH transcriptLocation=(t:Transcript)-[:ASSOCIATION]-(:GenomicLocation)";
query += " OPTIONAL MATCH exons=(:GenomicLocation)--(:Exon)-[:EXON]->(t:Transcript)";
query += " RETURN p1, consequence, gene, exons, transcriptLocation ";
query += " RETURN p1, consequence, gene, geneSpecies, exons, transcriptLocation ";

Iterable<Variant> variants = query(query, map);
for (Variant a : variants) {
if (a.getPrimaryKey().equals(variantID)) {
List<Transcript> list = a.getTranscriptList();
if (CollectionUtils.isNotEmpty(list)) {
a.setSpecies(list.get(0).getGene().getSpecies());
a.setGene(list.get(0).getGene());
}
return a;
}
}
return null;
}

public List<String> getAllVariantKeys() {
String query = "MATCH (v:Variant)-[:VARIATION]-(a:Allele)-[:FROM_SPECIES]-(q:Species) RETURN v.primaryKey";

Expand All @@ -88,7 +96,7 @@ public List<String> getAllVariantKeys() {
}
return list;
}

public List<Allele> getAllelesOfVariant(String variantID) {
String query = "";
query += " MATCH p1=(a:Allele)<-[:VARIATION]-(variant:Variant)--(soTerm:SOTerm) ";
Expand Down

0 comments on commit 21a4b47

Please sign in to comment.