use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4jTest method createStudyWithDifferentExternalId.
@Test
public void createStudyWithDifferentExternalId() throws NodeFactoryException {
StudyImpl study1 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study1.setExternalId("foo:bar");
StudyNode study1Created = getNodeFactory().getOrCreateStudy(study1);
StudyImpl study2 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study2.setExternalId("foo:baz");
StudyNode study2Created = getNodeFactory().getOrCreateStudy(study2);
assertThat(study1Created.getExternalId(), is("foo:bar"));
assertThat(study2Created.getExternalId(), is("foo:baz"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4jTest method createStudyWithDifferentExternalIdInSameNamespace.
@Test
public void createStudyWithDifferentExternalIdInSameNamespace() throws NodeFactoryException {
StudyImpl study1 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study1.setOriginatingDataset(new DatasetImpl("name/space", URI.create("foo:bar"), is -> is));
study1.setExternalId("foo:bar");
StudyNode study1Created = getNodeFactory().getOrCreateStudy(study1);
StudyImpl study2 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study2.setOriginatingDataset(new DatasetImpl("name/space", URI.create("foo:bar"), is -> is));
study2.setExternalId("foo:baz");
StudyNode study2Created = getNodeFactory().getOrCreateStudy(study2);
assertThat(study1Created.getExternalId(), is("foo:bar"));
assertThat(study2Created.getExternalId(), is("foo:baz"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4jTest method createStudyWithMatchingExternalIdDifferentTitle.
@Test
public void createStudyWithMatchingExternalIdDifferentTitle() throws NodeFactoryException {
StudyImpl study1 = new StudyImpl("myTitle", new DOI("myDoi", "123"), null);
study1.setExternalId("foo:bar");
StudyNode study1Created = getNodeFactory().getOrCreateStudy(study1);
StudyImpl study2 = new StudyImpl("myTitlez", new DOI("myDoi", "123"), null);
study2.setExternalId("foo:bar");
StudyNode study2Created = getNodeFactory().getOrCreateStudy(study2);
assertThat(study1Created.getExternalId(), is("foo:bar"));
assertThat(study1Created.getTitle(), is("myTitle"));
assertThat(study2Created.getExternalId(), is("foo:bar"));
assertThat(study2Created.getTitle(), is("myTitle"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DatasetImporterForGemina method importStudy.
@Override
public void importStudy() throws StudyImporterException {
URI studyResource = URI.create("gemina_search_2008-01-03.txt");
try {
String source = "Schriml, L. M., Arze, C., Nadendla, S., Ganapathy, A., Felix, V., Mahurkar, A., … Hall, N. (2009). GeMInA, Genomic Metadata for Infectious Agents, a geospatial surveillance pathogen database. Nucleic Acids Research, 38(Database), D754–D764. doi:10.1093/nar/gkp832";
Study study = getNodeFactory().getOrCreateStudy(new StudyImpl(source, new DOI("1093", "nar/gkp832"), source));
LabeledCSVParser parser = getParserFactory().createParser(studyResource, "UTF-8");
parser.changeDelimiter('\t');
String[] line;
while ((line = parser.getLine()) != null) {
if (line.length > 7) {
String pathogenId = parser.getValueByLabel("Pathogen Taxonomy");
String pathogenExternalId = StringUtils.isBlank(pathogenId) ? null : TaxonomyProvider.NCBI.getIdPrefix() + pathogenId;
Specimen pathogen = getNodeFactory().createSpecimen(study, new TaxonImpl(parser.getValueByLabel("Pathogen"), pathogenExternalId));
String hostId = line[7];
String hostReservoirExternalId = StringUtils.isBlank(hostId) ? null : TaxonomyProvider.NCBI.getIdPrefix() + hostId;
Specimen host = getNodeFactory().createSpecimen(study, new TaxonImpl(parser.getValueByLabel("Host/Reservoir"), hostReservoirExternalId));
pathogen.interactsWith(host, InteractType.PATHOGEN_OF);
}
}
} catch (IOException | NodeFactoryException e) {
throw new StudyImporterException("failed to import [" + studyResource + "]", e);
}
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DatasetImporterForJRFerrerParis method importStudy.
@Override
public void importStudy() throws StudyImporterException {
String citation = "Ferrer-Paris, José R.; Sánchez-Mercado, Ada Y.; Lozano, Cecilia; Zambrano, Liset; Soto, José; Baettig, Jessica; Leal, María (2014): A compilation of larval host-plant records for six families of butterflies (Lepidoptera: Papilionoidea) from available electronic resources. figshare. https://doi.org/10.6084/m9.figshare.1168861 . " + CitationUtil.createLastAccessedString(RESOURCE.toString());
Study study = getNodeFactory().getOrCreateStudy(new StudyImpl("Ferrer-Paris 2014", new DOI("6084", "m9.figshare.1168861"), citation));
try {
LabeledCSVParser parser = getParserFactory().createParser(RESOURCE, CharsetConstant.UTF8);
while (parser.getLine() != null) {
String butterflyName = createTaxon(parser, "Lepidoptera Name");
String plantName = createTaxon(parser, "Hostplant Name");
if (validNames(butterflyName, plantName, study, parser.lastLineNumber())) {
addAssociation(study, parser, butterflyName, plantName);
}
}
} catch (IOException e) {
throw new StudyImporterException("failed to access resource [" + RESOURCE + "]");
}
}
Aggregations