Search in sources :

Example 1 with Contact

use of ubic.gemma.model.common.auditAndSecurity.Contact in project Gemma by PavlidisLab.

the class PersistentDummyObjectHelper method getTestPersistentContact.

/**
 * Convenience method to provide a Contact that can be used to fill non-nullable associations in test objects.
 *
 * @return contact
 */
public Contact getTestPersistentContact() {
    Contact c = Contact.Factory.newInstance();
    c.setName(RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH) + "_testcontact");
    c.setEmail(c.getName() + "@foo.org");
    c = (Contact) persisterHelper.persist(c);
    return c;
}
Also used : Contact(ubic.gemma.model.common.auditAndSecurity.Contact)

Example 2 with Contact

use of ubic.gemma.model.common.auditAndSecurity.Contact in project Gemma by PavlidisLab.

the class ExpressionExperimentServiceTest method setup.

@Before
public void setup() {
    if (!persisted) {
        ee = this.getTestPersistentCompleteExpressionExperiment(false);
        ee.setName(ExpressionExperimentServiceTest.EE_NAME);
        DatabaseEntry accessionEntry = this.getTestPersistentDatabaseEntry();
        accession = accessionEntry.getAccession();
        ed = accessionEntry.getExternalDatabase();
        ee.setAccession(accessionEntry);
        Contact c = this.getTestPersistentContact();
        ee.setOwner(c);
        expressionExperimentService.update(ee);
        ee = expressionExperimentService.thaw(ee);
        persisted = true;
    } else {
        log.debug("Skipping making new ee for test");
    }
}
Also used : DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) Contact(ubic.gemma.model.common.auditAndSecurity.Contact) Before(org.junit.Before)

Example 3 with Contact

use of ubic.gemma.model.common.auditAndSecurity.Contact in project Gemma by PavlidisLab.

the class ArrayDesignParser method parseOneLine.

