Skip to content

Commit

Permalink
complex goannot
Browse files Browse the repository at this point in the history
  • Loading branch information
kkarra committed Oct 6, 2020
1 parent c1666c3 commit 8c2f028
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ public void processGOAnnotations(Connection connection) throws SQLException, Obj
String goTermIdentifier = newGoTerm(goId, dataSource, dataSourceCode);
Evidence evidence = new Evidence(newStrEvidence, pubRefId, withText, organism,
dataSource, dataSourceCode);
System.out.print("evidence");
allEvidenceForAnnotation = new LinkedHashSet<Evidence>();
allEvidenceForAnnotation.add(evidence);
goTermGeneToEvidence.put(key, allEvidenceForAnnotation);
Expand Down Expand Up @@ -490,8 +489,7 @@ private void storeEvidenceCode(String code, String annotType, String withText) t
if(!annotType.isEmpty()) {item.setAttribute("annotType", annotType); }
if(withText != null && !withText.isEmpty()) { item.setAttribute("withText", withText); }
store(item);
evidenceCodes.put(combinationcode, item.getIdentifier());
System.out.println("Code is : "+ combinationcode);
evidenceCodes.put(combinationcode, item.getIdentifier());
}
}

Expand Down Expand Up @@ -768,7 +766,6 @@ public boolean equals(Object o) {
&& pub.equals(go.pub)
&& pubxref.equals(go.pubxref);
}else{
System.out.println("in GoTermToGene...." + annotationExtension);
return productId.equals(go.productId)
&& goId.equals(go.goId)
&& qualifier.equals(go.qualifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class SgdComplexesConverter extends BioDBConverter
private Map<String, Item> publications = new HashMap();
private Map<String, String> terms = new HashMap<String, String>();
private Map<String, Item> complexes = new HashMap();
//private Map<String, Item> complexnames = new HashMap();
private final Map<String, Item> genes = new HashMap<String, Item>();
private static final String TAXON_ID = "4932";
private Item yorganism;
Expand All @@ -60,10 +61,11 @@ public class SgdComplexesConverter extends BioDBConverter
* @param model the Model used by the object store we will write to with the ItemWriter
* @param writer an ItemWriter used to handle Items created
*/
public SgdComplexesConverter(Database database, Model model, ItemWriter writer) {
public SgdComplexesConverter(Database database, Model model, ItemWriter writer) throws ObjectStoreException{
super(database, model, writer, DATA_SOURCE_NAME, DATASET_TITLE);
yorganism = createItem("Organism");
yorganism.setAttribute("taxonId", TAXON_ID);
store(yorganism);
}


Expand All @@ -73,7 +75,8 @@ public SgdComplexesConverter(Database database, Model model, ItemWriter writer)
public void process() throws Exception {
Connection connection = getDatabase().getConnection();
processComplexes(connection);
//processComplexInteractions(connection);
processComplexInteractions(connection);
storeGenes();
storeComplexes();
}

Expand Down Expand Up @@ -194,9 +197,7 @@ private Item getGoAnnot(String goId) throws ObjectStoreException {
} catch (ObjectStoreException e) {
throw new ObjectStoreException(e);
}

return goAnnotation;

}

/**
Expand Down Expand Up @@ -245,7 +246,6 @@ private String getEvidence(String value) throws ObjectStoreException{
evidence.setReference("ontologyTerm", eco.getIdentifier());
}


try {
store(evidence);
} catch (ObjectStoreException e) {
Expand Down Expand Up @@ -316,8 +316,9 @@ private void processComplexInteractions(Connection connection) throws ObjectStor

Item gene1 = getGeneItem(dbentity1);
Item gene2 = null;
if(dbentity2 != null) { gene2 = getGeneItem(dbentity2); }

if(dbentity2 != null) {
gene2 = getGeneItem(dbentity2);
}
processInteractions(complex_accession, gene1, gene2, range_start, range_end,
stochiometry, role, type);
}
Expand All @@ -338,6 +339,7 @@ private void processComplexInteractions(Connection connection) throws ObjectStor
private void processInteractions(String complexacc, Item ref, Item binderRef, String range_start, String range_end,
String stochiometry, String role, String type) throws ObjectStoreException {

Item complex = complexes.get(complexacc);
Item interactor = createItem("Interactor");
//interactor.setAttribute("annotations", annotations.toString());
if (StringUtils.isNotEmpty(role)) { interactor.setAttribute("biologicalRole", role);}
Expand All @@ -350,7 +352,7 @@ private void processInteractions(String complexacc, Item ref, Item binderRef, St
if (binderRef != null) {
interaction.setReference("participant2", binderRef);
}
interaction.setReference("complex", complexacc);
interaction.setReference("complex", complex);
store(interaction);
interactor.addToCollection("interactions", interaction);

Expand All @@ -372,7 +374,6 @@ private void processInteractions(String complexacc, Item ref, Item binderRef, St
store(interactor);
//detail.addInteractor(interactor.getIdentifier());

Item complex = complexes.get(complexacc);
if (complex != null) {
complex.addToCollection("allInteractors", interactor);
}
Expand Down Expand Up @@ -434,6 +435,20 @@ private void storeComplexes() throws ObjectStoreException {
}
}

/**
*
* @throws ObjectStoreException
*/

private void storeGenes() throws ObjectStoreException {
for (Item gene : genes.values()) {
try {
store(gene);
} catch (ObjectStoreException e) {
throw new ObjectStoreException(e);
}
}
}
/**
*
* @param geneId
Expand All @@ -446,7 +461,7 @@ private Item getGeneItem(String geneId)
Item gene = genes.get(geneId);

if (gene == null) {
gene = createItem("Gene");
gene = createItem("Protein");
genes.put(geneId, gene);
gene.setAttribute("primaryIdentifier", geneId);
gene.setReference("organism", yorganism);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ Gene.key_primaryidentifier=primaryIdentifier
Gene.key_secondaryidentifier=secondaryIdentifier
Gene.key_symbol_org=symbol, organism
#yes merge - kk; no merging, I think.
#Interaction.key_interaction=participant1, participant2
#Interaction.key_interaction=participant1, participant2
Protein.key_primaryacc=primaryAccession
GOEvidenceCode.key_code=code

0 comments on commit 8c2f028

Please sign in to comment.