Skip to content

Commit

Permalink
include non-proteins in complexes
Browse files Browse the repository at this point in the history
  • Loading branch information
kkarra committed Feb 12, 2024
1 parent 1f85eb2 commit 4aea2b4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class SgdComplexesConverter extends BioDBConverter
private Map<String, String> terms = new HashMap<String, String>();
private Map<String, Item> complexes = new HashMap();
private final Map<String, Item> proteins = new HashMap<String, Item>();
private final Map<String, Item> otherinteractors = new HashMap<String, Item>();

private static final String TAXON_ID = "4932";
private Item yorganism;

Expand All @@ -77,6 +79,7 @@ public void process() throws Exception {
processComplexes(connection);
processComplexInteractions(connection);
storeProteins();
storeOtherBioentities();
storeComplexes();
}

Expand Down Expand Up @@ -299,7 +302,6 @@ private void processComplexInteractions(Connection connection) throws ObjectStor
String dbentityId = res.getString("dbentity_id");
String complex_accession = res.getString("complex_accession");
String dbentity1 = res.getString("sgdid_1");
//String dbentity2 = res.getString("sgdid_2");

Array interactions = res.getArray("sgdid_2");
String[] str_interactions = (String[])interactions.getArray();
Expand All @@ -309,9 +311,17 @@ private void processComplexInteractions(Connection connection) throws ObjectStor
String stochiometry = res.getString("stoichiometry");
String role = res.getString("role");
String type = res.getString("type");
String int_display_name = res.getString("interactordisplay");
String int_format_name = res.getString("interactorid");

Item gene1 = getProteinItem(dbentity1);
Item gene1 = null;

if(type.equalsIgnoreCase("protein") && dbentity1 != null){
System.out.println("in type equals protein" + " "+dbentity1 + " "+ complex_accession);
gene1 = getProteinItem(dbentity1);
}else{
gene1 = getOtherItem(type, int_display_name, int_format_name);
}
processInteractions(complex_accession, gene1, range_start, range_end, stochiometry, role, type, str_interactions);

}
Expand Down Expand Up @@ -422,6 +432,24 @@ private void storeProteins() throws ObjectStoreException {
}
}
}


/**
*
* @throws ObjectStoreException
*/

private void storeOtherBioentities() throws ObjectStoreException {
for (Item item : otherinteractors.values()) {
try {
store(item);
} catch (ObjectStoreException e) {
throw new ObjectStoreException(e);
}
}
}


/**
*
* @param proteinId
Expand All @@ -444,6 +472,30 @@ private Item getProteinItem(String proteinId)

}

/**
*
* @param proteinId
* @return
* @throws ObjectStoreException
*/
private Item getOtherItem(String type, String interactor_dname, String interactor_fname)
throws ObjectStoreException {

Item item = otherinteractors.get(interactor_dname);

if (item == null) {
item = createItem("BioEntity");
otherinteractors.put(interactor_dname, item);
item.setAttribute("primaryIdentifier", interactor_fname);
item.setAttribute("name", interactor_dname);
item.setReference("organism", yorganism);
}

return item;

}


/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ protected ResultSet getComplexInteractions(Connection connection) throws SQLExce

String query = "select cd.dbentity_id, complex_accession," +
" range_start, range_end, stoichiometry, psimi2.display_name as role, psimi.display_name as type," +
" ldb.sgdid as sgdid_1, array_agg(ldb2.sgdid) as sgdid_2" +
" ldb.sgdid as sgdid_1, array_agg(ldb2.sgdid) as sgdid_2, i.display_name as interactordisplay, i.format_name as interactorid, ib.display_name" +
" from nex.complexdbentity cd " +
" inner join nex.complexbindingannotation cba on cd.dbentity_id = cba.complex_id" +
" inner join nex.taxonomy t on t.taxonomy_id = cba.taxonomy_id" +
" inner join nex.interactor i on cba.interactor_id = i.interactor_id" +
" left join nex.interactor ib on cba.binding_interactor_id = ib.interactor_id" +
" inner join nex.dbentity ldb on ldb.dbentity_id = i.locus_id" +
" left join nex.dbentity ldb on ldb.dbentity_id = i.locus_id" +
" left join nex.dbentity ldb2 on ldb2.dbentity_id = ib.locus_id" +
" left join nex.psimi psi on psi.psimi_id = cba.binding_type_id" +
" left join nex.psimi psimi on psimi.psimi_id = i.type_id" +
" left join nex.psimi psimi2 on psimi2.psimi_id = ib.role_id" +
//" where cd.dbentity_id = 1982773"+
//" where cd.dbentity_id = 1983195"+
" group by cd.dbentity_id, complex_accession," +
" range_start, range_end, stoichiometry, psimi2.display_name, psimi.display_name,ldb.sgdid" +
" range_start, range_end, stoichiometry, psimi2.display_name, psimi.display_name,ldb.sgdid, i.display_name, i.format_name, ib.display_name" +
" order by cd.dbentity_id, ldb.sgdid";

LOG.info("executing: " + query);
Expand Down

0 comments on commit 4aea2b4

Please sign in to comment.