Skip to content

Commit

Permalink
Merge pull request #93 from aakash232/main
Browse files Browse the repository at this point in the history
Update ProteinFinder.java
  • Loading branch information
VerisimilitudeX authored Oct 1, 2022
2 parents 30da32d + 76162bb commit fb73b2c
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions src/DNAnalyzer/ProteinFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,46 @@
* @author Piyush Acharya (@Verisimilitude11)
* @version 1.2.1
*/
public class ProteinFinder {

public class ProteinFinder {

private final ArrayList<String> aminoAcidList = new ArrayList<>();
private final ArrayList<String> proteinList = new ArrayList<>();


/**
* This method inculdes the main algorithm to return the proteins present in
* a DNA sequence.
* The method first maps the amino acid that the user entered to the start
* codon list. The main algorithm then finds proteins in the DNA sequence by
* looping through the start codons for the amino acid that the user entered.
* Returns the list of proteins found in the enetred DNA sequence
*
* @param dna String to store DNA sequence
* @param aminoAcid String to store amino acid that user has passed
* @param isoleucine List for isoleucine amino acid
* @param leucine List for leucine amino acid
* @param valine List for valine amino acid
* @param phenylalanine List for phenylalanine amino acid
* @param methionine List for methionine amino acid
* @param cysteine List for cysteine amino acid
* @param alanine List for alanine amino acid
* @param glycine List for glycine amino acid
* @param proline List for proline amino acid
* @param threonine List for threonine amino acid
* @param serine List for serine amino acid
* @param tyrosine List for tyrosine amino acid
* @param tryptophan List for tryptophan amino acid
* @param glutamine List for glutamine amino acid
* @param asparagine List for asparagine amino acid
* @param histidine List for histidine amino acid
* @param glutamicAcid List for glutamicAcid amino acid
* @param asparticAcid List for asparticAcid amino acid
* @param lysine List for lysine amino acid
* @param arginine List for arginine amino acid
* @param stop List for stop to be used in main algorithm
*
* @return proteinList List of proteins found in the DNA sequence. null if no proteins found.
*/
public ArrayList<String> getProtein(final String dna, final String aminoAcid, final ArrayList<String> isoleucine,
final ArrayList<String> leucine,
final ArrayList<String> valine, final ArrayList<String> phenylalanine, final ArrayList<String> methionine,
Expand Down Expand Up @@ -76,10 +112,12 @@ public ArrayList<String> getProtein(final String dna, final String aminoAcid, fi
}

if (this.proteinList.isEmpty()) {
// Return null if no protein found in DNA sequence
System.out.println("No proteins found");
return null;
}

// Return list of proteins found in the DNA sequence
return this.proteinList;
}
}

0 comments on commit fb73b2c

Please sign in to comment.