Skip to content

Commit

Permalink
updating protein self-relationships stuff (no self-relationships node…
Browse files Browse the repository at this point in the history
… anymore)
  • Loading branch information
Pablo Pareja Tobes committed Sep 27, 2011
1 parent 84c49ae commit f6bd2fa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 47 deletions.
5 changes: 1 addition & 4 deletions src/com/era7/bioinfo/bio4j/CommonData.java
Expand Up @@ -88,12 +88,9 @@ public class CommonData {
public static final String FEATURE_LOCATION_END_TAG_NAME = "end";
public static final String FEATURE_LOCATION_POSITION_ATTRIBUTE = "position";
public static final String FEATURE_POSITION_POSITION_ATTRIBUTE = "position";




public static final String REFSEQ_BUCKET_NAME = "refseq-bucket";

public static final String PROTEIN_SELF_RELATIONSHIPS_NODE_INDEX_NAME = "self_relationships_node_index";
public static final String PROTEIN_SELF_RELATIONSHIPS_NODE_INDEX_VALUE = "protein_self_relationships";

}
60 changes: 20 additions & 40 deletions src/com/era7/bioinfo/bio4j/programs/ImportProteinInteractions.java
Expand Up @@ -20,7 +20,6 @@
import com.era7.bioinfo.bio4j.CommonData;
import com.era7.bioinfo.bio4jmodel.relationships.protein.ProteinIsoformInteractionRel;
import com.era7.bioinfo.bio4jmodel.relationships.protein.ProteinProteinInteractionRel;
import com.era7.bioinfo.bio4jmodel.relationships.protein.ProteinSelfInteractionRel;
import com.era7.lib.bioinfo.bioinfoutil.Executable;
import com.era7.lib.era7xmlapi.model.XMLElement;
import java.io.BufferedReader;
Expand Down Expand Up @@ -137,23 +136,16 @@ public static void main(String[] args) throws IOException {
//--------------------------------relationships------------------------------------------
ProteinProteinInteractionRel proteinProteinInteractionRel = new ProteinProteinInteractionRel(null);
ProteinIsoformInteractionRel proteinIsoformInteractionRel = new ProteinIsoformInteractionRel(null);
ProteinSelfInteractionRel proteinSelfInteractionRel = new ProteinSelfInteractionRel(null);
//------------------------------------------------------------------------------------------------

//------------------indexes creation----------------------------------
BatchInserterIndex proteinAccessionIndex = indexProvider.nodeIndex(ProteinNode.PROTEIN_ACCESSION_INDEX,
MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST));
BatchInserterIndex isoformIdIndex = indexProvider.nodeIndex(IsoformNode.ISOFORM_ID_INDEX,
MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST));
BatchInserterIndex proteinSelfRelationshipsNodeIndex = indexProvider.nodeIndex(CommonData.PROTEIN_SELF_RELATIONSHIPS_NODE_INDEX_NAME,
MapUtil.stringMap(PROVIDER_ST, LUCENE_ST, TYPE_ST, EXACT_ST));
//--------------------------------------------------------------------


long proteinSelfInteractionsNodeId = proteinSelfRelationshipsNodeIndex.get(CommonData.PROTEIN_SELF_RELATIONSHIPS_NODE_INDEX_NAME, CommonData.PROTEIN_SELF_RELATIONSHIPS_NODE_INDEX_VALUE).getSingle();
System.out.println("proteinSelfInteractionsNodeId = " + proteinSelfInteractionsNodeId);


BufferedReader reader = new BufferedReader(new FileReader(inFile));
String line = null;
StringBuilder entryStBuilder = new StringBuilder();
Expand Down Expand Up @@ -233,47 +225,35 @@ public static void main(String[] args) throws IOException {
// System.out.println("currentProteinId = " + currentProteinId);
}

