[Biojava-l] How to pull out the detailed information in
Genbankfeature table
Gang Wu
gwu at molbio.mgh.harvard.edu
Mon Apr 12 16:37:31 EDT 2004
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: biojava-l-bounces at portal.open-bio.org
[mailto:biojava-l-bounces at portal.open-bio.org]On 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 - Biojava-l at biojava.org
http://biojava.org/mailman/listinfo/biojava-l
More information about the Biojava-l
mailing list