[Biojava-l] Problem Inserting Genbank File
Michael Joss
mjoss at bio.mq.edu.au
Mon Jul 31 21:50:47 UTC 2006
Hi all,
I am pretty new to this whole BioJava/BioJavaX thing. I thought
I would start with something reasonably basic. At least what I thought
would be. I wanted to open a Genbank file and save it into a BioSQL DB.
I have got the BioSQL Database all running and BioJava and BioJavaX seem
to be working ok ( I might have messed up some stuff along the way but
it does appear to be working). I can open the file and can convert it to
fasta etc .. all the code was found in various examples. When I use
session.saveOrUpdate:
BufferedReader br = new BufferedReader(new
FileReader("C:/CODE/AY928791.GBANK"));
// a namespace to override that in the file
Namespace ns = RichObjectFactory.getDefaultNamespace();
// we are reading DNA sequences
RichSequenceIterator seqs =
RichSequence.IOTools.readGenbankDNA(br,ns);
while (seqs.hasNext()) {
RichSequence rs = seqs.nextRichSequence();
session.saveOrUpdate("Sequence",rs);
}
I get an error saying it can't insert a taxon, the taxon and taxon_name
tables seem to be populated correctly and I am not sure how to work out
why its attempting to insert a taxon that is already there? I just don't
know enough about .. well anything.. but hibernate in particular. Any
ideas?
If you need anything else please let me know? The file is simply a
single genbank record with locus the same name as the file. I tried a
few others and got the same result. I am using the latest CVS of
BioJavaX and BioJava 1.4 and Hibernate 3.1.
Cheers
Joss
6860 [main] DEBUG org.hibernate.engine.Cascade - processing cascade
ACTION_SAVE_UPDATE for: Sequence
6860 [main] DEBUG org.hibernate.engine.CascadingAction - cascading to
saveOrUpdate: Taxon
6860 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener -
transient instance of: Taxon
6860 [main] DEBUG
org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving
transient instance
6860 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener -
saving [Taxon#<null>]
6860 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener -
executing insertions
6860 [main] DEBUG org.hibernate.event.def.WrapVisitor - Wrapped
collection in role: Taxon.nameSet
6875 [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister
- Inserting entity: Taxon (native id)
6875 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open
PreparedStatement (open PreparedStatements: 0, globally: 0)
6875 [main] DEBUG org.hibernate.SQL - insert into taxon (ncbi_taxon_id,
node_rank, genetic_code, mito_genetic_code, left_value, right_value,
parent_taxon_id) values (?, ?, ?, ?, ?, ?, ?)
6875 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing
statement
6891 [main] DEBUG org.hibernate.persister.entity.AbstractEntityPersister
- Dehydrating entity: [Taxon#<null>]
6891 [main] DEBUG org.hibernate.type.IntegerType - binding '36865' to
parameter: 1
6891 [main] DEBUG org.hibernate.type.StringType - binding null to
parameter: 2
6891 [main] DEBUG org.hibernate.type.IntegerType - binding null to
parameter: 3
6891 [main] DEBUG org.hibernate.type.IntegerType - binding null to
parameter: 4
6891 [main] DEBUG org.hibernate.type.IntegerType - binding null to
parameter: 5
6891 [main] DEBUG org.hibernate.type.IntegerType - binding null to
parameter: 6
6891 [main] DEBUG org.hibernate.type.IntegerType - binding null to
parameter: 7
6953 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close
PreparedStatement (open PreparedStatements: 1, globally: 1)
6953 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing
statement
6953 [main] DEBUG org.hibernate.util.JDBCExceptionReporter - could not
insert: [Taxon] [insert into taxon (ncbi_taxon_id, node_rank,
genetic_code, mito_genetic_code, left_value, right_value,
parent_taxon_id) values (?, ?, ?, ?, ?, ?, ?)]
java.sql.SQLException: Duplicate entry '36865' for key 2
More information about the Biojava-l
mailing list