Skip to content

Commit

Permalink
Merge pull request #6 from ncats/encoding_param
Browse files Browse the repository at this point in the history
Encoding param
  • Loading branch information
ChemMitch committed Apr 27, 2023
2 parents be5e503 + 8c094c2 commit ed284ec
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 19 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@
<groupId>uk.ac.cam.ch.opsin</groupId>
<artifactId>opsin-core</artifactId>
<version>2.6.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/nih/ncats/molwitch/ElementData.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/nih/ncats/molwitch/inchi/InchiKey.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/nih/ncats/molwitch/inchi/InchiUtil.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/gov/nih/ncats/molwitch/io/ChemicalReaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/nih/ncats/molwitch/io/SdfUtil.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/gov/nih/ncats/molwitch/spi/ChemicalImplFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/CleanSdfTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/InchiKeyBagTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/InchiKeyTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit ed284ec

Please sign in to comment.