Thanks guys, that's done the trick. Keith's suggestion of doing this:
dc.reattachItem(arrayDesign); dc.reattachItem(cdfFile); Affymetrix.setCdfFile(arrayDesign, cdfFile); has worked fine. Nicklas's suggestion of doing this: RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssays[i].getId()); rather than using rawBioAssays[i] directly before calling Affymetrix.setCelFile has sorted the second problem. Thanks Micha ================================== Dr Micha M Bayer Bioinformatics Specialist Genetics Programme The Scottish Crop Research Institute Invergowrie Dundee DD2 5DA Scotland, UK Telephone +44(0)1382 562731 ext. 2309 Fax +44(0)1382 562426 http://www.scri.sari.ac.uk/MichaBayer.htm ============================= > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:basedb-users- > [EMAIL PROTECTED] On Behalf Of Nicklas Nordborg > Sent: 13 February 2007 22:07 > To: BASE ML > Subject: Re: [base] BASE2: Affymetrix.java method calls throw exceptions > > Micha Bayer wrote: > > Hi, > > > > I am trying to add Affymetrix support for the batch import plugin I have > > been working on, and I am having trouble getting things to work with the > > Affymetrix class. Is there a unit test for this class that I could look > > at for finding out about proper use of this class? I may just not be > > doing things right here. > > > > I get exceptions from two of the method calls -- setCdfFile(ArrayDesign > > design, File file) and setCelFile(RawBioAssay rawBioAssay, File file). > > > > setCdfFile(ArrayDesign design, File file) throws a NullPointerException > > which is not related to my own code: > > > > Affymetrix.setCdfFile(arrayDesign, cdfFile); > > > > I have double checked and both the arrayDesign and cdfFile objects are > > not null. The stacktrace looks like this: > > Can you please tell us which BASE version you are using. The stack trace > is hard to follow unless I know which version to look at. > > > > > java.lang.NullPointerException > > at > > net.sf.basedb.core.HibernateUtil.createQuery(HibernateUtil.java:1238) > > at > > net.sf.basedb.core.HibernateUtil.getPredefinedQuery(HibernateUtil.java:1 > > 387) > > at net.sf.basedb.core.AnyToAny.getByName(AnyToAny.java:129) > > at > > net.sf.basedb.core.AnyToAny.getNewOrExisting(AnyToAny.java:169) > > at net.sf.basedb.core.Affymetrix.setCdfFile(Affymetrix.java:86) > > at > > sbrn.base.BatchDataImport.importData(BatchDataImport.java:350) > > at sbrn.base.BatchDataImporter.run(BatchDataImporter.java:137) > > at > > net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest. > > java:82) > > at > > net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java: > > 420) > > at java.lang.Thread.run(Thread.java:595) > > > > > > Further down the line in my code I then try to attach the cel files to > > my raw bioassays (I have tested this independently from the above > > problem with a array design that already has a cdf file associated with > > it): > > > > Affymetrix.setCelFile(rawBioAssays[i], dataFiles[i]); > > > > ...and this gives me the following exception: > > > > > > net.sf.basedb.core.ConnectionClosedException: The connection has been > > closed. > > at net.sf.basedb.core.DbControl.getItem(DbControl.java:696) > > at > > net.sf.basedb.core.RawBioAssay.getArrayDesign(RawBioAssay.java:382) > > at net.sf.basedb.core.Affymetrix.setCelFile(Affymetrix.java:169) > > at > > sbrn.base.BatchDataImport.importData(BatchDataImport.java:371) > > at sbrn.base.BatchDataImporter.run(BatchDataImporter.java:137) > > at > > net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest. > > java:82) > > at > > net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java: > > 420) > > at java.lang.Thread.run(Thread.java:595) > > > > This is despite the fact that I have a check for a closed connection > > immediately preceding my method call, so the connection is definitely > > open before Affymetrix.setCelFile is called. > > Are you sure that you are checking the same DbControl as you used to get > the raw bioassays and files? Ie. the check you must do should correspond > to: rawBioAssays[i].getDbControl().isClosed() > > Otherwise I recommend that you do: > rawBioAssays[i] = RawBioAssay.getById(dc, rawBioAssays[i].getId()) > > where dc is an open DbControl. I don't recommend using the > DbControl.reattachItem(). It doesn't reattach linked items and may cause > problems if trying to access those. The Affymetrix.setCelFile will > access to array design linked to the raw bioassay and this may or may > not work depending on what you have done earlier. > > /Nicklas > > > > > Any help would be much appreciated. > > > > Cheers > > > > Micha > > > > ================================== > > Dr Micha M Bayer > > Bioinformatics Specialist > > Genetics Programme > > The Scottish Crop Research Institute > > Invergowrie > > Dundee > > DD2 5DA > > Scotland, UK > > Telephone +44(0)1382 562731 ext. 2309 > > Fax +44(0)1382 562426 > > http://www.scri.sari.ac.uk/MichaBayer.htm > > ============================= > > > > > > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ _ > > > > SCRI, Invergowrie, Dundee, DD2 5DA. > > The Scottish Crop Research Institute is a charitable company limited by > guarantee. > > Registered in Scotland No: SC 29367. > > Recognised by the Inland Revenue as a Scottish Charity No: SC 006662. > > > > > > DISCLAIMER: > > > > This email is from the Scottish Crop Research Institute, but the views > > expressed by the sender are not necessarily the views of SCRI and its > > subsidiaries. This email and any files transmitted with it are > confidential > > to the intended recipient at the e-mail address to which it has been > > addressed. It may not be disclosed or used by any other than that > addressee. > > If you are not the intended recipient you are requested to preserve this > > confidentiality and you must not use, disclose, copy, print or rely on > this > > e-mail in any way. Please notify [EMAIL PROTECTED] quoting the > > name of the sender and delete the email from your system. > > > > Although SCRI has taken reasonable precautions to ensure no viruses are > > present in this email, neither the Institute nor the sender accepts any > > responsibility for any viruses, and it is your responsibility to scan > the email > > and the attachments (if any). > > > > > > ------------------------------------------------------------------------ > - > > Using Tomcat but need to do more? Need to support web services, > security? > > Get stuff done quickly with pre-integrated technology to make your job > easier. > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > The BASE general discussion mailing list > > basedb-users@lists.sourceforge.net > > unsubscribe: send a mail with subject "unsubscribe" to > > [EMAIL PROTECTED] > > > ------------------------------------------------------------------------ - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > The BASE general discussion mailing list > basedb-users@lists.sourceforge.net > unsubscribe: send a mail with subject "unsubscribe" to > [EMAIL PROTECTED] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ The BASE general discussion mailing list basedb-users@lists.sourceforge.net unsubscribe: send a mail with subject "unsubscribe" to [EMAIL PROTECTED]