use of ubic.gemma.model.common.description.MedicalSubjectHeading in project Gemma by PavlidisLab.
the class PubMedXMLParserTest method testParseMesh.
@Test
public void testParseMesh() {
try {
testStream = PubMedXMLParserTest.class.getResourceAsStream("/data/pubmed-mesh-test.xml");
Collection<BibliographicReference> brl = testParser.parse(testStream);
BibliographicReference br = brl.iterator().next();
Collection<MedicalSubjectHeading> meshTerms = br.getMeshTerms();
assertEquals(16, meshTerms.size());
// for ( MedicalSubjectHeading heading : meshTerms ) {
// log.info( heading.getTerm() + " " + heading.getIsMajorTopic() );
// for ( MedicalSubjectHeading q : heading.getQualifiers() ) {
// log.info( " qualifier: " + q.getTerm() + " " + q.getIsMajorTopic() );
// }
// }
} catch (RuntimeException e) {
this.logOrThrowException(e);
}
}
use of ubic.gemma.model.common.description.MedicalSubjectHeading in project Gemma by PavlidisLab.
the class MeshTermFetcherCli method processChunk.
private void processChunk(PubMedXMLFetcher fetcher, Collection<Integer> ids) throws IOException {
Collection<BibliographicReference> refs = fetcher.retrieveByHTTP(ids);
for (BibliographicReference r : refs) {
System.out.print(r.getPubAccession().getAccession() + "\t");
Collection<MedicalSubjectHeading> meshTerms = r.getMeshTerms();
List<String> t = new ArrayList<>();
for (MedicalSubjectHeading mesh : meshTerms) {
String term = mesh.getTerm();
if (majorTopicsOnly && !mesh.getIsMajorTopic())
continue;
t.add(term);
}
Collections.sort(t);
System.out.print(StringUtils.join(t, "|"));
System.out.print("\n");
}
}
use of ubic.gemma.model.common.description.MedicalSubjectHeading in project Gemma by PavlidisLab.
the class LoadEvidenceForClassifier method findMeshTerms.
// return mesh term of a pubmed format : meshTerm1;meshTerm2;meshTerms3.... etc
private String findMeshTerms(String pubmed) {
StringBuilder result = new StringBuilder();
DatabaseEntry de = DatabaseEntry.Factory.newInstance();
de.setAccession(pubmed);
BibliographicReference bi = BibliographicReference.Factory.newInstance();
bi.setPubAccession(de);
System.out.println(pubmed);
BibliographicReference b = this.bibliographicReferenceService.find(bi);
for (MedicalSubjectHeading m : b.getMeshTerms()) {
result.append(m.getTerm()).append(";");
}
return result.toString();
}
Aggregations