[Biojava-l] Need help for resolving the issue args[0]
Abdul Qaddus
abdul.qaddos at gmail.com
Fri Jun 19 06:52:38 UTC 2009
Hello Support,
I am a new developer of biojava, I have a good knowledge about java and bio,
but this is new tool for me, I have some problem while working in this
tools, below I have write down the code for reading the Gen Bank file and
then convert into "DNA", "RNA" or "Protein". I have already add the biojava
library into my source code. When I have read this code I have come to know
from your arguments portion for the execution of this code, I have need
three argument, one for the filename, second for the file type and third is
the alphabet.
Now the problem is that how I will pass these three parameter values into
source code for args[0], args[1] and args[2]. When I have passed these
values by using the string pattern then this code generte a errors, "illegel
statement". Please help me out how I can fixed this problem, I will be very
thankful to you if you will reply me soon
package biojava;
import java.io.*;
import org.biojava.bio.*;
import org.biojava.bio.seq.*;
import org.biojava.bio.seq.io.*;
public class ReadFasta2 {
/**
* This program will read any file supported by SeqIOTools it takes three
* arguments, the first is the file name the second is the name of
* a file format supported by SeqIOTools. eg fasta, genbank etc.
* The third argument is the alphabet (eg dna, rna, protein).
*
* Both the format and alphabet names are case insensitive.
*
*/
public static void main(String[] args) {
try {
//prepare a BufferedReader for file io
BufferedReader br = new BufferedReader(new FileReader(args[0]));
String format = args[1];
String alphabet = args[2];
/*
* get a Sequence Iterator over all the sequences in the file.
* SeqIOTools.fileToBiojava() returns an Object. If the file read
* is an alignment format like MSF and Alignment object is returned
* otherwise a SequenceIterator is returned.
*/
SequenceIterator iter =
(SequenceIterator)SeqIOTools.fileToBiojava(format,alphabet, br);
}
catch (FileNotFoundException ex) {
//can't find file specified by args[0]
ex.printStackTrace();
}catch (BioException ex) {
//error parsing requested format
ex.printStackTrace();
}
}
}
--
--
Abdul Qaddus
www.futurelinkers.com
Cell No:- +92-3336540863
More information about the Biojava-l
mailing list