Thanks Nicklas for the help with boolean queries. Now I'm confused by something else also affy-related.
I'm trying to write code to lookup which ArrayDesigns a Reporter is on. For non-Affy arrays this is easy (join via arrayDesignBlocks, features and reporter). For Affy arrays it looks like we have to use the CDF file through the Affy API - get all the reporter ids (e.g. ProbeSetNames) and put them in a hash for reverse lookup later. Here's a code snippet to do some of that (see last email for the definition of affyQuery). A lot of the code is taken directly from net/sf/basedb/core/Affymetrix.java, which is used by the "Affymetrix CDF probeset importer" plugin for Affy array design (see the "verify reporters" link on any Affy ArrayDesign page). When I run this plugin as the same user who runs the code below, it works fine. However I get a NullPointerException with my code... Hashtable affyProbeLookup = new Hashtable(); ItemResultList<ArrayDesign> affyList = affyQuery.list(dc); for (ArrayDesign ad : affyList) { int adId = ad.getId(); FusionCDFData cdf = Affymetrix.loadCdfFile(Affymetrix.getCdfFile(ad)); if (cdf == null) continue; int numProbesets = cdf.getHeader().getNumProbeSets(); int index = 0; while (index < numProbesets) { String probesetId = cdf.getProbeSetName(index); // Line 96 affyProbeLookup.put(probesetId, adId); index++; } } Exception in thread "main" java.lang.NullPointerException at affymetrix.gcos.cdf.CDFFileData.getProbeSetName(Unknown Source) at affymetrix.fusion.cdf.FusionCDFData.getProbeSetName(Unknown Source) at base_api_test.run_test(base_api_test.java:96) at base_api_test.main(base_api_test.java:216) note: the cdf object seems OK (numProbesets is set properly). If anyone can point me in the right direction, it would be appreciated. It's a bit difficult not having the Affy source and line numbers (is that available?) cheers, Bob. Nicklas Nordborg writes: > Bob MacCallum wrote: > > Hi all, > > > > The following works as expected: > > > > ItemQuery<ArrayDesign> affyQuery = ArrayDesign.getQuery(); > > affyQuery.include(Include.SHARED); > > affyQuery.restrict( > > Restrictions.eq(Hql.property("affyChip"), > > Expressions.integer(1) > > ) > > ); > > I think this may depend on the database that is used. I am sure it works > for MySQL since it uses a "bit"-column which can be either 0 or 1. I > don't know how Postgres handles it or if maybe Hibernate is smart enough > to fix any potential problems. I remember that our predefined queries > that filtered on boolean columns had to come in two versions, one for > MySQL and one for Postgres (see > http://base.thep.lu.se/browser/trunk/config/dist/mysql-queries.xml). I > think this has been fixed in Hibernate (or maybe in MySQL) some time > ago, since it now works with true/false values instead of 1/0. > > Another possibility is to replace Expressions.integer(1) with > Expressions.parameter("isAffy", true, Type.BOOLEAN). This should be safe > with any database. > > > but I'm a bit puzzled why there is no "Expressions.boolean(true)" in the > > API. > > Well, a lot of things get added when they are needed. I guess the reason > is that we have not had any explicit need to filter on a boolean value > before. > > > Not urgent! > > Ok. Considering potential database issues, I think it maybe is better to > go for the Expresssion.parameter() in any case. > > /Nicklas > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > basedb-devel mailing list > basedb-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/basedb-devel -- Bob MacCallum | VectorBase Developer | Kafatos/Christophides Groups | Division of Cell and Molecular Biology | Imperial College London | Phone +442075941945 | Email [EMAIL PROTECTED] ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ basedb-devel mailing list basedb-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/basedb-devel