Skip to content

Commit

Permalink
Merge pull request #369 from VerisimilitudeX/ai
Browse files Browse the repository at this point in the history
New Feature - AI Analysis
  • Loading branch information
VerisimilitudeX authored Apr 3, 2023
2 parents eeaa266 + 8c0c966 commit 19f3f77
Show file tree
Hide file tree
Showing 26 changed files with 204 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

# github: [ Verisimilitude11 ]
# github: [ VerisimilitudeX ]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic"
"java.compile.nullAnalysis.mode": "automatic",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
}
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ date-released: 2022-10-10
message: "If you use this software, please cite it using these metadata."
title: "Revolutionizing DNA analysis and making it accessible to all through innovative analysis and interpretive tools"
version: "2.0.0"
url: "https://github.com/Verisimilitude11/DNAnalyzer"
url: "https://github.com/VerisimilitudeX/DNAnalyzer"
20 changes: 10 additions & 10 deletions Contributing_Guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ community looks forward to your contributions. 🎉
## I Have a Question

> If you want to ask a question, we assume that you have read the
> available [Documentation](https://github.com/Verisimilitude11/DNAnalyzer/blob/main/README.md).
> available [Documentation](https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/README.md).
> Before you ask a question, it is best to search for
> existing [Issues](https://github.com/Verisimilitude11/DNAnalyzer/issues) that might help you. In case you have found a
> existing [Issues](https://github.com/VerisimilitudeX/DNAnalyzer/issues) that might help you. In case you have found a
> suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search
> the internet for answers first.
If you then still feel the need to ask a question and need clarification, we recommend the following:

- Open an [Issue](https://github.com/Verisimilitude11/DNAnalyzer/issues/new).
- Open an [Issue](https://github.com/VerisimilitudeX/DNAnalyzer/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.

Expand Down Expand Up @@ -95,7 +95,7 @@ Click on fork to create a copy of project to your account. This creates a separa
You have forked the project you want to contribute to your GitHub account. To get this project on your development
machine we use clone command of git.

`$ git clone https://github.com/Verisimilitude11/DNAnalyzer.git` <br/>
`$ git clone https://github.com/VerisimilitudeX/DNAnalyzer.git` <br/>
Now you have the project on your local machine.

<br />
Expand All @@ -106,7 +106,7 @@ Remote means the remote location of project on GitHub. By cloning, we have a rem
forked repository. Now we will add a remote to the original repository from where we had forked.

`$ cd <your-forked-project-folder>`
`$ git remote add upstream https://github.com/Verisimilitude11/DNAnalyzer.git` <br/>
`$ git remote add upstream https://github.com/VerisimilitudeX/DNAnalyzer.git` <br/>
You will see the benefits of adding remote later.

<br />
Expand Down Expand Up @@ -183,7 +183,7 @@ following steps in advance to help us fix any potential bug as fast as possible.
- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment
components/versions (Make sure that you have read
the [documentation](https://github.com/Verisimilitude11/DNAnalyzer/blob/main/README.md). If you are looking for
the [documentation](https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/README.md). If you are looking for
support, you might want to check [this section](#i-have-a-question)).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there
is not already a bug report existing for your bug or error in the _**bug tracker**_.
Expand All @@ -207,7 +207,7 @@ following steps in advance to help us fix any potential bug as fast as possible.

We use GitHub issues to track bugs and errors. If you run into an issue with the project:

- Open an [Issue](https://github.com/Verisimilitude11/DNAnalyzer/issues/new). (Since we can't be sure at this point
- Open an [Issue](https://github.com/VerisimilitudeX/DNAnalyzer/issues/new). (Since we can't be sure at this point
whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to
Expand Down Expand Up @@ -238,9 +238,9 @@ to understand your suggestion and find related suggestions.

- Make sure that you are using the latest version.

- Read the [documentation](https://github.com/Verisimilitude11/DNAnalyzer/blob/main/README.md) carefully and find out if
- Read the [documentation](https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/README.md) carefully and find out if
the functionality is already covered, maybe by an individual configuration.
- Perform a [search](https://github.com/Verisimilitude11/DNAnalyzer/issues) to see if the enhancement has already been
- Perform a [search](https://github.com/VerisimilitudeX/DNAnalyzer/issues) to see if the enhancement has already been
suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to
convince the project's developers of the merits of this feature. Keep in mind that we want features that will be
Expand All @@ -251,7 +251,7 @@ to understand your suggestion and find related suggestions.

#### How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](https://github.com/Verisimilitude11/DNAnalyzer/issues).
Enhancement suggestions are tracked as [GitHub issues](https://github.com/VerisimilitudeX/DNAnalyzer/issues).

- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
Expand Down
Binary file removed DNAnalyzer-Installer.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ A [video tutorial](https://youtu.be/dOwkInn6eDw) covering the instructions below

### Build & Run

* Note: Ensure you have Java [17](https://www.oracle.com/java/technologies/downloads/#jdk17-windows) or higher installed and a `JAVA_HOME` path variable set for the program to function correctly.
The easiest way to run the program on Windows is by using the executable file located in the [releases](https://github.com/VerisimilitudeX/DNAnalyzer/releases/latest) section to install the program, build gradle and run the GUI.

* We use [Gradle](https://gradle.org) for building. The Gradle wrapper takes care of downloading dependencies, testing, compiling, linking, and packaging the code.
<details>
Expand Down Expand Up @@ -238,9 +238,9 @@ View our in-line citations in the [Citations](docs/citations.md) document.

## Contributing

* [Contributing Guidelines](https://github.com/Verisimilitude11/DNAnalyzer/blob/main/docs/Contribution%20Guideline/Contribution_Guideline.md)
* [Contributing Guidelines](https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/docs/Contribution%20Guideline/Contribution_Guideline.md)

* [How To Use Git](https://github.com/Verisimilitude11/DNAnalyzer/blob/main/docs/contributing/CONTRIBUTING.md)
* [How To Use Git](https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/docs/contributing/CONTRIBUTING.md)

## Terms of Use

Expand Down
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ dependencies {

// OpenAI-GPT-3
implementation group: 'com.github.plexpt', name: 'chatgpt', version: '4.0.1'
implementation 'com.theokanning.openai-gpt3-java:service:0.11.1'

// JSON Parser
implementation 'org.json:json:20210307'
}

application {
Expand All @@ -54,7 +58,7 @@ publishing {
repositories {
maven {
name = "Github"
url = uri("https://maven.pkg.github.com/Verisimilitude11/DNAnalyzer")
url = uri("https://maven.pkg.github.com/VerisimilitudeX/DNAnalyzer")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
Expand All @@ -69,7 +73,7 @@ publishing {
artifactId = 'dnanalyzer'
version = '2.0.0'
pom {
url.set("https://github.com/Verisimilitude11/DNAnalyzer.git")
url.set("https://github.com/VerisimilitudeX/DNAnalyzer.git")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/citations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<h4>DNAnalyzer was developed with the help of the following people:
<h4>
<a href="https://github.com/Verisimilitude11/DNAnalyzer/graphs/contributors">
<a href="https://github.com/VerisimilitudeX/DNAnalyzer/graphs/contributors">

<img src="https://contrib.rocks/image?repo=Verisimilitude11/DNAnalyzer&&max=817" alt=""/>
<img src="https://contrib.rocks/image?repo=VerisimilitudeX/DNAnalyzer&&max=817" alt=""/>

<h2 align="left" id="citations">Citations
</h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1. Fork it 🍴

You can get your own fork (copy) of [DNAnalyzer](https://github.com/Verisimilitude11/DNAnalyzer) by using the `Fork`
You can get your own fork (copy) of [DNAnalyzer](https://github.com/VerisimilitudeX/DNAnalyzer) by using the `Fork`
button at the top right of this page.

![Fork Button](https://github-images.s3.amazonaws.com/help/bootcamp/Bootcamp-Fork.png)
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing/Contribution_Guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
- Drop a :star: on the GitHub repository (It's optional)<br/>

- Before Contribute Please
read [Contributing_Guidelines.md]((https://github.com/Verisimilitude11/DNAnalyzer/blob/main/Contributing_Guidelines.md))
and [CODE_OF_CONDUCT.md]((https://github.com/Verisimilitude11/DNAnalyzer/blob/main/CODE_OF_CONDUCT.md)).
read [Contributing_Guidelines.md]((https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/Contributing_Guidelines.md))
and [CODE_OF_CONDUCT.md]((https://github.com/VerisimilitudeX/DNAnalyzer/blob/main/CODE_OF_CONDUCT.md)).

- Create an issue of the project or a feature you would like to add in the project and get the task assigned for
yourself.(Issue can be any bug fixes or any feature you want to add in this project).
Expand All @@ -13,7 +13,7 @@

- Clone the Repo by going to your local Git Client in a particular local folder in your local machine by using this
command with your forked repository link in place of below given link: <br/>
`git clone https://github.com/Verisimilitude11/DNAnalyzer`
`git clone https://github.com/VerisimilitudeX/DNAnalyzer`
- Create a branch using below command.
`git branch <your branch name>`
- Checkout to your branch.
Expand Down
14 changes: 7 additions & 7 deletions docs/wiki-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Welcome to the DNAnalyzer wiki!
> developing a Command-Line-Interface (CLI) and Graphical User Interface (GUI) that will enable physicians to quickly and
> more easily interact with the software, enabling them to identify genetic mutations that may cause disease.
# [Documents](https://github.com/Verisimilitude11/DNAnalyzer/tree/main/docs)
# [Documents](https://github.com/VerisimilitudeX/DNAnalyzer/tree/main/docs)

## Contributing

### Steps to follow 📜

#### 1. Fork it 🍴

You can get your own fork (copy) of [DNAnalyzer](https://github.com/Verisimilitude11/DNAnalyzer) by using the `Fork`
You can get your own fork (copy) of [DNAnalyzer](https://github.com/VerisimilitudeX/DNAnalyzer) by using the `Fork`
button at the top right of this page.

![Fork Button](https://github-images.s3.amazonaws.com/help/bootcamp/Bootcamp-Fork.png)
Expand Down Expand Up @@ -142,7 +142,7 @@ provide a title and description, with brevity, that describe your much-appreciat

- Clone the Repo by going to your local Git Client in a particular local folder in your local machine by using this
command with your forked repository link in place of below given link: <br/>
`git clone https://github.com/Verisimilitude11/DNAnalyzer`
`git clone https://github.com/VerisimilitudeX/DNAnalyzer`
- Create a branch using below command.
`git branch <your branch name>`
- Checkout to your branch.
Expand Down Expand Up @@ -190,12 +190,12 @@ A program to analyze DNA sequences.

## Reports

[Key Personnel and Knowledge Distribution](https://github.com/Verisimilitude11/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/reports/key-personnel-and-and-knowledge-distribution.pdf)
[Key Personnel and Knowledge Distribution](https://github.com/VerisimilitudeX/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/reports/key-personnel-and-and-knowledge-distribution.pdf)

[Technical Health Overview](https://github.com/Verisimilitude11/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/reports/technical-health-overview.pdf)
[Technical Health Overview](https://github.com/VerisimilitudeX/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/reports/technical-health-overview.pdf)

[Trend Report](https://github.com/Verisimilitude11/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/reports/trend-report.pdf)
[Trend Report](https://github.com/VerisimilitudeX/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/reports/trend-report.pdf)

## Samples

[Serine DNAlong](https://github.com/Verisimilitude11/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/samples/serine-dnalong.md)
[Serine DNAlong](https://github.com/VerisimilitudeX/DNAnalyzer/blob/936181dd714855276ea34f55b94e5b53afc8ef0e/docs/samples/serine-dnalong.md)
76 changes: 7 additions & 69 deletions src/main/java/DNAnalyzer/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,20 @@

package DNAnalyzer;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import com.plexpt.chatgpt.*;

import DNAnalyzer.ui.cli.CmdArgs;
import picocli.CommandLine;
import DNAnalyzer.utils.ai.PathRouter;

/**
* Main Class for the DNAnalyzer program.
*
* @author Piyush Acharya (@Verisimilitude11)
* @author Piyush Acharya (@VerisimilitudeX)
* @version 1.2.1
* @see <a href=
* "https://www.genome.gov/about-genomics/fact-sheets/Genomic-Data-Science">...</a>
* "https://www.genome.gov/about-genomics/fact-sheets/Genomic-Data-Science">Genomic
* Datasheet</a>
*/
public class Main {

/**
* Clears the console screen based on the operating system.
*
* @throws InterruptedException Necessary for clearing the screen
* @throws IOException Necessary for clearing the screen
* {@code @category} User Experience
*/
public static void clearTerminal() throws InterruptedException, IOException {
if (System.getProperty("os.name").contains("Windows")) { // if the os is Windows
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
} else {
System.out.print("\u001b[H\u001b[2J"); // unicode string to clear everything logged above this
System.out.flush();
}
}

/**
* Main method for the DNAnalyzer program (run this).
*
Expand All @@ -55,53 +34,12 @@ public static void clearTerminal() throws InterruptedException, IOException {
* @throws InterruptedException
*/
public static void main(final String[] args) throws InterruptedException, IOException {
// Clear the console screen
clearTerminal();

System.out.println(
"Welcome to DNAnalyzer! Please allow up to 15 seconds for the analysis to complete (note: the time may vary based on your hardware).");

String apiKey = System.getenv("OPENAI_API_KEY");
if (apiKey == null) {
clearTerminal();
new CommandLine(new CmdArgs()).execute(args);
System.out
.println("\n**Please set your OPENAI_API_KEY environment variable for an AI analysis of the DNA**");
System.exit(1);
PathRouter.regular(args);
} else {

// Create a ByteArrayOutputStream to hold the console output
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);

// Save the old System.out
PrintStream old = System.out;

// Set the new System.out to the PrintStream
System.setOut(ps);

new CommandLine(new CmdArgs()).execute(args);

// Restore the old System.out
System.out.flush();
System.setOut(old);

// Get the captured console output as a string
String output = baos.toString();

// Do something with the captured output
ChatGPT chatGPT = ChatGPT.builder()
.apiKey(apiKey)
.build()
.init();

String res = chatGPT.chat(
"From the perspective of a biological researcher, I would like you to provide a comprehensive understanding of the DNA analysis that goes beyond the surface-level information. I expect you to use technical terms but make it meaningful and tangible enough that I can learn about the DNA. In one paragraph for each topic, please explain the results of this DNA analysis to me, assuming I am an experienced biotechnology researcher. It is crucial that you avoid stating that DNA cannot be analyzed and offer more in-depth insights into the analysis: "
+ output + ". End by summarizing the results of the analysis.");

System.out.println(output + "\n-----------------------\n\nAI Analysis:\n");
System.out.println(res);
System.exit(0);
PathRouter.runGptAnalysis(args);
}

}
}
2 changes: 1 addition & 1 deletion src/main/java/DNAnalyzer/core/Properties.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Prints the list of proteins and their respective properties found in the DNA.
*
* @author Piyush Acharya (@Verisimilitude11)
* @author Piyush Acharya (@VerisimilitudeX)
* @version 1.2.1
*/
public class Properties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Declares the codon data for the 20 amino acids
*
* @author Piyush Acharya (@Verisimilitude11)
* @author Piyush Acharya (@VerisimilitudeX)
* @version 1.2.1
* @see "https://en.wikipedia.org/wiki/DNA_and_RNA_codon_tables"
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/DNAnalyzer/data/codon/CodonDataUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* provide function to access codon data from amino acid.
*
* @author Piyush Acharya (@Verisimilitude11)
* @author Piyush Acharya (@VerisimilitudeX)
* @version 1.2.1
* @see "https://en.wikipedia.org/wiki/DNA_and_RNA_codon_tables"
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/DNAnalyzer/data/codon/CodonFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Declares the codon frame
*
* @author Piyush Acharya (@Verisimilitude11)
* @author Piyush Acharya (@VerisimilitudeX)
* @version 1.2.1
* @see "https://en.wikipedia.org/wiki/DNA_and_RNA_codon_tables"
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/DNAnalyzer/ui/cli/CmdArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

package DNAnalyzer.ui.cli;

import DNAnalyzer.Main;
import DNAnalyzer.core.DNAAnalysis;
import DNAnalyzer.core.Properties;
import DNAnalyzer.ui.gui.DNAnalyzerGUI;
import DNAnalyzer.utils.core.DNATools;
import DNAnalyzer.utils.core.Utils;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
Expand Down Expand Up @@ -96,7 +96,7 @@ public void run() {
private DNAAnalysis dnaAnalyzer(final String aminoAcid) {
try {
String protein = null;
Main.clearTerminal();
Utils.clearTerminal();
final String dna = readFile(dnaFile);
if (proteinFile != null) {
protein = readFile(proteinFile);
Expand Down
Loading

0 comments on commit 19f3f77

Please sign in to comment.