Skip to content

Commit

Permalink
Merge pull request #159 from Verisimilitude11/deepsource-transform-83…
Browse files Browse the repository at this point in the history
…7fd95a

Format code with autopep8 and google-java-format
  • Loading branch information
VerisimilitudeX authored Oct 5, 2022
2 parents a5852b7 + 4739851 commit f5f4ec6
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/DNAnalyzer/CmdArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,37 @@
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;

@Command(name="DNAnalyzer", mixinStandardHelpOptions = true, description = "A program to analyze DNA sequences.")
@Command(
name = "DNAnalyzer",
mixinStandardHelpOptions = true,
description = "A program to analyze DNA sequences.")
public class CmdArgs implements Runnable {
@Option(required=true, names = {"--amino"}, description = "The amino acid representing the start of a gene.")
@Option(
required = true,
names = {"--amino"},
description = "The amino acid representing the start of a gene.")
String aminoAcid;

@Option(names = {"--min"}, description = "The minimum count of the reading frame.")
@Option(
names = {"--min"},
description = "The minimum count of the reading frame.")
int minCount = 0;

@Option(names = {"--max"}, description = "The maximum count of the reading frame.")
@Option(
names = {"--max"},
description = "The maximum count of the reading frame.")
int maxCount = 0;

@Parameters(paramLabel = "DNA", description = "The FASTA file to be analyzed.")
@Parameters(paramLabel = "DNA", description = "The FASTA file to be analyzed.")
File dnaFile;

@Option(names = {"--find"}, description = "The DNA sequence to be found within the FASTA file.")
@Option(
names = {"--find"},
description = "The DNA sequence to be found within the FASTA file.")
File proteinFile;

String readFile(File file) throws IOException {
Expand Down Expand Up @@ -65,9 +76,11 @@ public void run() {
System.out.println("\nGC-content (genome): " + gcContent + "\n");
Properties.printNucleotideCount(dna);

// Output the number of codons based on the reading frame the user wants to look at, and minimum and maximum filters
// Output the number of codons based on the reading frame the user wants to look at, and minimum
// and maximum filters
final short READING_FRAME = 1;
final ReadingFrames aap = new ReadingFrames(new CodonFrame(dna, READING_FRAME, minCount, maxCount));
final ReadingFrames aap =
new ReadingFrames(new CodonFrame(dna, READING_FRAME, minCount, maxCount));
System.out.print("\n");
aap.printCodonCounts();

Expand All @@ -76,7 +89,8 @@ public void run() {
Pattern p = Pattern.compile(protein);
Matcher m = p.matcher(dna);
if (m.find()) {
System.out.println("\nProtein sequence found at index " + m.start() + " in the DNA sequence.");
System.out.println(
"\nProtein sequence found at index " + m.start() + " in the DNA sequence.");
} else {
System.out.println("\nProtein sequence not found in the DNA sequence.");
}
Expand Down

0 comments on commit f5f4ec6

Please sign in to comment.