Search in sources :

Example 16 with GeneValueObject

use of ubic.gemma.model.genome.gene.GeneValueObject in project Gemma by PavlidisLab.

the class GeneController method format4File.

private String format4File(Collection<GeneValueObject> genes, String geneSetName) {
    StringBuilder strBuff = new StringBuilder();
    strBuff.append("# Generated by Gemma\n# ").append(new Date()).append("\n");
    strBuff.append(ExpressionDataFileService.DISCLAIMER + "#\n");
    if (geneSetName != null && geneSetName.length() != 0)
        strBuff.append("# Gene Set: ").append(geneSetName).append("\n");
    strBuff.append("# ").append(genes.size()).append((genes.size() > 1) ? " genes" : " gene").append("\n");
    // add header
    strBuff.append("Gene Symbol\tGene Name\tNCBI ID\n");
    for (GeneValueObject gene : genes) {
        strBuff.append(gene.getOfficialSymbol()).append("\t").append(gene.getOfficialName()).append("\t").append(gene.getNcbiId());
        strBuff.append("\n");
    }
    return strBuff.toString();
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject)

Example 17 with GeneValueObject

use of ubic.gemma.model.genome.gene.GeneValueObject in project Gemma by PavlidisLab.

the class GenePickerController method searchGenesWithNCBIId.

/**
 * AJAX (used by Phenocarta)
 *
 * @param query   query
 * @param taxonId taxon id
 * @return Collection of Gene entity objects
 */
public Collection<GeneValueObject> searchGenesWithNCBIId(String query, Long taxonId) {
    Collection<GeneValueObject> geneValueObjects = this.geneCoreService.searchGenes(query, taxonId);
    Collection<GeneValueObject> geneValueObjectWithNCBIId = new HashSet<>();
    for (GeneValueObject geneValueObject : geneValueObjects) {
        if (geneValueObject.getNcbiId() != null) {
            geneValueObjectWithNCBIId.add(geneValueObject);
        }
    }
    return geneValueObjectWithNCBIId;
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject)

Example 18 with GeneValueObject

use of ubic.gemma.model.genome.gene.GeneValueObject in project Gemma by PavlidisLab.

the class PhenotypeAssociationTest method testFindGenesWithPhenotype.

@Test
public void testFindGenesWithPhenotype() {
    OntologyTerm term = os.getDiseaseOntologyService().getTerm("http://purl.obolibrary.org/obo/DOID_2531");
    assertNotNull(term);
    this.createLiteratureEvidence(this.geneNCBI, "http://purl.obolibrary.org/obo/DOID_2531");
    Map<GeneValueObject, OntologyTerm> r = this.phenotypeAssociationManagerService.findGenesForPhenotype(term.getUri(), this.humanTaxon.getId(), true);
    assertTrue(r.size() > 0);
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject) OntologyTerm(ubic.basecode.ontology.model.OntologyTerm) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 19 with GeneValueObject

use of ubic.gemma.model.genome.gene.GeneValueObject in project Gemma by PavlidisLab.

the class GeneDaoImpl method loadValueObjectsPreFilter.

@Override
public Collection<GeneValueObject> loadValueObjectsPreFilter(int offset, int limit, String orderBy, boolean asc, ArrayList<ObjectFilter[]> filter) {
    Query query = this.getLoadValueObjectsQueryString(filter, orderBy, !asc);
    query.setCacheable(true);
    if (limit > 0)
        query.setMaxResults(limit);
    query.setFirstResult(offset);
    // noinspection unchecked
    List<Object[]> list = query.list();
    List<GeneValueObject> vos = new ArrayList<>(list.size());
    for (Object[] row : list) {
        Gene g = (Gene) row[1];
        g.setTaxon((Taxon) row[2]);
        GeneValueObject vo = new GeneValueObject(g);
        vos.add(vo);
    }
    return vos;
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject) Query(org.hibernate.Query) Gene(ubic.gemma.model.genome.Gene) GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject)

Example 20 with GeneValueObject

use of ubic.gemma.model.genome.gene.GeneValueObject in project Gemma by PavlidisLab.

the class HomologeneServiceImpl method getHomologueValueObject.

@Override
public GeneValueObject getHomologueValueObject(Long geneId, String taxonCommonName) {
    Gene gene = geneService.load(geneId);
    final Taxon taxon = this.taxonService.findByCommonName(taxonCommonName);
    Gene geneToReturn;
    if (Objects.equals(gene.getTaxon().getId(), taxon.getId())) {
        geneToReturn = gene;
    } else {
        geneToReturn = this.getHomologue(gene, taxon);
    }
    return geneToReturn == null ? null : new GeneValueObject(geneToReturn);
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject) Gene(ubic.gemma.model.genome.Gene) Taxon(ubic.gemma.model.genome.Taxon)

Aggregations

GeneValueObject (ubic.gemma.model.genome.gene.GeneValueObject)31 StopWatch (org.apache.commons.lang3.time.StopWatch)6 Gene (ubic.gemma.model.genome.Gene)6 Taxon (ubic.gemma.model.genome.Taxon)5 DoubleVectorValueObject (ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject)4 GeneSetValueObject (ubic.gemma.model.genome.gene.GeneSetValueObject)4 CharacteristicValueObject (ubic.gemma.model.genome.gene.phenotype.valueObject.CharacteristicValueObject)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 GeneProductValueObject (ubic.gemma.model.genome.gene.GeneProductValueObject)3 HashSet (java.util.HashSet)2 OntologyTerm (ubic.basecode.ontology.model.OntologyTerm)2 DifferentialExpressionValueObject (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject)2 BioAssayValueObject (ubic.gemma.model.expression.bioAssay.BioAssayValueObject)2 ExpressionExperimentValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject)2 EvidenceValueObject (ubic.gemma.model.genome.gene.phenotype.valueObject.EvidenceValueObject)2 CoexpressionValueObject (ubic.gemma.persistence.service.association.coexpression.CoexpressionValueObject)2 VisualizationValueObject (ubic.gemma.web.controller.visualization.VisualizationValueObject)2 ImageValueObject (ubic.gemma.web.image.aba.ImageValueObject)2 DoubleArrayList (cern.colt.list.DoubleArrayList)1