if (!interactionWithItself) {
if (protein2Id < 0) {
//Since we did not find the protein we try to find a isoform instead
long isoformId = -1;
IndexHits<Long> isoformIdIndexHits = isoformIdIndex.get(IsoformNode.ISOFORM_ID_INDEX, interactant2AccessionSt);
if (isoformIdIndexHits.hasNext()) {
if (isoformIdIndexHits.size() == 1) {
isoformId = isoformIdIndexHits.getSingle();
}
}
if (isoformId >= 0) {

proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.EXPERIMENTS_PROPERTY, experimentsSt);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.ORGANISMS_DIFFER_PROPERTY, organismsDifferSt);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.INTACT_ID_1_PROPERTY, intactId1St);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.INTACT_ID_2_PROPERTY, intactId2St);

inserter.createRelationship(currentProteinId, isoformId, proteinIsoformInteractionRel, proteinIsoformInteractionProperties);

if (protein2Id < 0) {
//Since we did not find the protein we try to find a isoform instead
long isoformId = -1;
IndexHits<Long> isoformIdIndexHits = isoformIdIndex.get(IsoformNode.ISOFORM_ID_INDEX, interactant2AccessionSt);
if (isoformIdIndexHits.hasNext()) {
if (isoformIdIndexHits.size() == 1) {
isoformId = isoformIdIndexHits.getSingle();
}
} else {
}
if (isoformId >= 0) {

proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.EXPERIMENTS_PROPERTY, experimentsSt);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.ORGANISMS_DIFFER_PROPERTY, organismsDifferSt);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.INTACT_ID_1_PROPERTY, intactId1St);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.INTACT_ID_2_PROPERTY, intactId2St);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.EXPERIMENTS_PROPERTY, experimentsSt);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.ORGANISMS_DIFFER_PROPERTY, organismsDifferSt);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.INTACT_ID_1_PROPERTY, intactId1St);
proteinIsoformInteractionProperties.put(ProteinIsoformInteractionRel.INTACT_ID_2_PROPERTY, intactId2St);

inserter.createRelationship(currentProteinId, protein2Id, proteinProteinInteractionRel, proteinProteinInteractionProperties);
inserter.createRelationship(currentProteinId, isoformId, proteinIsoformInteractionRel, proteinIsoformInteractionProperties);

}
} else {
//this is the case where one protein interacts with itself

proteinSelfInteractionProperties.put(ProteinSelfInteractionRel.EXPERIMENTS_PROPERTY, experimentsSt);
proteinSelfInteractionProperties.put(ProteinSelfInteractionRel.ORGANISMS_DIFFER_PROPERTY, organismsDifferSt);
proteinSelfInteractionProperties.put(ProteinSelfInteractionRel.INTACT_ID_1_PROPERTY, intactId1St);
proteinSelfInteractionProperties.put(ProteinSelfInteractionRel.INTACT_ID_2_PROPERTY, intactId2St);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.EXPERIMENTS_PROPERTY, experimentsSt);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.ORGANISMS_DIFFER_PROPERTY, organismsDifferSt);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.INTACT_ID_1_PROPERTY, intactId1St);
proteinProteinInteractionProperties.put(ProteinProteinInteractionRel.INTACT_ID_2_PROPERTY, intactId2St);

inserter.createRelationship(currentProteinId, proteinSelfInteractionsNodeId, proteinSelfInteractionRel, proteinSelfInteractionProperties);
}
inserter.createRelationship(currentProteinId, protein2Id, proteinProteinInteractionRel, proteinProteinInteractionProperties);

}


}
Expand Down
3 changes: 0 additions & 3 deletions src/com/era7/bioinfo/bio4j/programs/InitBio4jDB.java
Expand Up @@ -30,9 +30,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import org.neo4j.graphdb.index.BatchInserterIndex;
import org.neo4j.graphdb.index.BatchInserterIndexProvider;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider;
import org.neo4j.kernel.impl.batchinsert.BatchInserter;
import org.neo4j.kernel.impl.batchinsert.BatchInserterImpl;
Expand Down Expand Up @@ -82,7 +80,6 @@ public static void main(String[] args) {

Map<String, Object> alternativeProductProperties = new HashMap<String, Object>();
Map<String, Object> sequenceCautionProperties = new HashMap<String, Object>();
Map<String, Object> proteinSelfInteractionsProperties = new HashMap<String, Object>();

long alternativeProductInitiationId;
long alternativeProductPromoterId;
Expand Down

0 comments on commit f6bd2fa

Please sign in to comment.