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();
}
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;
}
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);
}
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;
}
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);
}
Aggregations