Parse Chromosomal Information of Genes
BioJava contains a parser the refFlat.txt.gz from the UCSC genome browser that contains a mapping of gene names to chromosome positions.
try { List<GeneChromosomePosition> genePositions= GeneChromosomePositionParser.getChromosomeMappings(); System.out.println("got " + genePositions.size() + " gene positions") ; for (GeneChromosomePosition pos : genePositions){ if ( pos.getGeneName().equals("FOLH1")) { System.out.println(pos); break; } } } catch(Exception e){ e.printStackTrace(); }
If a local copy of the file is available, it can be provide via this:
URL url = new URL("file://local/copy/of/file"); InputStreamProvider prov = new InputStreamProvider(); InputStream inStream = prov.getInputStream(url); GeneChromosomePositionParser.getChromosomeMappings(inStream);
Navigation: Home | Book 4: The Genomics Module | Chapter 3 : chromosomal positions