本文整理汇总了Java中gov.nih.nci.caarray.domain.project.Experiment.getSamples方法的典型用法代码示例。如果您正苦于以下问题:Java Experiment.getSamples方法的具体用法?Java Experiment.getSamples怎么用?Java Experiment.getSamples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nih.nci.caarray.domain.project.Experiment
的用法示例。
在下文中一共展示了Experiment.getSamples方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTranslateValid_Feature13141
import gov.nih.nci.caarray.domain.project.Experiment; //导入方法依赖的package包/类
@Test
public void testTranslateValid_Feature13141() throws Exception {
final CaArrayFileSet fileSet = TestMageTabSets.getFileSet(TestMageTabSets.VALID_FEATURE_13141_INPUT_SET);
final MageTabDocumentSet docSet = MageTabParser.INSTANCE.parse(TestMageTabSets.VALID_FEATURE_13141_INPUT_SET);
final ValidationResult vResult = this.translator.validate(docSet, fileSet);
assertTrue(vResult.getMessages().isEmpty());
final CaArrayTranslationResult tResult = this.translator.translate(docSet, fileSet);
assertEquals(1, tResult.getInvestigations().size());
final Experiment e = tResult.getInvestigations().iterator().next();
assertEquals(6, e.getSamples().size());
for (final Sample s : e.getSamples()) {
assertNotNull(s.getExternalId());
}
boolean wasFound = false;
for (final Source source : e.getSources()) {
if (!(StringUtils.isEmpty(source.getDescription()))) {
assertEquals(2000, source.getDescription().length());
wasFound = true;
}
}
assertTrue("the 2000 char source description was not found.", wasFound);
final Set<Publication> publicationsSet = e.getPublications();
assertEquals(1, publicationsSet.size());
final Publication publication = publicationsSet.iterator().next();
assertEquals(2000, publication.getAuthors().length());
}
示例2: testTranslateInvalid_Feature13141
import gov.nih.nci.caarray.domain.project.Experiment; //导入方法依赖的package包/类
@Test
public void testTranslateInvalid_Feature13141() throws Exception {
final CaArrayFileSet fileSet = TestMageTabSets.getFileSet(TestMageTabSets.INVALID_FEATURE_13141_INPUT_SET);
final MageTabDocumentSet docSet = MageTabParser.INSTANCE.parse(TestMageTabSets.INVALID_FEATURE_13141_INPUT_SET);
final ValidationResult vResult = this.translator.validate(docSet, fileSet);
assertFalse(vResult.getMessages().isEmpty());
assertEquals(3, vResult.getMessages(ValidationMessage.Type.WARNING).size());
final String string = "[ExternalSampleId] value '%s"
+ "' is referenced multiple times (ExternalSampleId must be unique). "
+ "Existing value will be reused.";
assertEquals(String.format(string, "345"), vResult.getMessages(ValidationMessage.Type.WARNING).get(0)
.getMessage());
assertEquals(String.format(string, "234"), vResult.getMessages(ValidationMessage.Type.WARNING).get(1)
.getMessage());
assertEquals(String.format(string, "123"), vResult.getMessages(ValidationMessage.Type.WARNING).get(2)
.getMessage());
final CaArrayTranslationResult result = this.translator.translate(docSet, fileSet);
assertEquals(1, result.getInvestigations().size());
final Experiment e = result.getInvestigations().iterator().next();
assertEquals(6, e.getSamples().size());
for (final Sample s : e.getSamples()) {
assertNotNull(s.getExternalId());
}
}
示例3: getAllHybridizationsForSamples
import gov.nih.nci.caarray.domain.project.Experiment; //导入方法依赖的package包/类
private Set<Hybridization> getAllHybridizationsForSamples(CaArraySearchService service,
Experiment experiment, List<String> specimenList) {
Set<Hybridization> allHybridizations = new HashSet<Hybridization>();
Set<Sample> allSamples = experiment.getSamples();
//Sample->Extract->LabeledExtract->Hybridization->RawArrayData or DerivedArrayData.
for (Sample sample : allSamples) {
for (String specimenName : specimenList) {
if (sample != null && sample.getName() != null
&& sample.getName().contains(specimenName.trim())) {
Sample populatedSample = service.search(sample).get(0);
System.out.println("Sample Name: "+populatedSample.getName());
Set<Extract> allExtracts = populatedSample.getExtracts();
for(Extract extract:allExtracts){
Extract populatedExtract = service.search(extract).get(0);
Set<LabeledExtract> allLabeledExtracts = populatedExtract.getLabeledExtracts();
for(LabeledExtract labeledExtract:allLabeledExtracts){
LabeledExtract populatedLabeledExtract = service.search(labeledExtract).get(0);
allHybridizations.addAll(populatedLabeledExtract.getHybridizations());
}
}
}
}
}
return allHybridizations;
}
示例4: createExperimentWithBiomaterialCharacteristics
import gov.nih.nci.caarray.domain.project.Experiment; //导入方法依赖的package包/类
private Experiment createExperimentWithBiomaterialCharacteristics() {
// Create an experiment with biomaterials.
Experiment experiment = createExperimentWithOneToOneChains();
// Create ontology categories for the predefined characteristics.
Set<ExperimentOntologyCategory> allOntologyCategories = new HashSet<ExperimentOntologyCategory>();
allOntologyCategories.add(ExperimentOntologyCategory.MATERIAL_TYPE);
allOntologyCategories.add(ExperimentOntologyCategory.CELL_TYPE);
allOntologyCategories.add(ExperimentOntologyCategory.DISEASE_STATE);
allOntologyCategories.add(ExperimentOntologyCategory.ORGANISM_PART);
Set<ExperimentOntologyCategory> oneOntologyCategory = new HashSet<ExperimentOntologyCategory>();
oneOntologyCategory.add(ExperimentOntologyCategory.DISEASE_STATE);
// Add Source provider and predefined characteristics.
Organization provider = new Organization();
provider.setName(PROVIDER_ORGANIZATION);
for (Source source : experiment.getSources()) {
source.getProviders().add(provider);
addPredefinedCharacteristics(source, allOntologyCategories);
source.setExternalId(TEST_EXTERNAL_ID);
}
// Add Sample predefined characteristics and special characteristics with a term source.
for (Sample sample : experiment.getSamples()) {
addPredefinedCharacteristics(sample, oneOntologyCategory);
addSpecialCharacteristics(sample, true);
addMeasurementCharacteristic(sample);
}
// Leave Extracts with no characteristics.
// Add LabeledExtract label and special characteristics without a term source.
Term label = new Term();
label.setValue(LABEL_VALUE);
Category category = new Category();
category.setName(MageTabOntologyCategory.LABEL_COMPOUND.getCategoryName());
label.setCategory(category);
for (LabeledExtract labeledExtract : experiment.getLabeledExtracts()) {
labeledExtract.setLabel(label);
addSpecialCharacteristics(labeledExtract, false);
}
return experiment;
}