Hello Everyone,

I am new to Biojava and quite new to java it sel (have not worked with it
in years).

I am trying to figure out how to read and later write a genbank file.

It seems that writing genbank is not supported?

What about all the different features annotated in the genbank file? When I
use getFeatures() I have 0 elements?

How can I access each sequence annotation/feature?

The genbank file is attached, and my code below.

Thanks
Ulrik

import java.io.File;
import java.util.LinkedHashMap;
import java.util.List;

import org.biojava3.core.sequence.DNASequence;
import org.biojava3.core.sequence.compound.NucleotideCompound;
import org.biojava3.core.sequence.features.FeatureInterface;
import org.biojava3.core.sequence.io.GenbankReaderHelper;
import org.biojava3.core.sequence.template.AbstractSequence;


public class bioTest{

/**
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception{

File dnaFile = new File("test-genbank.gb");
 LinkedHashMap<String, DNASequence> dnaSequences =
GenbankReaderHelper.readGenbankDNASequence( dnaFile );
 for (DNASequence sequence : dnaSequences.values()) {
     System.out.println( sequence.getSequenceAsString() );

System.out.println("Length: " + sequence.getLength());
List<FeatureInterface<AbstractSequence<NucleotideCompound>,NucleotideCompound>>
 features = sequence.getFeatures();

 System.out.println(features.size());
}
 }

}

Attachment: test-genbank.gb
Description: Binary data

_______________________________________________
Biojava-l mailing list  -  Biojava-l@lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/biojava-l

Reply via email to