Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TranSyT
transyt-service
Commits
17f64607
Commit
17f64607
authored
Aug 06, 2020
by
Davide Lagoa
Browse files
minor improvements, modelseedAPI added, conjugated pairs exception created
parent
290a4d49
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
src/main/java/pt/uminho/ceb/biosystems/transyt/service/blast/Blast.java
View file @
17f64607
...
...
@@ -49,14 +49,11 @@ public class Blast implements Observer{
private
Integer
queryFileSize
=
0
;
private
Properties
properties
;
private
String
queryFilePath
;
private
boolean
forceBlast
;
public
Blast
(
boolean
forceBlast
,
String
workFolderID
,
String
queryFilePath
,
Properties
properties
)
{
public
Blast
(
String
workFolderID
,
String
queryFilePath
,
Properties
properties
)
{
try
{
this
.
forceBlast
=
forceBlast
;
logger
.
info
(
"Blast process initializing..."
);
this
.
properties
=
properties
;
...
...
@@ -100,7 +97,7 @@ public class Blast implements Observer{
logger
.
info
(
"Blast process initialized!"
);
RunSimilaritySearchTransyt
run_similaritySearch
=
new
RunSimilaritySearchTransyt
(
f
orceBlast
,
properties
.
getSimilarityThreshold
(),
RunSimilaritySearchTransyt
run_similaritySearch
=
new
RunSimilaritySearchTransyt
(
properties
.
isF
orceBlast
()
,
properties
.
getSimilarityThreshold
(),
Method
.
SmithWaterman
,
sequences
,
new
AtomicBoolean
(
false
),
new
AtomicInteger
(
0
),
AlignmentScoreType
.
ALIGNMENT
);
run_similaritySearch
.
setSubjectFastaFilePath
(
tcdbFastaFile
);
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/blast/BlastAlignmentTransyt.java
View file @
17f64607
...
...
@@ -125,9 +125,7 @@ public class BlastAlignmentTransyt extends Observable implements ModelAlignments
outputFile
.
getParentFile
().
mkdirs
();
// System.out.println(outputFile.getAbsolutePath());
// System.out.println(outputFile.getAbsolutePath());
if
(
forceBlast
)
{
...
...
@@ -197,7 +195,10 @@ public class BlastAlignmentTransyt extends Observable implements ModelAlignments
String
queryID
=
iteration
.
getQueryDef
().
trim
();
Integer
queryLength
=
iteration
.
getQueryLen
();
// if(queryID.equals("b2169"))
// System.out.println();
String
[]
query_array
;
String
query_org
=
""
;
String
queryLocus
=
""
;
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/blast/RunSimilaritySearchTransyt.java
View file @
17f64607
...
...
@@ -101,7 +101,7 @@ public class RunSimilaritySearchTransyt extends Observable implements Observer {
// ConcurrentLinkedQueue<String> queryArray = new ConcurrentLinkedQueue<String>(this.querySequences.keySet());
int
numberOfCores
=
Runtime
.
getRuntime
().
availableProcessors
();
//int numberOfCores = new Double(Runtime.getRuntime().availableProcessors()*1.5).intValue();
if
(
this
.
querySequences
.
keySet
().
size
()<
numberOfCores
)
numberOfCores
=
this
.
querySequences
.
keySet
().
size
();
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/internalDB/FetchCompoundsByName.java
View file @
17f64607
...
...
@@ -77,8 +77,8 @@ public class FetchCompoundsByName {
getNamesMethod1
();
getNamesMethod2
();
forReplacement
.
put
(
"cpd02416"
,
"cpd00122"
);
//
forReplacement.put("cpd
20862
", "cpd
00082
");
forReplacement
.
put
(
"cpd02416"
,
"cpd00122"
);
forReplacement
.
put
(
"cpd
11665
"
,
"cpd
15291
"
);
for
(
String
s
:
compounds
.
keySet
())
{
...
...
@@ -236,7 +236,7 @@ public class FetchCompoundsByName {
Set
<
String
>
names
=
getSynonyms
(
node
,
nodeProperties
,
service
);
if
(
entryID
.
matches
(
"META:.*"
))
if
(
entryID
.
matches
(
"META:.*"
)
||
entryID
.
matches
(
"cpd.*"
)
)
names
.
add
(
entryID
);
for
(
String
name
:
names
)
{
...
...
@@ -401,11 +401,11 @@ public class FetchCompoundsByName {
// }
}
if
(
name
.
equalsIgnoreCase
(
"Solute"
))
System
.
out
.
println
();
if
(
Utilities
.
processBiosynthName
(
name
).
equalsIgnoreCase
(
"Solute"
))
System
.
out
.
println
();
//
if(name.equalsIgnoreCase("Solute"))
//
System.out.println();
//
//
if(Utilities.processBiosynthName(name).equalsIgnoreCase("Solute"))
//
System.out.println();
compounds
.
put
(
Utilities
.
processBiosynthName
(
name
),
references
);
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/internalDB/WriteByMetabolitesID.java
View file @
17f64607
package
pt.uminho.ceb.biosystems.transyt.service.internalDB
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Scanner
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.neo4j.graphdb.GraphDatabaseService
;
import
org.neo4j.graphdb.Node
;
import
org.neo4j.graphdb.Relationship
;
import
org.neo4j.graphdb.RelationshipType
;
import
org.neo4j.graphdb.Transaction
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -16,7 +17,6 @@ import org.slf4j.LoggerFactory;
import
pt.uminho.ceb.biosystems.transyt.scraper.tcdb.tcdbTransportTypesRetriever.Retriever
;
import
pt.uminho.ceb.biosystems.transyt.service.biosynth.initializeNeo4jdb
;
import
pt.uminho.ceb.biosystems.transyt.service.containers.BiosynthMetabolites
;
import
pt.uminho.ceb.biosystems.transyt.service.reactions.IdentifyReactionsMetabolites
;
import
pt.uminho.ceb.biosystems.transyt.service.reactions.TransportReactionsBuilder
;
import
pt.uminho.ceb.biosystems.transyt.service.transytDatabase.PopulateTransytNeo4jDatabase
;
import
pt.uminho.ceb.biosystems.transyt.utilities.capsules.BiosynthMetaboliteProperties
;
...
...
@@ -86,12 +86,12 @@ public class WriteByMetabolitesID {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
n
=
reader
.
nextInt
()
;
n
=
1
;
}
}
}
else
{
Map
<
String
,
Set
<
TcNumberContainer2
>>
newData
=
new
TransportReactionsBuilder
(
reactionsData
,
service
,
data
,
namesAndIDsContainer
,
properties
).
getResults
();
//uncomment
Map
<
String
,
Set
<
TcNumberContainer2
>>
newData
=
new
TransportReactionsBuilder
(
reactionsData
,
service
,
data
,
namesAndIDsContainer
,
properties
,
false
).
getResults
();
//uncomment
new
PopulateTransytNeo4jDatabase
(
data
,
newData
,
properties
);
}
...
...
@@ -127,17 +127,21 @@ public class WriteByMetabolitesID {
// }
// }
Node
node
=
service
.
getNodeByEntryAndLabel
(
"META:
CPD0-2232
"
,
MetaboliteMajorLabel
.
MetaCyc
);
Node
node
=
service
.
getNodeByEntryAndLabel
(
"META:
Ions
"
,
MetaboliteMajorLabel
.
MetaCyc
);
System
.
out
.
println
(
node
.
getAllProperties
());
// Iterable<Relationship> rels = node.getRelationships();
//
// for(Relationship rel : rels) {
// Long otherNode = rel.getOtherNodeId(node.getId());
// Node node = service.getNodeByEntryAndLabel("cpd15460", MetaboliteMajorLabel.ModelSeed);
//
// System.out.println(service.getNodeById(otherNode).getAllProperties());
// }
// System.out.println(node.getAllProperties());
// Iterable<Relationship> rels = node.getRelationships();
//
// for(Relationship rel : rels) {
// Long otherNode = rel.getOtherNodeId(node.getId());
//
// System.out.println(service.getNodeById(otherNode).getAllProperties());
// }
...
...
@@ -151,55 +155,65 @@ public class WriteByMetabolitesID {
@SuppressWarnings
(
"unused"
)
public
static
Map
<
String
,
Set
<
TcNumberContainer2
>>
test
(
BiosynthMetabolites
namesAndIDsContainer
,
Map
<
String
,
BiosynthMetaboliteProperties
>
data
,
BiodbGraphDatabaseService
service
,
Map
<
String
,
Set
<
TcNumberContainer2
>>
reactionsData
,
Properties
properties
)
{
try
{
Boolean
generate
=
true
;
String
accession
=
"
P04840"
;
String
accession
=
"
Q8DL32"
;
//
// test2(service, null, null);
Retriever
.
runRetriever
(
true
,
true
,
accession
);
if
(
generate
)
{
reactionsData
=
JSONFilesUtils
.
readJSONtcdbReactionsFile
();
Map
<
String
,
Set
<
TcNumberContainer2
>>
reactionsData2
=
new
HashMap
<>();
String
[]
accessions
=
new
String
[]
{
accession
};
for
(
String
acc
:
accessions
)
reactionsData2
.
put
(
acc
,
reactionsData
.
get
(
acc
));
if
(
accession
==
null
)
{
reactionsData2
=
new
HashMap
<>(
reactionsData
);
}
else
{
String
[]
accessions
=
new
String
[]
{
accession
};
for
(
String
acc
:
accessions
)
reactionsData2
.
put
(
acc
,
reactionsData
.
get
(
acc
));
}
/////TRANSYT
Map
<
String
,
Set
<
TcNumberContainer2
>>
newData
=
new
TransportReactionsBuilder
(
reactionsData2
,
service
,
data
,
namesAndIDsContainer
,
properties
).
getResults
();
//uncomment
for
(
TcNumberContainer2
container
:
newData
.
get
(
accession
))
{
Map
<
String
,
Set
<
TcNumberContainer2
>>
newData
=
new
TransportReactionsBuilder
(
reactionsData2
,
service
,
data
,
namesAndIDsContainer
,
properties
,
true
).
getResults
();
//uncomment
if
(
accession
!=
null
)
{
for
(
TcNumberContainer2
container
:
newData
.
get
(
accession
))
{
System
.
out
.
println
(
container
.
getTcNumber
());
for
(
Integer
id
:
container
.
getAllReactionsIds
())
{
System
.
out
.
println
();
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionID
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getMetaReactionID
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getCompartmentalizedReactionID
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReaction
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionBase
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionKEGG
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionBiGG
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionMetaCyc
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionModelSEED
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getOriginalReaction
());
List
<
String
>
reactions
=
container
.
getReactionContainer
(
id
).
getModelseedReactionIdentifiers
();
if
(
reactions
!=
null
)
System
.
out
.
println
(
reactions
.
stream
().
map
(
i
->
i
.
toString
()).
collect
(
Collectors
.
joining
(
";"
)));
}
System
.
out
.
println
(
container
.
getTcNumber
());
for
(
Integer
id
:
container
.
getAllReactionsIds
())
{
System
.
out
.
println
();
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionID
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getMetaReactionID
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getCompartmentalizedReactionID
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReaction
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionBase
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionKEGG
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionBiGG
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionMetaCyc
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getReactionModelSEED
());
System
.
out
.
println
(
container
.
getReactionContainer
(
id
).
getOriginalReaction
());
}
System
.
out
.
println
();
}
// new PopulateTransytNeo4jDatabase(data, newData, properties);
// new PopulateTransytNeo4jDatabase(data, newData, properties);
}
// JSONFilesUtils.writeJSONTriageReactions(newData);
...
...
@@ -246,11 +260,8 @@ public class WriteByMetabolitesID {
BiosynthMetaboliteProperties
bioSynMetab
;
Set
<
String
>
synonyms
=
FetchCompoundsByName
.
getSynonyms
(
node
,
nodeProperties
,
service
);
// if(entryID.matches("META:CPD-9781") || entryID.matches("META:CPD0-2232"))
// System.out.println();
if
(
entryID
.
matches
(
"META:.*"
))
{
if
(
entryID
.
matches
(
"META:.*"
)
||
entryID
.
matches
(
"cpd.*"
))
{
synonyms
.
add
(
entryID
);
}
// String names ="";
...
...
@@ -276,10 +287,10 @@ public class WriteByMetabolitesID {
bioSynMetab
=
new
BiosynthMetaboliteProperties
(
entryID
,
nodeProperties
.
get
(
"major_label"
).
toString
(),
synonyms
);
else
bioSynMetab
=
new
BiosynthMetaboliteProperties
(
entryID
,
BiosynthMetaboliteProperties
.
NONE
,
synonyms
);
if
(
node
.
hasProperty
(
"formula"
))
{
String
formula
=
(
String
)
nodeProperties
.
get
(
"formula"
);
if
(
formula
!=
null
&&
!(
formula
.
equalsIgnoreCase
(
"none"
)
||
formula
.
equalsIgnoreCase
(
"null"
)))
bioSynMetab
.
setFormula
(
formula
);
}
...
...
@@ -292,7 +303,9 @@ public class WriteByMetabolitesID {
bioSynMetab
.
setFormula
(
"C4H6N2O3R2"
);
//there's an error in the database, it needs to be updated
else
if
(
entryID
.
equalsIgnoreCase
(
"cpd28237"
))
bioSynMetab
.
setFormula
(
"C6H8N3O4R3"
);
//there's an error in the database, it needs to be updated
else
if
(
entryID
.
equalsIgnoreCase
(
"cpd16486"
))
bioSynMetab
.
setFormula
(
"C13H18O2"
);
//there's an error in the database, it needs to be updated
if
(
node
.
hasProperty
(
"remark"
))
bioSynMetab
.
setRemark
((
String
)
nodeProperties
.
get
(
"remark"
));
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/kbase/ModelSEED
CompoundsFileReader
.java
→
src/main/java/pt/uminho/ceb/biosystems/transyt/service/kbase/ModelSEED
RealatedOperations
.java
View file @
17f64607
package
pt.uminho.ceb.biosystems.transyt.service.kbase
;
import
java.io.FileReader
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.json.simple.JSONObject
;
import
org.json.simple.parser.JSONParser
;
public
class
ModelSEEDCompoundsFileReader
{
import
pt.uminho.ceb.biosystems.transyt.scraper.APIs.ModelSEEDAPI
;
import
pt.uminho.ceb.biosystems.transyt.service.neo4jRest.RestNeo4jGraphDatabase
;
import
pt.uminho.ceb.biosystems.transyt.service.transytDatabase.TransytNeo4jInitializer
;
import
pt.uminho.ceb.biosystems.transyt.utilities.capsules.ReactionContainer
;
import
pt.uminho.ceb.biosystems.transyt.utilities.capsules.TcNumberContainer2
;
import
pt.uminho.ceb.biosystems.transyt.utilities.files.FilesUtils
;
import
pt.uminho.ceb.biosystems.transyt.utilities.transytUtilities.Properties
;
public
class
ModelSEEDRealatedOperations
{
/**
* Method to read JSON exceptions file.
...
...
@@ -101,4 +112,151 @@ public class ModelSEEDCompoundsFileReader {
return
data
;
}
public
static
void
assingModelSEEDIdentifiersToTranSyTReactions
(
boolean
useCache
,
Map
<
String
,
Set
<
TcNumberContainer2
>>
data
)
throws
Exception
{
Map
<
String
,
List
<
String
>>
reactionsMapping
=
new
HashMap
<>();
Map
<
String
,
String
>
modelseedReactions
=
ModelSEEDAPI
.
getModelseedReaction
(
useCache
);
Map
<
String
,
String
>
notFound
=
new
HashMap
<>();
Map
<
String
,
List
<
String
>>
msReactants
=
new
HashMap
<>();
Map
<
String
,
List
<
String
>>
msProducts
=
new
HashMap
<>();
Map
<
String
,
Boolean
>
msReversible
=
new
HashMap
<>();
for
(
String
identifier
:
modelseedReactions
.
keySet
())
{
String
reaction
=
modelseedReactions
.
get
(
identifier
);
String
[]
splitReaction
=
reaction
.
split
(
"<*=>*"
);
if
(
splitReaction
.
length
>
1
&&
splitReaction
[
0
].
trim
().
length
()
>
0
&&
splitReaction
[
1
].
trim
().
length
()
>
0
)
{
msReactants
.
put
(
identifier
,
rearrangeModelSEEDReactant
(
splitReaction
[
0
]));
msProducts
.
put
(
identifier
,
rearrangeModelSEEDReactant
(
splitReaction
[
1
]));
// if(splitReaction[0].contains("cpd00066") && splitReaction[1].contains("cpd00066") &&
// splitReaction[0].contains("cpd00067") && splitReaction[1].contains("cpd00067"))
// System.out.println(identifier + "\t" + reaction);
if
(
reaction
.
contains
(
"<=>"
))
msReversible
.
put
(
identifier
,
true
);
else
msReversible
.
put
(
identifier
,
false
);
}
}
for
(
String
accession
:
data
.
keySet
())
{
for
(
TcNumberContainer2
tcContainer
:
data
.
get
(
accession
))
{
for
(
Integer
key
:
tcContainer
.
getAllReactionsIds
())
{
ReactionContainer
container
=
tcContainer
.
getReactionContainer
(
key
);
String
transytIdentifier
=
container
.
getReactionID
();
if
(
reactionsMapping
.
containsKey
(
transytIdentifier
))
{
if
(
reactionsMapping
.
get
(
transytIdentifier
)
!=
null
)
{
for
(
String
modelseedIdentifier
:
reactionsMapping
.
get
(
transytIdentifier
))
container
.
addModelseedReactionIdentifier
(
modelseedIdentifier
);
}
}
else
{
String
[]
splitReaction
=
container
.
getReactionModelSEED
().
split
(
container
.
getDirectionRegex
());
List
<
String
>
transytReactant
=
rearrangeTransytReactant
(
splitReaction
[
0
]);
List
<
String
>
transytProduct
=
rearrangeTransytReactant
(
splitReaction
[
1
]);
for
(
String
modelSeedIdentifier
:
msReversible
.
keySet
())
{
// if(modelSeedIdentifier.equals("rxn27378")) {
// System.out.println(msReactants.get(modelSeedIdentifier));
// System.out.println(transytReactant);
// System.out.println(msProducts.get(modelSeedIdentifier));
// System.out.println(transytProduct);
// }
if
(
container
.
isReversible
()
==
msReversible
.
get
(
modelSeedIdentifier
))
{
boolean
save
=
false
;
if
(
transytReactant
.
containsAll
(
msReactants
.
get
(
modelSeedIdentifier
))
&&
msReactants
.
get
(
modelSeedIdentifier
).
containsAll
(
transytReactant
)
&&
transytProduct
.
containsAll
(
msProducts
.
get
(
modelSeedIdentifier
))
&&
msProducts
.
get
(
modelSeedIdentifier
).
containsAll
(
transytProduct
))
{
save
=
true
;
}
else
if
(
container
.
isReversible
()
&&
transytReactant
.
containsAll
(
msProducts
.
get
(
modelSeedIdentifier
))
&&
msReactants
.
get
(
modelSeedIdentifier
).
containsAll
(
transytProduct
)
&&
transytProduct
.
containsAll
(
msReactants
.
get
(
modelSeedIdentifier
))
&&
msProducts
.
get
(
modelSeedIdentifier
).
containsAll
(
transytReactant
))
{
save
=
true
;
}
if
(
save
)
{
if
(!
reactionsMapping
.
containsKey
(
transytIdentifier
))
reactionsMapping
.
put
(
transytIdentifier
,
new
ArrayList
<>());
reactionsMapping
.
get
(
transytIdentifier
).
add
(
modelSeedIdentifier
);
container
.
addModelseedReactionIdentifier
(
modelSeedIdentifier
);
}
}
}
if
(
container
.
getModelseedReactionIdentifiers
()
==
null
)
{
reactionsMapping
.
put
(
transytIdentifier
,
null
);
// System.out.println(transytIdentifier + "\t" + container.getReactionModelSEED());
notFound
.
put
(
transytIdentifier
,
container
.
getReactionModelSEED
());
}
}
}
}
}
// FilesUtils.saveMapInFile("/Users/davidelagoa/Desktop/notFound.txt", notFound);
}
/**
* @param reactant
* @return
*/
private
static
List
<
String
>
rearrangeModelSEEDReactant
(
String
reactant
){
List
<
String
>
components
=
new
ArrayList
<>();
String
[]
reactantSplit
=
reactant
.
split
(
"\\+"
);
for
(
String
component
:
reactantSplit
)
{
component
=
component
.
replace
(
"("
,
""
).
replaceAll
(
"\\)\\s+"
,
""
);
//stoichiometry
component
=
component
.
replace
(
"[0]"
,
"(in)"
).
replace
(
"[1]"
,
"(out)"
).
replace
(
"[2]"
,
"(middle)"
);
//compartments
components
.
add
(
component
.
replaceAll
(
"\\s+"
,
""
).
replaceAll
(
"^1cpd"
,
"cpd"
).
trim
());
}
return
components
;
}
/**
* @param reactant
* @return
*/
private
static
List
<
String
>
rearrangeTransytReactant
(
String
reactant
){
List
<
String
>
components
=
new
ArrayList
<>();
String
[]
reactantSplit
=
reactant
.
split
(
"\\+"
);
for
(
String
component
:
reactantSplit
)
{
if
(!
component
.
contains
(
"in"
)
&&
!
component
.
contains
(
"out"
)
&&
!
component
.
contains
(
"middle"
))
component
=
component
.
concat
(
"(in)"
);
components
.
add
(
component
.
replaceAll
(
"\\s+"
,
""
).
trim
());
}
return
components
;
}
}
src/main/java/pt/uminho/ceb/biosystems/transyt/service/kbase/Reports.java
View file @
17f64607
...
...
@@ -255,6 +255,9 @@ public class Reports {
reportPath
=
reportPath
.
concat
(
"scoresMethod1.txt"
);
System
.
out
.
println
(
reportByEvalue
.
containsKey
(
"b3201"
));
System
.
out
.
println
(
reportByEvalueAux
.
containsKey
(
"b3201"
));
try
{
PrintWriter
writer
=
new
PrintWriter
(
reportPath
,
"UTF-8"
);
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/neo4jRest/RestNeo4jGraphDatabase.java
View file @
17f64607
...
...
@@ -711,6 +711,35 @@ public class RestNeo4jGraphDatabase implements AutoCloseable{
return
map
;
}
/**
* Retrieve the transport type of all reactions.
*
* @return
*/
public
Map
<
String
,
TypeOfTransporter
>
getAllReactionHasTransportType
()
{
Map
<
String
,
TypeOfTransporter
>
map
=
new
HashMap
<>();
Session
session
=
driver
.
session
();
Result
res
=
session
.
run
(
"MATCH (a:"
+
TransytNodeLabel
.
Reaction
+
")-[t:"
+
TransytRelationshipType
.
has_transport_type
+
"]->(b) "
+
"RETURN {reactid:a."
+
TransytGeneralProperties
.
ReactionID
+
", type:b."
+
TransytGeneralProperties
.
Transport_Type
+
"}"
);
while
(
res
.
hasNext
())
{
Record
record
=
res
.
next
();
String
reactionID
=
record
.
get
(
0
).
asMap
().
get
(
"reactid"
).
toString
();
String
transportType
=
record
.
get
(
0
).
asMap
().
get
(
"type"
).
toString
();
map
.
put
(
reactionID
,
TypeOfTransporter
.
valueOf
(
transportType
));
}
session
.
close
();
return
map
;
}
/**
* Find the moleculas formulas of each metabolite.
*
...
...
@@ -912,6 +941,8 @@ public class RestNeo4jGraphDatabase implements AutoCloseable{
// System.out.println(rel.getEndNode().getAllProperties());
metaboliteID
=
node
.
getProperty
(
TransytGeneralProperties
.
MetaboliteID
);
metaboliteID
=
metaboliteID
.
replace
(
" (middle)"
,
""
).
trim
();
//delete when fixed
if
(
metaboliteID
==
null
)
return
null
;
...
...
src/main/java/pt/uminho/ceb/biosystems/transyt/service/reactions/IdentifyReactionsMetabolites.java
View file @
17f64607
...
...
@@ -31,17 +31,16 @@ public class IdentifyReactionsMetabolites {
private
Map
<
String
,
Set
<
String
>>
metabolites
;
private
Map
<
String
,
String
[]>
forChildsSearch
;
private
Map
<
String
,
String
>
metabolitesByOriginalName
=
new
HashMap
<
String
,
String
>();
private
M
ap
<
String
,
BiosynthMetaboliteProperties
>
allData
;
private
M
etaboliteMajorLabel
overrideDefauldLabel
;
private
Synonyms
dictionary
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
IdentifyReactionsMetabolites
.
class
);
public
IdentifyReactionsMetabolites
(
Map
<
String
,
Set
<
TcNumberContainer2
>>
reactionsData
,
BiosynthMetabolites
namesAndIDsContainer
,
Map
<
String
,
BiosynthMetaboliteProperties
>
allData
,
BiodbGraphDatabaseService
service
)
{
BiodbGraphDatabaseService
service
)
{
this
.
dictionary
=
new
Synonyms
();
this
.
allData
=
allData
;
metabolites
=
getMetabolitesFromReactions
(
reactionsData
);
...
...
@@ -56,6 +55,35 @@ public class IdentifyReactionsMetabolites {
getMetabolitesIDs
(
namesAndIDsContainer
,
service
);
logger
.
info
(
"Total found: {}"
,
tcdbMetabolitesIDs
.
size
());
}
/**
* For use outside of TranSyT