Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AminoAcidProperties {
* @param aa The one-letter amino acid code
* @return true if amino acid is charged
*/
public static final boolean isCharged(char aa) {
public static boolean isCharged(char aa) {
if (negChargedAAs.contains(String.valueOf(aa))) {
return true;
}
Expand All @@ -60,7 +60,7 @@ else if (posChargedAAs.contains(String.valueOf(aa))) {
* @param aa The one-letter amino acid code
* @return the charge of amino acid (1 if positively charged, -1 if negatively charged, 0 if not charged)
*/
public static final int getChargeOfAminoAcid(char aa) {
public static int getChargeOfAminoAcid(char aa) {
if (negChargedAAs.contains(String.valueOf(aa))) {
return -1;
}
Expand All @@ -76,7 +76,7 @@ else if (posChargedAAs.contains(String.valueOf(aa))) {
* @param aa The one-letter amino acid code
* @return true if amino acid is polar
*/
public static final boolean isPolar(char aa) {
public static boolean isPolar(char aa) {
if (polarAAs.contains(String.valueOf(aa))) {
return true;
}
Expand All @@ -89,7 +89,7 @@ public static final boolean isPolar(char aa) {
* @param aa The one-letter amino acid code
* @return the polarity of amino acid (1 if polar, 0 if not polar)
*/
public static final int getPolarityOfAminoAcid(char aa) {
public static int getPolarityOfAminoAcid(char aa) {
if (polarAAs.contains(String.valueOf(aa))) {
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -95,8 +94,8 @@ public static void run(String[] args) throws Exception{
/*
* Parse input arguments
*/
List<Character> propertyList = new ArrayList<Character>();
List<Character> specificList = new ArrayList<Character>();
List<Character> propertyList = new ArrayList<>();
List<Character> specificList = new ArrayList<>();
String inputLocation = null;
String outputLocation = null;
String aminoAcidCompositionLocation = null;
Expand Down Expand Up @@ -179,15 +178,15 @@ private static LinkedHashMap<String, ProteinSequence> readInputFile(String input
}
LinkedHashMap<String, ProteinSequence> ret;
if ( inputLocation.toLowerCase().contains(".gb")) {
GenbankReader<ProteinSequence, AminoAcidCompound> genbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>(
inStream, new GenericGenbankHeaderParser<ProteinSequence, AminoAcidCompound>(),
GenbankReader<ProteinSequence, AminoAcidCompound> genbankReader = new GenbankReader<>(
inStream, new GenericGenbankHeaderParser<>(),
new ProteinSequenceCreator(set));
ret = genbankReader.process();


} else {
FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<ProteinSequence, AminoAcidCompound>(
inStream, new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(),
FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<>(
inStream, new GenericFastaHeaderParser<>(),
new ProteinSequenceCreator(set));
ret = fastaReader.process();

Expand All @@ -198,9 +197,9 @@ private static LinkedHashMap<String, ProteinSequence> readInputFile(String input
public enum PropertyName{MolecularWeight, Absorbance_True, Absorbance_False, ExtinctionCoefficient_True, ExtinctionCoefficient_False,
InstabilityIndex, ApliphaticIndex, AverageHydropathyValue, IsoelectricPoint, NetCharge_pH_7, A, R,
N, D, C, E, Q, G, H, I, L,
K, M, F, P, S, T, W, Y, V};
K, M, F, P, S, T, W, Y, V}

private static void printHeader(PrintStream output, List<Character> propertyList, List<Character> specificList, String delimiter) throws IOException{
private static void printHeader(PrintStream output, List<Character> propertyList, List<Character> specificList, String delimiter) {
int specificCount = 0;
/*
* 1 Molecular weight
Expand All @@ -214,7 +213,7 @@ private static void printHeader(PrintStream output, List<Character> propertyList
* 9 Composition of the 20 standard amino acid
* 0 Composition of the specific amino acid
*/
List<String> sList = new ArrayList<String>();
List<String> sList = new ArrayList<>();
sList.add("SequenceName");
for(Character c:propertyList){
switch(c){
Expand All @@ -238,7 +237,7 @@ private static void printHeader(PrintStream output, List<Character> propertyList
sList.add(PropertyName.T.toString()); sList.add(PropertyName.W.toString());
sList.add(PropertyName.Y.toString()); sList.add(PropertyName.V.toString());
break;
case '0': sList.add("" + specificList.get(specificCount++)); break;
case '0': sList.add(String.valueOf(specificList.get(specificCount++))); break;
}
}
for(int i = 0; i < sList.size(); i++){
Expand Down Expand Up @@ -272,19 +271,16 @@ private static void compute(PrintStream output, String header, String sequence,
}else{
sequence = Utils.checkSequence(sequence);
pSequence = new ProteinSequence(sequence);
aaSet = AminoAcidCompoundSet.getAminoAcidCompoundSet();
aaSet = AminoAcidCompoundSet.aminoAcidCompoundSet;
}
IPeptideProperties pp = new PeptidePropertiesImpl();

int specificCount = 0;
List<Double> dList = new ArrayList<Double>();
List<Double> dList = new ArrayList<>();
for(Character c:propertyList){
switch(c){
case '1':
if(aaTable == null)
dList.add(pp.getMolecularWeight(pSequence));
else
dList.add(pp.getMolecularWeight(pSequence));
dList.add(pp.getMolecularWeight(pSequence));
break;
case '2':
dList.add(pp.getAbsorbance(pSequence, true));
Expand Down Expand Up @@ -323,7 +319,7 @@ private static void compute(PrintStream output, String header, String sequence,
dList.add(aaCompound2Double.get(Constraints.Y));
dList.add(aaCompound2Double.get(Constraints.V));
break;
case '0': dList.add(pp.getEnrichment(pSequence, aaSet.getCompoundForString("" + specificList.get(specificCount++)))); break;
case '0': dList.add(pp.getEnrichment(pSequence, aaSet.getCompoundForString(String.valueOf(specificList.get(specificCount++))))); break;
}
}
output.print(header.replace(delimiter, "_"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,37 @@
* @see IPeptideProperties
*/
public class Constraints {
private static AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
private static final AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
//A, R, N, D, C, E, Q, G, H, I, L, K, M, F, P, S, T, W, Y, V
public static AminoAcidCompound A = aaSet.getCompoundForString("A");
public static AminoAcidCompound R = aaSet.getCompoundForString("R");
public static AminoAcidCompound N = aaSet.getCompoundForString("N");
public static AminoAcidCompound D = aaSet.getCompoundForString("D");
public static AminoAcidCompound C = aaSet.getCompoundForString("C");
public static AminoAcidCompound E = aaSet.getCompoundForString("E");
public static AminoAcidCompound Q = aaSet.getCompoundForString("Q");
public static AminoAcidCompound G = aaSet.getCompoundForString("G");
public static AminoAcidCompound H = aaSet.getCompoundForString("H");
public static AminoAcidCompound I = aaSet.getCompoundForString("I");
public static AminoAcidCompound L = aaSet.getCompoundForString("L");
public static AminoAcidCompound K = aaSet.getCompoundForString("K");
public static AminoAcidCompound M = aaSet.getCompoundForString("M");
public static AminoAcidCompound F = aaSet.getCompoundForString("F");
public static AminoAcidCompound P = aaSet.getCompoundForString("P");
public static AminoAcidCompound S = aaSet.getCompoundForString("S");
public static AminoAcidCompound T = aaSet.getCompoundForString("T");
public static AminoAcidCompound W = aaSet.getCompoundForString("W");
public static AminoAcidCompound Y = aaSet.getCompoundForString("Y");
public static AminoAcidCompound V = aaSet.getCompoundForString("V");
public static final AminoAcidCompound A = aaSet.getCompoundForString("A");
public static final AminoAcidCompound R = aaSet.getCompoundForString("R");
public static final AminoAcidCompound N = aaSet.getCompoundForString("N");
public static final AminoAcidCompound D = aaSet.getCompoundForString("D");
public static final AminoAcidCompound C = aaSet.getCompoundForString("C");
public static final AminoAcidCompound E = aaSet.getCompoundForString("E");
public static final AminoAcidCompound Q = aaSet.getCompoundForString("Q");
public static final AminoAcidCompound G = aaSet.getCompoundForString("G");
public static final AminoAcidCompound H = aaSet.getCompoundForString("H");
public static final AminoAcidCompound I = aaSet.getCompoundForString("I");
public static final AminoAcidCompound L = aaSet.getCompoundForString("L");
public static final AminoAcidCompound K = aaSet.getCompoundForString("K");
public static final AminoAcidCompound M = aaSet.getCompoundForString("M");
public static final AminoAcidCompound F = aaSet.getCompoundForString("F");
public static final AminoAcidCompound P = aaSet.getCompoundForString("P");
public static final AminoAcidCompound S = aaSet.getCompoundForString("S");
public static final AminoAcidCompound T = aaSet.getCompoundForString("T");
public static final AminoAcidCompound W = aaSet.getCompoundForString("W");
public static final AminoAcidCompound Y = aaSet.getCompoundForString("Y");
public static final AminoAcidCompound V = aaSet.getCompoundForString("V");

public static Map<AminoAcidCompound, Double> aa2ExtinctionCoefficient = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2MolecularWeight = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2Hydrophathicity = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2PKa = new HashMap<AminoAcidCompound, Double>();
public static Map<String, Double> diAA2Instability = new HashMap<String, Double>();
public static final Map<AminoAcidCompound, Double> aa2ExtinctionCoefficient = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2MolecularWeight = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2Hydrophathicity = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2PKa = new HashMap<>();
public static final Map<String, Double> diAA2Instability = new HashMap<>();

public static Map<AminoAcidCompound, Double> aa2NTerminalPka = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2CTerminalPka = new HashMap<AminoAcidCompound, Double>();
public static final Map<AminoAcidCompound, Double> aa2NTerminalPka = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2CTerminalPka = new HashMap<>();

static{
initMolecularWeight();
Expand Down Expand Up @@ -287,7 +287,7 @@ private static void initInstability(){
SingleLetterAACode[] aa = SingleLetterAACode.values();
for(int i = 0; i < aa.length; i++){
for(int j = 0; j < aa.length; j++){
diAA2Instability.put("" + aa[i] + aa[j], instability[i][j]);
diAA2Instability.put(String.valueOf(aa[i]) + aa[j], instability[i][j]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public interface IPeptideProperties{
* @return the total molecular weight of sequence + weight of water molecule
* @see ProteinSequence
*/
public double getMolecularWeight(ProteinSequence sequence);
double getMolecularWeight(ProteinSequence sequence);

/**
* Returns the molecular weight of sequence. The sequence argument must be a protein sequence consisting of only non-ambiguous characters.
Expand All @@ -80,7 +80,7 @@ public interface IPeptideProperties{
* @throws FileNotFoundException
* thrown if either elementMassFile or aminoAcidCompositionFile are not found
*/
public double getMolecularWeight(ProteinSequence sequence, File aminoAcidCompositionFile) throws JAXBException, FileNotFoundException;
double getMolecularWeight(ProteinSequence sequence, File aminoAcidCompositionFile) throws JAXBException, FileNotFoundException;

/**
* Returns the molecular weight of sequence. The sequence argument must be a protein sequence consisting of only non-ambiguous characters.
Expand All @@ -99,7 +99,7 @@ public interface IPeptideProperties{
* @throws FileNotFoundException
* thrown if either elementMassFile or aminoAcidCompositionFile are not found
*/
public double getMolecularWeight(ProteinSequence sequence, File elementMassFile, File aminoAcidCompositionFile)
double getMolecularWeight(ProteinSequence sequence, File elementMassFile, File aminoAcidCompositionFile)
throws JAXBException, FileNotFoundException;

/**
Expand All @@ -114,7 +114,7 @@ public double getMolecularWeight(ProteinSequence sequence, File elementMassFile,
* a amino acid composition table obtained by calling IPeptideProperties.obtainAminoAcidCompositionTable
* @return the total molecular weight of sequence + weight of water molecule
*/
public double getMolecularWeightBasedOnXML(ProteinSequence sequence, AminoAcidCompositionTable aminoAcidCompositionTable);
double getMolecularWeightBasedOnXML(ProteinSequence sequence, AminoAcidCompositionTable aminoAcidCompositionTable);

/**
* This method would initialize amino acid composition table based on the input xml files and stores the table for usage in future calls to
Expand All @@ -129,7 +129,7 @@ public double getMolecularWeight(ProteinSequence sequence, File elementMassFile,
* @throws FileNotFoundException
* thrown if either elementMassFile or aminoAcidCompositionFile are not found
*/
public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File aminoAcidCompositionFile)
AminoAcidCompositionTable obtainAminoAcidCompositionTable(File aminoAcidCompositionFile)
throws JAXBException, FileNotFoundException;

/**
Expand All @@ -146,7 +146,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File aminoAcidC
* @throws FileNotFoundException
* thrown if either elementMassFile or aminoAcidCompositionFile are not found
*/
public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMassFile, File aminoAcidCompositionFile)
AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMassFile, File aminoAcidCompositionFile)
throws JAXBException, FileNotFoundException;

/**
Expand All @@ -166,7 +166,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the extinction coefficient of sequence
* @see ProteinSequence
*/
public double getExtinctionCoefficient(ProteinSequence sequence, boolean assumeCysReduced);
double getExtinctionCoefficient(ProteinSequence sequence, boolean assumeCysReduced);

/**
* Returns the absorbance (optical density) of sequence. The sequence argument
Expand All @@ -182,7 +182,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the absorbance (optical density) of sequence
* @see ProteinSequence
*/
public double getAbsorbance(ProteinSequence sequence, boolean assumeCysReduced);
double getAbsorbance(ProteinSequence sequence, boolean assumeCysReduced);

/**
* Returns the instability index of sequence. The sequence argument must be
Expand All @@ -196,7 +196,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the instability index of sequence
* @see ProteinSequence
*/
public double getInstabilityIndex(ProteinSequence sequence);
double getInstabilityIndex(ProteinSequence sequence);

/**
* Returns the apliphatic index of sequence. The sequence argument must be a
Expand All @@ -213,7 +213,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the aliphatic index of sequence
* @see ProteinSequence
*/
public double getApliphaticIndex(ProteinSequence sequence);
double getApliphaticIndex(ProteinSequence sequence);

/**
* Returns the average hydropathy value of sequence. The sequence argument
Expand All @@ -229,7 +229,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the average hydropathy value of sequence
* @see ProteinSequence
*/
public double getAvgHydropathy(ProteinSequence sequence);
double getAvgHydropathy(ProteinSequence sequence);

/**
* Returns the isoelectric point of sequence. The sequence argument must be
Expand All @@ -250,9 +250,9 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the isoelectric point of sequence
* @see ProteinSequence
*/
public double getIsoelectricPoint(ProteinSequence sequence, boolean useExpasyValues);
double getIsoelectricPoint(ProteinSequence sequence, boolean useExpasyValues);

public double getIsoelectricPoint(ProteinSequence seuqence);
double getIsoelectricPoint(ProteinSequence seuqence);

/**
* Returns the net charge of sequence at pH 7. The sequence argument must be
Expand All @@ -274,11 +274,11 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @return the net charge of sequence at given pHPoint
* @see ProteinSequence
*/
public double getNetCharge(ProteinSequence sequence, boolean useExpasyValues, double pHPoint);
double getNetCharge(ProteinSequence sequence, boolean useExpasyValues, double pHPoint);

public double getNetCharge(ProteinSequence sequence, boolean useExpasyValues);
double getNetCharge(ProteinSequence sequence, boolean useExpasyValues);

public double getNetCharge(ProteinSequence sequence);
double getNetCharge(ProteinSequence sequence);

/**
* Returns the composition of specified amino acid in the sequence. The
Expand All @@ -296,7 +296,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @see ProteinSequence
* @see AminoAcidCompound
*/
public double getEnrichment(ProteinSequence sequence, AminoAcidCompound aminoAcidCode);
double getEnrichment(ProteinSequence sequence, AminoAcidCompound aminoAcidCode);

/**
* Returns the composition of the 20 standard amino acid in the sequence.
Expand All @@ -311,5 +311,5 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas
* @see ProteinSequence
* @see AminoAcidCompound
*/
public Map<AminoAcidCompound, Double> getAAComposition(ProteinSequence sequence);
Map<AminoAcidCompound, Double> getAAComposition(ProteinSequence sequence);
}
Loading