[Biojava-l] How to pull out the detailed information in Genbank feature table

Gang Wu gwu at molbio.mgh.harvard.edu
Mon Apr 12 13:42:40 EDT 2004


Following is a piece of code I used to retrieve the gene information in the
feature table of GeneBank flat file. Seems "location" is the only
inforamtion stored in Feature class. Is there a way to retrieve other
detailed informaiton like "/note", "/locus_tag" etc?

Thanks


	public static void main (String [] args) {
		BufferedReader br = new BufferedReader(new FileReader("GenBankFilePath"));
		SequenceIterator stream = SeqIOTools.readGenbank(br);
		Sequence seq = stream.nextSequence();
		printGenes(seq.features());
	}

	public static void printGenes(Iterator features) {
        	while(features.hasNext()) {
            	Feature f = (Feature) features.next();
	            if (f.getType().equalsIgnoreCase("gene")) {
      	      	System.out.print(f.getType() + " at " +
f.getLocation().toString());
                		printGenes(f.features());
      	      }
        	}
    	}



More information about the Biojava-l mailing list