Sorry for the naive question. Just found out by adding several rows in the
printGenes() to dig out the gene annotation information.

        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());
                                Annotation geneAnnotation = f.getAnnotation();
                                java.util.Set theKeys = geneAnnotation.keys();
                                java.util.Iterator keyIterator = theKeys.iterator();
                                while (keyIterator.hasNext()) {
                                String key = (String) keyIterator.next();
                                System.out.println("\t" + key + " = "
                                        + geneAnnotation.getProperty(key).toString());
                        }
                                printGenes(f.features());
                }
                }
        }



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Gang Wu
Sent: Monday, April 12, 2004 1:43 PM
To: Bio-Java
Subject: [Biojava-l] How to pull out the detailed information in
Genbankfeature table


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());
              }
                }
        }

_______________________________________________
Biojava-l mailing list  -  [EMAIL PROTECTED]
http://biojava.org/mailman/listinfo/biojava-l

_______________________________________________
Biojava-l mailing list  -  [EMAIL PROTECTED]
http://biojava.org/mailman/listinfo/biojava-l

Reply via email to