public List<Compound> getCompoundList(Integer precursor1, Integer precursor2, 
			int ionMode, List<Integer> instrumentIds, List<Integer> msTypeIds) {
		StringBuilder sb = new StringBuilder();
		sb.append("SELECT * FROM " + Compound.TABLE + " C");
		
		List<String> whereClauses = new ArrayList<String>();
		
		if (precursor1 != null && precursor2 != null) {
			sb.append(", " + Precursor.TABLE + " P");
			sb.append(" WHERE");
			sb.append(" C." + Compound.Columns.COMPOUND_ID + " = P." + Precursor.Columns.COMPOUND_ID);
			
			whereClauses.add("P." + Precursor.Columns.PRECURSOR_MZ + " BETWEEN " + precursor1 + " AND " + precursor2);
		}
		
		if (ionMode != 0) {
			whereClauses.add("C." + Compound.Columns.ION_MODE + " = " + ionMode);
		}
		if (instrumentIds != null && instrumentIds.size() > 0) {
			whereClauses.add("C." + Compound.Columns.INSTRUMENT_ID + " in (" + StringUtils.join(instrumentIds, ",") + ")");
		}
		if (msTypeIds != null && msTypeIds.size() > 0) {
			whereClauses.add("C." + Compound.Columns.MS_TYPE_ID + " in (" + StringUtils.join(msTypeIds, ",") + ")");
		}
		if (whereClauses.size() > 0) {
			sb.append(" WHERE ");
			sb.append(StringUtils.join(whereClauses, " AND "));
		}
		sb.append(" ORDER BY C." + Compound.Columns.COMPOUND_ID);
		String sql = sb.toString();
		return listGeneric(sql);
	}