Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding param #6

Merged
merged 3 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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