本文整理汇总了Java中org.bridgedb.IDMapperException类的典型用法代码示例。如果您正苦于以下问题:Java IDMapperException类的具体用法?Java IDMapperException怎么用?Java IDMapperException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDMapperException类属于org.bridgedb包,在下文中一共展示了IDMapperException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncGet
import org.bridgedb.IDMapperException; //导入依赖的package包/类
@WorkerThreadOnly
public List<? extends IRow> syncGet(Xref ref) throws IDMapperException, DataException
{
if (destFilterCache == null)
{
destFilterCache = parent.getUsedDatasources();
}
List<IRow> result;
if (!data.containsKey (ref))
{
// get results and sort them
result = new ArrayList<IRow>();
Collection <? extends IRow> collection = getDataForXref(ref, mapper, destFilterCache);
if (collection != null) result.addAll(collection);
Collections.sort(result);
data.put (ref, result);
}
else
{
result = data.get(ref);
}
return result;
}
示例2: close
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* Close the connection to the Expression database, with option to execute the 'SHUTDOWN COMPACT'
* statement before calling {@link Connection#close()}
*/
public void close() throws DataException
{
if(con != null)
{
try
{
dbConnector.closeConnection(con);
con.close();
}
catch (IDMapperException e)
{
throw new DataException (e);
}
catch (SQLException ex)
{
throw new DataException (ex);
}
con = null;
}
}
示例3: finalize
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* Run this after insterting all sample / expression data
* once, to defragment the db and create indices.
* This method closes the current database connection in order
* for the {@link DBConnector} to clean up.
*/
public void finalize() throws IDMapperException
{
try
{
con.commit();
}
catch (SQLException e)
{
throw new IDMapperException (e);
}
dbConnector.compact(con);
createGexIndices();
dbConnector.closeConnection(con, DBConnector.PROP_FINALIZE);
//The dbConnector may change the database file after cleaning up,
//for example, the derby connector first creates the database as directory
//and then adds the database to a zip file and removes the directory.
//The database name needs to be changed to the zip file in this case.
String newDb = dbConnector.finalizeNewDatabase(dbName);
setDbName(newDb);
}
示例4: testImportSimplyWrong
import org.bridgedb.IDMapperException; //导入依赖的package包/类
public void testImportSimplyWrong() throws IOException, IDMapperException
{
ImportInformation info2 = new ImportInformation();
File f = new File ("example-data/sample_data_1.txt");
assertTrue (f.exists());
info2.setTxtFile(f);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex3";
info2.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info2, null, gdb, gexManager);
// 91 errors expected if no genes can be looked up.
assertEquals (91, info2.getErrorList().size());
}
示例5: testImportAffy
import org.bridgedb.IDMapperException; //导入依赖的package包/类
public void testImportAffy() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_affymetrix.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.AFFY);
assertTrue (info.isSyscodeFixed());
assertTrue (info.digitIsDot());
assertEquals (info.getIdColumn(), 0);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex2";
info.setGexName(dbFileName);
info.setSyscodeFixed(true);
info.setDataSource(BioDataSource.AFFY);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_RAT);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// just 6 errors if all goes well
assertEquals (6, info.getErrorList().size());
}
示例6: testImportLongHeaders
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* Column headers have lenghts of over 50.
* Make sure this doesn't lead to problems when setting sample names
*/
public void testImportLongHeaders() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_data_long_headers.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.ENTREZ_GENE);
assertTrue (info.isSyscodeFixed());
assertTrue (info.digitIsDot());
assertEquals (0, info.getIdColumn());
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex3";
info.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// 0 errors if all goes well
assertEquals (0, info.getErrorList().size());
}
示例7: testImportNoHeader
import org.bridgedb.IDMapperException; //导入依赖的package包/类
public void testImportNoHeader() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_data_no_header.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.setFirstDataRow(0);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.ENTREZ_GENE);
assertFalse (info.isSyscodeFixed());
assertTrue (info.digitIsDot());
assertEquals (0, info.getIdColumn());
assertTrue (info.getNoHeader());
assertEquals ("Column A", info.getColNames()[0]);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex5";
info.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// 0 errors if all goes well
assertEquals (0, info.getErrorList().size());
}
示例8: testImportWithText
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* Test dataset contains two columns with textual data
* make sure this doesn't give problems during import
*/
public void testImportWithText() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_data_with_text.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.ENTREZ_GENE);
assertFalse (info.isSyscodeFixed());
assertEquals (info.getSyscodeColumn(), 1);
assertTrue (info.digitIsDot());
assertEquals (info.getIdColumn(), 0);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex4";
info.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// 0 errors if all goes well
assertEquals (info.getErrorList().size(), 0);
}
示例9: getIdentifiers
import org.bridgedb.IDMapperException; //导入依赖的package包/类
private String getIdentifiers(String identifier, String targetSyscodeIn,
List<String> targetSyscodeOut, IDMapper mapper) throws IDMapperException {
String identifiers = "";
Set<String> ids = new HashSet<String>();
ids.add(identifier);
Xref in = new Xref(identifier, DataSource.getBySystemCode(targetSyscodeIn));
for(String ds : targetSyscodeOut) {
Set<Xref> result = mapper.mapID(in, DataSource.getBySystemCode(ds));
for(Xref x : result) {
ids.add(x.getId());
}
}
for(String str : ids) {
if(!str.equals(identifier)) {
identifiers = identifiers + "," + str;
}
}
return identifiers;
}
示例10: getIterator
import org.bridgedb.IDMapperException; //导入依赖的package包/类
@Override
public Iterable<Xref> getIterator() throws IDMapperException {
Set<Xref> xrefs = new HashSet<Xref>();
final QueryLifeCycle pst = qAllXrefs;
synchronized (pst) {
try
{
pst.init();
ResultSet rs = pst.executeQuery();
while (rs.next())
{
xrefs.add(new Xref(rs.getString(1), DataSource.getExistingBySystemCode(rs.getString(2))));
}
}
catch (SQLException ignore)
{
throw new IDMapperException(ignore);
}
finally {pst.cleanup(); }
return xrefs;
}
}
示例11: getMapSrcTgt
import org.bridgedb.IDMapperException; //导入依赖的package包/类
private Map<DataSource, Set<DataSource>> getMapSrcTgt()
throws IDMapperException {
Map<DataSource, Set<DataSource>> map = new HashMap<DataSource, Set<DataSource>>();
Set<String> domains = stub.availableDomains(authority, species);
for (String domain : domains) {
DataSource src = DataSource.getByFullName(domain);
Set<String> ranges = stub.availableRanges(authority, species, domain);
Set<DataSource> tgts = new HashSet<DataSource>();
for (String range : ranges) {
tgts.add(DataSource.getByFullName(range));
}
map.put(src, tgts);
}
return map;
}
示例12: checkSchemaVersion
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* look at the info table of the current database to determine the schema version.
* @throws IDMapperException when looking up the schema version failed
*/
private void checkSchemaVersion() throws IDMapperException
{
int version = 0;
try
{
ResultSet r = getConnection().createStatement().executeQuery("SELECT schemaversion FROM info");
if(r.next()) version = r.getInt(1);
}
catch (SQLException e)
{
//Ignore, older db's don't even have schema version
}
if(version != GDB_COMPAT_VERSION)
{
throw new IDMapperException ("Implementation and schema version mismatch");
}
}
示例13: testGdbAttributes
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* From schema v2 to v3 there was a change in how the backpage was stored.
* In schema v2 there was a backpage column in the datanode table
* In schema v3 the backpage is split in several attributes.
* For backwards compatibility, SimpleGdbImpl2 fakes these new attributes.
* This is tested here.
* @throws IDMapperException should be considered a failed test
*/
@Ignore public void testGdbAttributes() throws IDMapperException
{
// test special attributes that are grabbed from backpage
// since this is a Schema v2 database
IDMapper gdb = BridgeDb.connect ("idmapper-pgdb:" + GDB_HUMAN);
AttributeMapper am = (AttributeMapper)gdb;
Xref ref = new Xref ("26873", DataSource.getBySystemCode("L"));
Assert.assertTrue (am.getAttributes(ref, "Synonyms").contains ("5-Opase|DKFZP434H244|OPLA"));
Assert.assertTrue (am.getAttributes(ref, "Description").contains ("5-oxoprolinase (EC 3.5.2.9) (5-oxo-L-prolinase) (5-OPase) (Pyroglutamase) [Source:UniProtKB/Swiss-Prot.Acc:O14841]"));
Assert.assertTrue (am.getAttributes(ref, "Chromosome").contains ("8"));
Assert.assertTrue (am.getAttributes(ref, "Symbol").contains ("OPLAH"));
Set<String> allExpectedAttributes = new HashSet<String>();
allExpectedAttributes.add ("26873");
}
示例14: IDMappingReaderFromDelimitedReader
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
*
* @param reader a {@link Reader}
* @param regExDataSourceDelimiter regular expression of delimiter between
* data sources
* @param regExIDDelimiter regular expression of delimiter between IDs
* @param transitivity transitivity support
* @throws IDMapperException if failed to read
*/
public IDMappingReaderFromDelimitedReader(final Reader reader,
final String regExDataSourceDelimiter,
final String regExIDDelimiter,
final boolean transitivity) throws IDMapperException {
if (reader==null || regExDataSourceDelimiter==null) {
throw new java.lang.IllegalArgumentException("reader and regExDataSourceDelimiter cannot be null");
}
readData(reader);
this.regExDataSourceDelimiter = regExDataSourceDelimiter;
this.regExIDDelimiter = regExIDDelimiter;
this.transitivity = transitivity;
dsValid = false;
idMappingValid = false;
}
示例15: readData
import org.bridgedb.IDMapperException; //导入依赖的package包/类
/**
* Read data.
* @param reader to read data from
* @throws IDMapperException when file can't be read
*/
protected void readData(final Reader reader) throws IDMapperException {
data = new ArrayList<String>();
BufferedReader bfdrd = new BufferedReader(reader);
try {
String line = bfdrd.readLine();
while (line!=null) {
data.add(line);
line = bfdrd.readLine();
}
bfdrd.close();
reader.close();
} catch(IOException e) {
throw new IDMapperException(e);
}
}