The following code parses a file from the www.genenames.org website that contains a mapping of human gene names to other databases.
/** parses a file from the genenames website
*
* @param args
*/
public static void main(String[] args) {
try {
List<GeneName> geneNames = GeneNamesParser.getGeneNames();
System.out.println("got " + geneNames.size() + " gene names");
for ( GeneName g : geneNames){
if ( g.getApprovedSymbol().equals("FOLH1"))
System.out.println(g);
}
// and returns a list of beans that contains key-value pairs for each gene name
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
If you have a local copy of this file, then you can just provide an input stream for it:
URL url = new URL("file:///local/copy/of/file");
InputStreamProvider prov = new InputStreamProvider();
InputStream inStream = prov.getInputStream(url);
GeneNamesParser.getGeneNames(inStream);
Navigation: Home | Book 4: The Genomics Module | Chapter 2 : gene names information
Prev: Chapter 1 : Installation