diff --git a/pom.xml b/pom.xml index 8e87925..81fe746 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,12 @@ uk.ac.cam.ch.opsin opsin-core 2.6.0 + + + org.apache.logging.log4j + log4j-api + + com.fasterxml.jackson.core diff --git a/src/main/java/gov/nih/ncats/molwitch/ElementData.java b/src/main/java/gov/nih/ncats/molwitch/ElementData.java index e4fd247..b46663f 100644 --- a/src/main/java/gov/nih/ncats/molwitch/ElementData.java +++ b/src/main/java/gov/nih/ncats/molwitch/ElementData.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/datastores/ChemicalDataStore.java b/src/main/java/gov/nih/ncats/molwitch/datastores/ChemicalDataStore.java index 7243d90..acb56d3 100644 --- a/src/main/java/gov/nih/ncats/molwitch/datastores/ChemicalDataStore.java +++ b/src/main/java/gov/nih/ncats/molwitch/datastores/ChemicalDataStore.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/datastores/FileChemicalDataStore.java b/src/main/java/gov/nih/ncats/molwitch/datastores/FileChemicalDataStore.java index 9da143b..1a7c488 100644 --- a/src/main/java/gov/nih/ncats/molwitch/datastores/FileChemicalDataStore.java +++ b/src/main/java/gov/nih/ncats/molwitch/datastores/FileChemicalDataStore.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/datastores/SimpleChemicalDataStore.java b/src/main/java/gov/nih/ncats/molwitch/datastores/SimpleChemicalDataStore.java index eec6d44..2d6ccaa 100644 --- a/src/main/java/gov/nih/ncats/molwitch/datastores/SimpleChemicalDataStore.java +++ b/src/main/java/gov/nih/ncats/molwitch/datastores/SimpleChemicalDataStore.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKey.java b/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKey.java index bbb63b7..2be0170 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKey.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKey.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2021 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyBag.java b/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyBag.java index 171b8c0..7b7c1a3 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyBag.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyBag.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyUtil.java b/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyUtil.java index d378edd..1fb318d 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyUtil.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/BinaryInchiKeyUtil.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/DefaultInchiKeyBag.java b/src/main/java/gov/nih/ncats/molwitch/inchi/DefaultInchiKeyBag.java index 094e2cc..5debfed 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/DefaultInchiKeyBag.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/DefaultInchiKeyBag.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKey.java b/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKey.java index 1519272..5de2565 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKey.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKey.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKeyBag.java b/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKeyBag.java index 27bc275..243370b 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKeyBag.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/InchiKeyBag.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/inchi/InchiUtil.java b/src/main/java/gov/nih/ncats/molwitch/inchi/InchiUtil.java index accdfef..8254c35 100644 --- a/src/main/java/gov/nih/ncats/molwitch/inchi/InchiUtil.java +++ b/src/main/java/gov/nih/ncats/molwitch/inchi/InchiUtil.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/io/ChemicalReaderFactory.java b/src/main/java/gov/nih/ncats/molwitch/io/ChemicalReaderFactory.java index 1df0d35..b8ad413 100644 --- a/src/main/java/gov/nih/ncats/molwitch/io/ChemicalReaderFactory.java +++ b/src/main/java/gov/nih/ncats/molwitch/io/ChemicalReaderFactory.java @@ -112,6 +112,16 @@ public static ChemicalReader newReader(InputStream in) throws IOException{ } return new DefaultChemicalReader(factory.create(in)); } + + public static ChemicalReader newReader(InputStream in, String encoding) throws IOException{ + Objects.requireNonNull(in, "inputstream can not be null"); + ChemicalImplFactory factory = ImplUtil.getChemicalImplFactory(); + if(factory ==null) { + throw new IOException("could not find chemical factory"); + } + return new DefaultChemicalReader(factory.create(in, encoding)); + } + public static ChemicalReader newReader(String format, InputStream in) throws IOException{ Objects.requireNonNull(in, "inputstream can not be null"); ChemicalImplFactory factory = ImplUtil.getChemicalImplFactory(format); diff --git a/src/main/java/gov/nih/ncats/molwitch/io/CtTableCleaner.java b/src/main/java/gov/nih/ncats/molwitch/io/CtTableCleaner.java index 7aed165..cf3cc82 100644 --- a/src/main/java/gov/nih/ncats/molwitch/io/CtTableCleaner.java +++ b/src/main/java/gov/nih/ncats/molwitch/io/CtTableCleaner.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/io/PushbackBufferedReader.java b/src/main/java/gov/nih/ncats/molwitch/io/PushbackBufferedReader.java index 07a7d53..e7c9e10 100644 --- a/src/main/java/gov/nih/ncats/molwitch/io/PushbackBufferedReader.java +++ b/src/main/java/gov/nih/ncats/molwitch/io/PushbackBufferedReader.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/io/SdfUtil.java b/src/main/java/gov/nih/ncats/molwitch/io/SdfUtil.java index 9d0ed69..77ac73b 100644 --- a/src/main/java/gov/nih/ncats/molwitch/io/SdfUtil.java +++ b/src/main/java/gov/nih/ncats/molwitch/io/SdfUtil.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/isotopes/ElementData.java b/src/main/java/gov/nih/ncats/molwitch/isotopes/ElementData.java index 012d95e..5b4a6e0 100644 --- a/src/main/java/gov/nih/ncats/molwitch/isotopes/ElementData.java +++ b/src/main/java/gov/nih/ncats/molwitch/isotopes/ElementData.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/isotopes/Elements.java b/src/main/java/gov/nih/ncats/molwitch/isotopes/Elements.java index 36a4df0..a0ffffd 100644 --- a/src/main/java/gov/nih/ncats/molwitch/isotopes/Elements.java +++ b/src/main/java/gov/nih/ncats/molwitch/isotopes/Elements.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/gov/nih/ncats/molwitch/spi/ChemicalImplFactory.java b/src/main/java/gov/nih/ncats/molwitch/spi/ChemicalImplFactory.java index 4a3df96..f206ed4 100644 --- a/src/main/java/gov/nih/ncats/molwitch/spi/ChemicalImplFactory.java +++ b/src/main/java/gov/nih/ncats/molwitch/spi/ChemicalImplFactory.java @@ -181,6 +181,19 @@ public interface ChemicalImplFactory { * @throws IOException if there is a problem parsing the InputStream. */ ChemicalImplReader create(InputStream in) throws IOException; + /** + * Parse the given {@link InputStream} and create all the {@link ChemicalImpl}s encoded inside it. + * The file format of the streamed file is not provided so it could be any of the + * standard cheminformatics file formats. + * + * @param in the {@link InputStream} to parse. + * @param in the {@link String} to parse. + * + * @return a List of {@link ChemicalImpl}, will never be null, and shouldn't be empty. + * + * @throws IOException if there is a problem parsing the InputStream. + */ + ChemicalImplReader create(InputStream in, String encoding) throws IOException; /** * Create a new {@link ChemicalImpl} object * that is doesn't have any atoms diff --git a/src/test/java/CleanSdfTest.java b/src/test/java/CleanSdfTest.java index 88ad67a..ca4650a 100644 --- a/src/test/java/CleanSdfTest.java +++ b/src/test/java/CleanSdfTest.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2020 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/InchiKeyBagTest.java b/src/test/java/InchiKeyBagTest.java index 22ddb90..dbc2cef 100644 --- a/src/test/java/InchiKeyBagTest.java +++ b/src/test/java/InchiKeyBagTest.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2021 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/InchiKeyTest.java b/src/test/java/InchiKeyTest.java index 9152cbd..27c39c8 100644 --- a/src/test/java/InchiKeyTest.java +++ b/src/test/java/InchiKeyTest.java @@ -1,7 +1,7 @@ /* * NCATS-MOLWITCH * - * Copyright 2022 NIH/NCATS + * Copyright 2023 NIH/NCATS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.