Skip to content

Commit

Permalink
Merge pull request #55 from metabolomics-us/QA
Browse files Browse the repository at this point in the history
FIEHNLAB-1783/Fix Null Pointer
  • Loading branch information
NolanGuzman97 committed May 31, 2022
2 parents f7992f2 + 4d4cc69 commit 643f923
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,6 @@ class MSPWriter extends DomainWriter {
}
}

/**
* Writes InChI metadata string if one is present exists
*
* @param spectrum
* @param writer
*/
def buildCompoundInChi(spectrum: Spectrum, writer: PrintWriter): Unit = {
val compound: Compound = spectrum.compound.find(_.kind == "biological").getOrElse(spectrum.compound.head)

if (compound != null) {
if(compound.inchi != null && compound.inchi.nonEmpty) {
writer.println(s"InChI: ${compound.inchi}")
}
else {
val metaData: Option[MetaData] = compound.metaData.find(_.name == "InChI")

if (metaData.isDefined) {
writer.println(s"InChI: ${metaData.get.value}")
}
}
}
}
/**
* Writes the comment string containing all available metadata in the format "name=value"
*
Expand Down Expand Up @@ -185,7 +163,6 @@ class MSPWriter extends DomainWriter {
// MetaData
p.println(s"DB#: ${spectrum.id}")
buildCompoundInchiKey(spectrum, p)
buildCompoundInChi(spectrum, p)
buildMetaData(spectrum.metaData, "Precursor_type", "precursor type", p)
buildMetaData(spectrum.metaData, "Spectrum_type", "ms level", p)
buildMetaData(spectrum.metaData, "PrecursorMZ", "precursor m/z", p)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ class SDFWriter extends DomainWriter{
}
}

def buildCompoundInChI(compound: Compound, writer: PrintWriter): Unit = {
if (compound.inchi != null && compound.inchiKey.nonEmpty) {
printMetaData("INCHI", compound.inchi, writer)
} else {
buildMetaData(compound.metaData, "InChI", "INCHI", writer)
}
}

/**
* Writes the comment string containing all available metadata in the format "name=value"
Expand Down Expand Up @@ -165,7 +158,6 @@ class SDFWriter extends DomainWriter{
buildMetaData(spectrum.metaData, "COLLISION ENERGY", "collision energy", p)
buildMetaData(spectrum.metaData, "ION MODE", "ionization mode", p, x => x.charAt(0).toUpper.toString)
buildCompoundInchiKey(compound, p)
buildCompoundInChI(compound, p)
buildMetaData(compound.metaData, "FORMULA", "molecular formula", p)
buildMetaData(compound.metaData, "EXACT MASS", "total exact mass", p)
buildMetaData(compound.metaData, "MW", "total exact mass", p, x => (x.toDouble + 0.2).toInt.toString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ class SDFWriterTest extends AnyWordSpec {
assert(out.toString.contains("> <INCHIKEY>\r\nQASFUMOKHFSJGL-LAFRSMQTSA-N"))
}

"InChI" in {
assert(out.toString.contains("> <INCHI>\r\nInChI=1S/C27H41NO2/c1-15-11-24-25(28-14-15)17(3)27(30-24)10-8-20-21-6-5-18-12-19(29)7-9-26(18,4)23(21)13-22(20)16(27)2/h5,15,17,19-21,23-25,28-29H,6-14H2,1-4H3/t15-,17+,19-,20-,21-,23-,24+,25-,26-,27-/m0/s1"))
}

"molecular weight" in {
assert(out.toString.contains("> <MW>\r\n411"))
}
Expand Down Expand Up @@ -124,10 +120,6 @@ class SDFWriterTest extends AnyWordSpec {
assert(out.toString.contains("> <INCHIKEY>\r\nQKLPUVXBJHRFQZ-UHFFFAOYSA-N"))
}

"InChI" in {
assert(out.toString.contains("> <INCHI>\r\nInChI=1S/C10H9ClN4O2S/c11-9-5-13-6-10(14-9)15-18(16,17)8-3-1-7(12)2-4-8/h1-6H,12H2,(H,14,15)"))
}

"molecular formula" in {
assert(out.toString.contains("> <FORMULA>\r\nC10H9ClN4O2S"))
}
Expand Down
45 changes: 45 additions & 0 deletions backend/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ services:
volumes:
- mongo-data:/data/db
command: --wiredTigerCacheSizeGB 10
logging:
options:
max-size: "100M"

# Elasticsearch master and entrypoint
elasticsearch_master:
Expand All @@ -25,17 +28,26 @@ services:
ports:
- "9200:9200"
- "9300:9300"
logging:
options:
max-size: "100M"

# Elasticsearch node, which may be scaled
elasticsearch_node:
image: elasticsearch:2.4
command: [ elasticsearch, -Des.cluster.name=mona-cluster, -Dnetwork.host=0.0.0.0, -Des.index.query.bool.max_clause_count=10240 ]
logging:
options:
max-size: "100M"

rabbitmq:
image: rabbitmq:3.6-management
ports:
- "15672:15672"
- "5672:5672"
logging:
options:
max-size: "100M"


#
Expand All @@ -56,6 +68,9 @@ services:
- JAVA_OPTS='-Xmx4g -XX:+UseParallelGC'
- GIT_USER=${GIT_USER}
- GIT_PASS=${GIT_PASS}
logging:
options:
max-size: "100M"


#
Expand All @@ -68,6 +83,9 @@ services:
depends_on:
- discovery
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx6g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Webhook support to notify external apis
webhooks:
Expand All @@ -77,6 +95,9 @@ services:
depends_on:
- discovery
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Scheduler for curation jobs
curationScheduler:
Expand All @@ -86,6 +107,9 @@ services:
depends_on:
- discovery
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Serves the content of MoNA as a repository
repository:
Expand All @@ -97,6 +121,9 @@ services:
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
volumes:
- repository-data:/data
logging:
options:
max-size: "100M"


#
Expand All @@ -109,11 +136,17 @@ services:
depends_on:
- curationScheduler
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx6g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Main authentication service
auth:
image: public.ecr.aws/fiehnlab/mona-auth-server:test
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# MoNA similarity service
similarity:
Expand All @@ -123,6 +156,9 @@ services:
depends_on:
- curationScheduler
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx8g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"


#
Expand All @@ -139,6 +175,9 @@ services:
environment:
- VIRTUAL_HOST='mona.fiehnlab.ucdavis.edu'
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xss4m -Xmx4g -XX:+UseParallelGC -XX:+UseCompressedOops -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Download service for scheduling and running download jobs
downloader:
Expand All @@ -150,10 +189,16 @@ services:
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx6g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
volumes:
- downloader-data:/data
logging:
options:
max-size: "100M"

# Run scheduled curation tasks
curationRunner:
image: public.ecr.aws/fiehnlab/mona-curation-runner:test
depends_on:
- persistence
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"
48 changes: 48 additions & 0 deletions backend/docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ services:
volumes:
- mongo-data:/data/db
command: --wiredTigerCacheSizeGB 48
logging:
options:
max-size: "100M"

# Elasticsearch master and entrypoint
elasticsearch_master:
Expand All @@ -25,17 +28,26 @@ services:
ports:
- "9200:9200"
- "9300:9300"
logging:
options:
max-size: "100M"

# Elasticsearch node, which may be scaled
elasticsearch_node:
image: elasticsearch:2.4
command: [ elasticsearch, -Des.cluster.name=mona-cluster, -Dnetwork.host=0.0.0.0, -Des.index.query.bool.max_clause_count=10240 ]
logging:
options:
max-size: "100M"

rabbitmq:
image: rabbitmq:3.6-management
ports:
- "15672:15672"
- "5672:5672"
logging:
options:
max-size: "100M"


#
Expand All @@ -54,6 +66,9 @@ services:
- ./nginx_v2/certs:/etc/letsencrypt
- ./nginx_v2/config/mona.fiehnlab.ucdavis.edu.conf:/etc/nginx/conf.d/mona.fiehnlab.ucdavis.edu.conf
- ./nginx_v2/config/massbank.us.conf:/etc/nginx/conf.d/massbank.us.conf
logging:
options:
max-size: "100M"


#
Expand All @@ -74,6 +89,9 @@ services:
- JAVA_OPTS='-Xmx4g -XX:+UseParallelGC'
- GIT_USER=${GIT_USER}
- GIT_PASS=${GIT_PASS}
logging:
options:
max-size: "100M"


#
Expand All @@ -86,6 +104,9 @@ services:
depends_on:
- discovery
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx6g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Webhook support to notify external apis
webhooks:
Expand All @@ -95,6 +116,9 @@ services:
depends_on:
- discovery
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Scheduler for curation jobs
curationScheduler:
Expand All @@ -104,6 +128,9 @@ services:
depends_on:
- discovery
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Serves the content of MoNA as a repository
repository:
Expand All @@ -115,6 +142,9 @@ services:
entrypoint: bash -c "./wait-for-it.sh discovery:8761 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
volumes:
- repository-data:/data
logging:
options:
max-size: "100M"


#
Expand All @@ -127,13 +157,19 @@ services:
depends_on:
- curationScheduler
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx6g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Main authentication service
auth:
image: public.ecr.aws/fiehnlab/mona-auth-server:prod
depends_on:
- curationScheduler
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx4g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# MoNA similarity service
similarity:
Expand All @@ -143,6 +179,9 @@ services:
depends_on:
- curationScheduler
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx8g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"


#
Expand All @@ -159,6 +198,9 @@ services:
environment:
- VIRTUAL_HOST='mona.fiehnlab.ucdavis.edu'
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xss4m -Xmx4g -XX:+UseParallelGC -XX:+UseCompressedOops -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"

# Download service for scheduling and running download jobs
downloader:
Expand All @@ -170,10 +212,16 @@ services:
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx8g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
volumes:
- downloader-data:/data
logging:
options:
max-size: "100M"

# Run scheduled curation tasks
curationRunner:
image: public.ecr.aws/fiehnlab/mona-curation-runner:prod
depends_on:
- persistence
entrypoint: bash -c "./wait-for-it.sh webhooks:4444 -t 3600 --strict -- java -Xmx8g -XX:+UseParallelGC -Dspring.cloud.config.uri=http://discovery:8761/config -Dspring.profiles.active=docker -jar *.jar"
logging:
options:
max-size: "100M"
Loading

0 comments on commit 643f923

Please sign in to comment.