@Override
public ArrayDesign parseOneLine(String line) {
    ArrayDesign ad = ArrayDesign.Factory.newInstance();
    String[] fields = StringUtils.splitPreserveAllTokens(line, '\t');
    ad.setName(fields[0]);
    ad.setDescription(fields[5]);
    Taxon t = Taxon.Factory.newInstance();
    t.setCommonName(fields[4].toLowerCase());
    // assumption.
    t.setIsSpecies(true);
    // assumption
    t.setIsGenesUsable(true);
    ad.setPrimaryTaxon(t);
    Contact manufacturer = Contact.Factory.newInstance();
    manufacturer.setName(fields[1]);
    ad.setDesignProvider(manufacturer);
    ad.setAdvertisedNumberOfDesignElements(Integer.parseInt(fields[4]));
    return ad;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Taxon(ubic.gemma.model.genome.Taxon) Contact(ubic.gemma.model.common.auditAndSecurity.Contact)

Example 4 with Contact

use of ubic.gemma.model.common.auditAndSecurity.Contact in project Gemma by PavlidisLab.

the class GeoConverterImpl method convertPlatform.

private ArrayDesign convertPlatform(GeoPlatform platform) {
    if (seenPlatforms.containsKey(platform.getGeoAccession())) {
        return (seenPlatforms.get(platform.getGeoAccession()));
    }
    ArrayDesign arrayDesign = this.createMinimalArrayDesign(platform);
    GeoConverterImpl.log.info("Converting platform: " + platform.getGeoAccession());
    platformDesignElementMap.put(arrayDesign.getShortName(), new HashMap<String, CompositeSequence>());
    // convert the design element information.
    String identifier = platform.getIdColumnName();
    if (identifier == null && !platform.getColumnNames().isEmpty()) {
        throw new IllegalStateException("Cannot determine the platform design element id column for " + platform + "; " + platform.getColumnNames().size() + " column names available.");
    }
    Collection<String> externalReferences = this.determinePlatformExternalReferenceIdentifier(platform);
    String descriptionColumn = this.determinePlatformDescriptionColumn(platform);
    String sequenceColumn = this.determinePlatformSequenceColumn(platform);
    ExternalDatabase externalDb = this.determinePlatformExternalDatabase(platform);
    List<String> descriptions = platform.getColumnData(descriptionColumn);
    List<String> sequences = null;
    if (sequenceColumn != null) {
        sequences = platform.getColumnData(sequenceColumn);
    }
    // The primary taxon for the array: this should be a taxon that is listed as the platform taxon on geo
    // submission
    String probeOrganismColumn = this.determinePlatformProbeOrganismColumn(platform);
    Collection<Taxon> platformTaxa = this.convertPlatformOrganisms(platform, probeOrganismColumn);
    // represent taxa for the probes
    List<String> probeOrganism = null;
    if (probeOrganismColumn != null) {
        GeoConverterImpl.log.debug("Organism details found for probes on array " + platform.getGeoAccession());
        probeOrganism = platform.getColumnData(probeOrganismColumn);
    }
    // The primary taxon for the array: either taxon listed on geo submission, or parent taxon listed on geo
    // submission or predominant probe taxon
    // calcualted using platformTaxa or probeOrganismColumn
    Taxon primaryTaxon = this.getPrimaryArrayTaxon(platformTaxa, probeOrganism);
    if (primaryTaxon == null) {
        throw new IllegalStateException("No taxon could be determined for platform: " + arrayDesign);
    }
    arrayDesign.setPrimaryTaxon(primaryTaxon);
    if (StringUtils.isNotBlank(platform.getManufacturer())) {
        Contact manufacturer = Contact.Factory.newInstance();
        manufacturer.setName(platform.getManufacturer());
        arrayDesign.setDesignProvider(manufacturer);
    }
    arrayDesign.getExternalReferences().add(this.convertDatabaseEntry(platform));
    seenPlatforms.put(platform.getGeoAccession(), arrayDesign);
    if (identifier == null) {
        // we don't get any probe information; e.g., MPSS, SAGE, Exon arrays.
        GeoConverterImpl.log.warn("No identifiers, so platform elements will be skipped");
        return arrayDesign;
    }
    this.convertPlatformElements(identifier, platform, arrayDesign, externalReferences, probeOrganismColumn, externalDb, descriptions, sequences, probeOrganism, primaryTaxon);
    return arrayDesign;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Taxon(ubic.gemma.model.genome.Taxon) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) Contact(ubic.gemma.model.common.auditAndSecurity.Contact)

Example 5 with Contact

use of ubic.gemma.model.common.auditAndSecurity.Contact in project Gemma by PavlidisLab.

the class ContactDaoImpl method find.

@Override
public Contact find(Contact contact) {
    BusinessKey.checkKey(contact);
    Criteria queryObject = this.getSessionFactory().getCurrentSession().createCriteria(Contact.class);
    BusinessKey.addRestrictions(queryObject, contact);
    List results = queryObject.list();
    Object result = null;
    if (results != null) {
        if (results.size() > 1) {
            throw new InvalidDataAccessResourceUsageException("More than one instance of '" + Contact.class.getName() + "' was found when executing query; query was " + contact + ", query object was " + queryObject);
        } else if (results.size() == 1) {
            result = results.iterator().next();
        }
    }
    return (Contact) result;
}
Also used : InvalidDataAccessResourceUsageException(org.springframework.dao.InvalidDataAccessResourceUsageException) List(java.util.List) Criteria(org.hibernate.Criteria) Contact(ubic.gemma.model.common.auditAndSecurity.Contact)

Aggregations

Contact (ubic.gemma.model.common.auditAndSecurity.Contact)5 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)2 Taxon (ubic.gemma.model.genome.Taxon)2 List (java.util.List)1 Criteria (org.hibernate.Criteria)1 Before (org.junit.Before)1 InvalidDataAccessResourceUsageException (org.springframework.dao.InvalidDataAccessResourceUsageException)1 DatabaseEntry (ubic.gemma.model.common.description.DatabaseEntry)1 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)1