Importing Data From "Flat" Files

Much data is available in ASCII files. These files come in various formats from various sources. The GenoViz SDK includes classes that recognize several common biological information formats. These classes are in the package com.affymetrix.genoviz.parser and (usually) implement the ContentParser interface.

The ContentParser interface is simple. It has an importContent method which will parse bytes arriving via an InputStream and return an object modeling the data. A new class implementing ContentParser should be defined for each pair of format and data model.

Here we have a very small applet that can display the contents of a fasta file in a NeoSeq. As you can see, the source code is quite short.

Exercises

  1. Use the ExportContent to save the fasta data in another file. What happened to the comments?
  2. Create ParseTwo that parses an ABI trace and displays it in a NeoSeq.
  3. Modify ParseTwo so that it can also parse a trace from an SCF file.

Next: Writing Your Own Parser