11package org .alliancegenome .indexer .indexers .curation ;
22
3- import java .util .ArrayList ;
4- import java .util .Collection ;
5- import java .util .HashMap ;
6- import java .util .HashSet ;
7- import java .util .LinkedHashMap ;
8- import java .util .List ;
9- import java .util .Map ;
10- import java .util .Set ;
11- import java .util .concurrent .LinkedBlockingDeque ;
12-
3+ import com .fasterxml .jackson .databind .ObjectMapper ;
4+ import lombok .extern .slf4j .Slf4j ;
135import org .alliancegenome .api .entity .GeneTransgenicAlleleSummaryDocument ;
146import org .alliancegenome .api .entity .TransgenicAlleleSummaryDocument ;
157import org .alliancegenome .core .config .ConfigHelper ;
168import org .alliancegenome .curation_api .interfaces .document .AlleleDocumentInterface ;
17- import org .alliancegenome .curation_api .model .document .es .TransgenicAlleleDTO ;
18- import org .alliancegenome .curation_api .model .entities .Allele ;
19- import org .alliancegenome .curation_api .model .entities .Construct ;
20- import org .alliancegenome .curation_api .model .entities .Gene ;
21- import org .alliancegenome .curation_api .model .entities .TransgenicAlleleConstruct ;
9+ import org .alliancegenome .curation_api .model .document .es .TransgenicAlleleDocument ;
10+ import org .alliancegenome .curation_api .model .entities .*;
2211import org .alliancegenome .curation_api .model .entities .slotAnnotations .ConstructComponentSlotAnnotation ;
2312import org .alliancegenome .curation_api .model .entities .slotAnnotations .GeneSymbolSlotAnnotation ;
2413import org .alliancegenome .curation_api .response .SearchResponse ;
2817import org .alliancegenome .indexer .indexers .Indexer ;
2918import org .apache .commons .collections4 .CollectionUtils ;
3019import org .apache .commons .lang3 .ObjectUtils ;
31-
32- import com .fasterxml .jackson .databind .ObjectMapper ;
33-
34- import lombok .extern .slf4j .Slf4j ;
3520import si .mazi .rescu .RestProxyFactory ;
3621
22+ import java .util .*;
23+ import java .util .concurrent .LinkedBlockingDeque ;
24+
3725@ Slf4j
3826public class TransgenicAlleleCurationIndexer extends Indexer {
3927
@@ -86,18 +74,22 @@ private void addGenesToMap(List<Gene> genes, Map<Gene, Set<GeneTransgenicAlleleS
8674 }
8775
8876 private List <TransgenicAlleleSummaryDocument > indexTransgenicAlleleSummary () {
89- SearchResponse <TransgenicAlleleDTO > searchResponse = alleleApi .findDocuments (0 , 0 , params );
77+ SearchResponse <TransgenicAlleleDocument > searchResponse = alleleApi .findDocuments (0 , 0 , params );
9078 ProcessDisplayHelper display = new ProcessDisplayHelper ();
9179 display .startProcess ("Pulling Transgenic Alleles from curation" , searchResponse .getTotalResults ());
9280 Map <Allele , TransgenicAlleleSummaryDocument > documentMap = new LinkedHashMap <>();
9381 int batchSize = indexerConfig .getBufferSize ();
9482 int maxPage = (int ) (searchResponse .getTotalResults () / batchSize );
9583 for (int page = 0 ; page <= maxPage ; page ++) {
96- SearchResponse <TransgenicAlleleDTO > response = alleleApi .findDocuments (page , batchSize , params );
97- for (TransgenicAlleleDTO da : response .getResults ()) {
84+ SearchResponse <TransgenicAlleleDocument > response = alleleApi .findDocuments (page , batchSize , params );
85+ for (TransgenicAlleleDocument da : response .getResults ()) {
9886 if (da == null ) {
9987 continue ;
10088 }
89+ Species species = da .getAllele ().getTaxon ().getSpecies ();
90+ if (species == null ) {
91+ continue ;
92+ }
10193 TransgenicAlleleSummaryDocument document = documentMap .computeIfAbsent (da .getAllele (), allele -> {
10294 TransgenicAlleleSummaryDocument doc = new TransgenicAlleleSummaryDocument ();
10395 doc .setAllele (allele );
@@ -109,7 +101,7 @@ private List<TransgenicAlleleSummaryDocument> indexTransgenicAlleleSummary() {
109101 constructList = new ArrayList <>();
110102 document .setTransgenicAlleleConstructs (constructList );
111103 }
112- Construct constructObj = da .getConstruct ();
104+ Construct constructObj = da .getConstructList (). getFirst ();
113105
114106 TransgenicAlleleConstruct construct = new TransgenicAlleleConstruct ();
115107 // MGI special handling
0 commit comments