Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 1.24 KB

chromosomeposition.md

File metadata and controls

53 lines (33 loc) · 1.24 KB

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

Prev: Chapter 2 : gene names information

Next: Chapter 4 : GTF and GFF files