4141
4242
4343public class CommandPrompt {
44-
44+
4545 /**
4646 * The main method
4747 * @param args
@@ -52,7 +52,7 @@ public class CommandPrompt {
5252 public static void main (String [] args ) throws Exception {
5353 run (args );
5454 }
55-
55+
5656 private static AminoAcidCompositionTable checkForValidityAndObtainAATable (String inputLocation , int propertyListSize , String aminoAcidCompositionLocation ,
5757 String elementMassLocation ) throws Exception {
5858 if (inputLocation == null ) {
@@ -73,7 +73,7 @@ private static AminoAcidCompositionTable checkForValidityAndObtainAATable(String
7373 }
7474 return aaTable ;
7575 }
76-
76+
7777 private static void readInputAndGenerateOutput (String outputLocation , List <Character > propertyList , List <Character > specificList ,
7878 String delimiter , String inputLocation , AminoAcidCompositionTable aaTable , int decimalPlace ) throws Exception {
7979 PrintStream output ;
@@ -90,7 +90,7 @@ private static void readInputAndGenerateOutput(String outputLocation, List<Chara
9090 }
9191 output .close ();
9292 }
93-
93+
9494 public static void run (String [] args ) throws Exception {
9595 /*
9696 * Parse input arguments
@@ -103,7 +103,7 @@ public static void run(String[] args) throws Exception{
103103 String elementMassLocation = null ;
104104 String delimiter = "," ;
105105 int decimalPlace = 4 ;
106-
106+
107107 for (int i = 0 ; i < args .length ; i ++){
108108 if (args [i ].charAt (0 ) != '-' || args [i ].length () != 2 ){
109109 showHelp ();
@@ -144,13 +144,13 @@ public static void run(String[] args) throws Exception{
144144 case '7' : propertyList .add ('7' ); break ;
145145 case '8' : propertyList .add ('8' ); break ;
146146 case '9' : propertyList .add ('9' ); break ;
147- case '0' :
148- propertyList .add ('0' );
147+ case '0' :
148+ propertyList .add ('0' );
149149 i ++;
150150 if (args [i ].length () != 1 ) throw new Error ("Invalid value: " + args [i ] + ". Amino Acid Symbol should be of single character" );
151- specificList .add (args [i ].toUpperCase ().charAt (0 ));
151+ specificList .add (args [i ].toUpperCase ().charAt (0 ));
152152 break ;
153- default :
153+ default :
154154 showHelp ();
155155 throw new Error ("Unknown option: " + args [i ]);
156156 }
@@ -160,15 +160,15 @@ public static void run(String[] args) throws Exception{
160160 /*
161161 * Check for validity of input arguments
162162 */
163- AminoAcidCompositionTable aaTable = checkForValidityAndObtainAATable (inputLocation , propertyList .size (), aminoAcidCompositionLocation ,
163+ AminoAcidCompositionTable aaTable = checkForValidityAndObtainAATable (inputLocation , propertyList .size (), aminoAcidCompositionLocation ,
164164 elementMassLocation );
165-
165+
166166 /*
167167 * Read input file and generate output
168168 */
169169 readInputAndGenerateOutput (outputLocation , propertyList , specificList , delimiter , inputLocation , aaTable , decimalPlace );
170170 }
171-
171+
172172 private static LinkedHashMap <String , ProteinSequence > readInputFile (String inputLocation , AminoAcidCompositionTable aaTable ) throws Exception {
173173 FileInputStream inStream = new FileInputStream (inputLocation );
174174 CompoundSet <AminoAcidCompound > set ;
@@ -180,29 +180,29 @@ private static LinkedHashMap<String, ProteinSequence> readInputFile(String input
180180 LinkedHashMap <String , ProteinSequence > ret ;
181181 if ( inputLocation .toLowerCase ().contains (".gb" )) {
182182 GenbankReader <ProteinSequence , AminoAcidCompound > genbankReader = new GenbankReader <ProteinSequence , AminoAcidCompound >(
183- inStream , new GenericGenbankHeaderParser <ProteinSequence , AminoAcidCompound >(),
183+ inStream , new GenericGenbankHeaderParser <ProteinSequence , AminoAcidCompound >(),
184184 new ProteinSequenceCreator (set ));
185185 ret = genbankReader .process ();
186-
187-
186+
187+
188188 } else {
189189 FastaReader <ProteinSequence , AminoAcidCompound > fastaReader = new FastaReader <ProteinSequence , AminoAcidCompound >(
190- inStream , new GenericFastaHeaderParser <ProteinSequence , AminoAcidCompound >(),
190+ inStream , new GenericFastaHeaderParser <ProteinSequence , AminoAcidCompound >(),
191191 new ProteinSequenceCreator (set ));
192192 ret = fastaReader .process ();
193-
193+
194194 }
195195 return ret ;
196196 }
197-
198- public enum PropertyName {MolecularWeight , Absorbance_True , Absorbance_False , ExtinctionCoefficient_True , ExtinctionCoefficient_False ,
199- InstabilityIndex , ApliphaticIndex , AverageHydropathyValue , IsoelectricPoint , NetCharge_pH_7 , A , R ,
197+
198+ public enum PropertyName {MolecularWeight , Absorbance_True , Absorbance_False , ExtinctionCoefficient_True , ExtinctionCoefficient_False ,
199+ InstabilityIndex , ApliphaticIndex , AverageHydropathyValue , IsoelectricPoint , NetCharge_pH_7 , A , R ,
200200 N , D , C , E , Q , G , H , I , L ,
201201 K , M , F , P , S , T , W , Y , V };
202-
202+
203203 private static void printHeader (PrintStream output , List <Character > propertyList , List <Character > specificList , String delimiter ) throws IOException {
204204 int specificCount = 0 ;
205- /*
205+ /*
206206 * 1 Molecular weight
207207 * 2 Absorbance (assumed Cys reduced and assume Cys to form cystines)
208208 * 3 Extinction coefficient (assumed Cys reduced and assume Cys to form cystines)
@@ -226,9 +226,9 @@ private static void printHeader(PrintStream output, List<Character> propertyList
226226 case '6' : sList .add (PropertyName .AverageHydropathyValue .toString ()); break ;
227227 case '7' : sList .add (PropertyName .IsoelectricPoint .toString ()); break ;
228228 case '8' : sList .add (PropertyName .NetCharge_pH_7 .toString ()); break ;
229- case '9' :
230- sList .add (PropertyName .A .toString ()); sList .add (PropertyName .R .toString ());
231- sList .add (PropertyName .N .toString ()); sList .add (PropertyName .D .toString ());
229+ case '9' :
230+ sList .add (PropertyName .A .toString ()); sList .add (PropertyName .R .toString ());
231+ sList .add (PropertyName .N .toString ()); sList .add (PropertyName .D .toString ());
232232 sList .add (PropertyName .C .toString ()); sList .add (PropertyName .E .toString ());
233233 sList .add (PropertyName .Q .toString ()); sList .add (PropertyName .G .toString ());
234234 sList .add (PropertyName .H .toString ()); sList .add (PropertyName .I .toString ());
@@ -249,9 +249,9 @@ private static void printHeader(PrintStream output, List<Character> propertyList
249249 output .flush ();
250250 }
251251
252- private static void compute (PrintStream output , String header , String sequence , String delimiter ,
252+ private static void compute (PrintStream output , String header , String sequence , String delimiter ,
253253 AminoAcidCompositionTable aaTable , List <Character > propertyList , List <Character > specificList , int decimalPlace ) throws CompoundNotFoundException {
254- /*
254+ /*
255255 * 1 Molecular weight
256256 * 2 Absorbance (assumed Cys reduced and assume Cys to form cystines)
257257 * 3 Extinction coefficient
@@ -268,38 +268,38 @@ private static void compute(PrintStream output, String header, String sequence,
268268 if (aaTable != null ){
269269 sequence = Utils .checkSequence (sequence , aaTable .getSymbolSet ());
270270 pSequence = new ProteinSequence (sequence , aaTable .getAminoAcidCompoundSet ());
271- aaSet = aaTable .getAminoAcidCompoundSet ();
271+ aaSet = aaTable .getAminoAcidCompoundSet ();
272272 }else {
273273 sequence = Utils .checkSequence (sequence );
274274 pSequence = new ProteinSequence (sequence );
275275 aaSet = AminoAcidCompoundSet .getAminoAcidCompoundSet ();
276276 }
277277 IPeptideProperties pp = new PeptidePropertiesImpl ();
278-
278+
279279 int specificCount = 0 ;
280280 List <Double > dList = new ArrayList <Double >();
281281 for (Character c :propertyList ){
282282 switch (c ){
283- case '1' :
284- if (aaTable == null )
283+ case '1' :
284+ if (aaTable == null )
285285 dList .add (pp .getMolecularWeight (pSequence ));
286- else
286+ else
287287 dList .add (pp .getMolecularWeight (pSequence ));
288288 break ;
289- case '2' :
290- dList .add (pp .getAbsorbance (pSequence , true ));
291- dList .add (pp .getAbsorbance (pSequence , false ));
289+ case '2' :
290+ dList .add (pp .getAbsorbance (pSequence , true ));
291+ dList .add (pp .getAbsorbance (pSequence , false ));
292292 break ;
293- case '3' :
293+ case '3' :
294294 dList .add (pp .getExtinctionCoefficient (pSequence , true ));
295- dList .add (pp .getExtinctionCoefficient (pSequence , false ));
295+ dList .add (pp .getExtinctionCoefficient (pSequence , false ));
296296 break ;
297297 case '4' : dList .add (pp .getInstabilityIndex (pSequence )); break ;
298298 case '5' : dList .add (pp .getApliphaticIndex (pSequence )); break ;
299299 case '6' : dList .add (pp .getAvgHydropathy (pSequence )); break ;
300300 case '7' : dList .add (pp .getIsoelectricPoint (pSequence )); break ;
301301 case '8' : dList .add (pp .getNetCharge (pSequence )); break ;
302- case '9' :
302+ case '9' :
303303 Map <AminoAcidCompound , Double > aaCompound2Double = pp .getAAComposition (pSequence );
304304 //(A, R, N, D, C, E, Q, G, H, I, L, K, M, F, P, S, T, W, Y, V)
305305 dList .add (aaCompound2Double .get (Constraints .A ));
@@ -338,7 +338,7 @@ private static void showHelp(){
338338 System .err .println ("NAME" );
339339 System .err .println ("\t An executable to generate physico-chemical properties of protein sequences." );
340340 System .err .println ();
341-
341+
342342 System .err .println ("EXAMPLES" );
343343 System .err .println ("\t java -jar AAProperties.jar -i test.fasta -a" );
344344 System .err .println ("\t \t Generates all possible properties." );
@@ -349,7 +349,7 @@ private static void showHelp(){
349349 System .err .println ("\t java -jar AAProperties.jar -i test.fasta -0 A -0 N -1" );
350350 System .err .println ("\t \t Generates composition of two specific amino acid symbol and molecular weight." );
351351 System .err .println ();
352-
352+
353353 System .err .println ("OPTIONS" );
354354 System .err .println ("\t Required" );
355355 System .err .println ("\t \t -i location of input FASTA file" );
@@ -362,7 +362,7 @@ private static void showHelp(){
362362 System .err .println ("\t \t -y location of Element Mass XML file for defining mass of elements" );
363363 System .err .println ("\t \t -d number of decimals (int) [4 (default)]" );
364364 System .err .println ();
365-
365+
366366 System .err .println ("\t Provide at least one of them" );
367367 System .err .println ("\t \t -a compute properties of option 1-9" );
368368 System .err .println ("\t \t -1 compute molecular weight" );
0 commit comments