本文整理汇总了Java中com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java HpoDiseaseAnnotation类的具体用法?Java HpoDiseaseAnnotation怎么用?Java HpoDiseaseAnnotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HpoDiseaseAnnotation类属于com.github.phenomics.ontolib.formats.hpo包,在下文中一共展示了HpoDiseaseAnnotation类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParseHpoDiseaseAnnotationHead
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
@Test
public void testParseHpoDiseaseAnnotationHead()
throws IOException, TermAnnotationParserException {
final HpoDiseaseAnnotationParser parser =
new HpoDiseaseAnnotationParser(hpoDiseaseAnnotationHeadFile);
// Read and check first record.
final HpoDiseaseAnnotation firstRecord = parser.next();
assertEquals(
"HPODiseaseAnnotation [db=DECIPHER, dbObjectId=1, dbName=Wolf-Hirschhorn Syndrome, qualifier=, hpoId=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000252], dbReference=DECIPHER:1, evidenceDescription=IEA, onsetModifier=, frequencyModifier=, with=, aspect=O, synonym=WOLF-HIRSCHHORN SYNDROME, date=Wed May 29 00:00:00 UTC 2013, assignedBy=HPO:skoehler]",
firstRecord.toString());
// Read remaining records and check count.
int count = 1;
while (parser.hasNext()) {
parser.next();
count += 1;
}
assertEquals(10, count);
parser.close();
}
示例2: testParseHpoDiseaseAnnotationHead
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
@Test
public void testParseHpoDiseaseAnnotationHead()
throws IOException, TermAnnotationParserException {
final HpoDiseaseAnnotationParser parser =
new HpoDiseaseAnnotationParser(hpoDiseaseAnnotationHeadFile);
// Read and check first record.
final HpoDiseaseAnnotation firstRecord = parser.next();
assertEquals(
"HPODiseaseAnnotation [db=OMIM, dbObjectId=101000, dbName=#101000 NEUROFIBROMATOSIS, TYPE II; NF2;;NEUROFIBROMATOSIS, CENTRAL TYPE;;ACOUSTIC SCHWANNOMAS, BILATERAL;;BILATERAL ACOUSTIC NEUROFIBROMATOSIS; BANF;;ACOUSTIC NEURINOMA, BILATERAL; ACN, qualifier=NOT, hpoId=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0009737], dbReference=OMIM:101000, evidenceDescription=IEA, onsetModifier=, frequencyModifier=, with=, aspect=O, synonym=, date=Fri Jun 18 00:00:00 UTC 2010, assignedBy=HPO:skoehler]",
firstRecord.toString());
// Read remaining records and check count.
int count = 1;
while (parser.hasNext()) {
parser.next();
count += 1;
}
assertEquals(10, count);
parser.close();
}
示例3: checkFirstLine
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* Perform basic checks on the first line of the file.
*
* @throws TermAnnotationParserException In case of problems with the first line in the file.
*/
private void checkFirstLine() throws TermAnnotationParserException {
final String[] arr = nextLine.split("\t");
if (arr.length != 14) {
throw new TermAnnotationParserException(
"Does not look like HPO disease annotation file. Invalid number of fields in first "
+ "line, expected 14, was " + arr.length);
}
if (!Enums.getIfPresent(HpoDiseaseAnnotation.DatabaseSource.class, arr[0]).isPresent()) {
throw new TermAnnotationParserException(
"Does not look like HPO disease annotation file. First field value was " + arr[0]
+ " but was expected to be one of "
+ Arrays.toString(HpoDiseaseAnnotation.DatabaseSource.values()));
}
}
示例4: next
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
@Override
public HpoDiseaseAnnotation next() throws TermAnnotationParserException, IOException {
final String[] arr = nextLine.split("\t");
if (arr.length != 14) {
throw new TermAnnotationParserException(
"Does not look like HPO disease annotation file. Invalid number of fields, expected "
+ "14 but was " + arr.length);
}
final String db = arr[0];
final String dbObjectId = arr[1];
final String dbName = arr[2];
final String qualifier = arr[3];
final ImmutableTermId hpoId = ImmutableTermId.constructWithPrefix(arr[4]);
final String dbReference = arr[5];
final String evidenceCode = arr[6];
final String onsetModifier = arr[7];
final String frequencyModifier = arr[8];
final String with = arr[9];
final String aspect = arr[10];
final String synonym = arr[11];
final String dateStr = arr[12];
final String assignedBy = arr[13];
nextLine = reader.readLine();
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date;
try {
date = format.parse(dateStr);
} catch (ParseException e) {
throw new TermAnnotationParserException(
"There was a problem parsing the date value " + dateStr, e);
}
return new HpoDiseaseAnnotation(db, dbObjectId, dbName, qualifier, hpoId, dbReference,
evidenceCode, onsetModifier, frequencyModifier, with, aspect, synonym, date, assignedBy);
}
示例5: processAnnotation
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* Add a new {@link HpoDiseaseAnnotation} object with advanced logic.
*
* <p>
* All the other functions for adding and setting are relatively "dumb" and directly work on the
* members.
* </p>
*
* <p>
* In contrast, this function does a more advanced processing and can be used to fill a
* {@link AnnotatedDiseaseBuilder} step by step from a list of positive and negative annotations.
* It will ensure that only one annotation for each HPO {@link TermId} is created and set the
* disease ID and name.
* </p>
*
* @param anno The {@link HpoDiseaseAnnotation} to process.
*/
public void processAnnotation(HpoDiseaseAnnotation anno) {
if (diseaseId == null) {
setDiseaseId(new DiseaseId(DiseaseDatabase.valueOf(anno.getDb()), anno.getDbObjectId()));
} else {
if (!diseaseId
.equals(new DiseaseId(DiseaseDatabase.valueOf(anno.getDb()), anno.getDbObjectId()))) {
throw new IllegalArgumentException("HpoDiseaseAnnotation has conflicting disease ID "
+ anno.getDbReference() + " vs. " + diseaseId);
}
}
if (name == null) {
setName(anno.getDbName());
} else {
if (!name.equals(anno.getDbName())) {
throw new IllegalArgumentException("HpoDiseaseAnnotation has conflicting disease name "
+ anno.getDbName() + " vs. " + name);
}
}
// TODO: what about alternative names?!
// TODO: what about handling of "references" as Sebastian's code does?
if ("NOT".equals(anno.getQualifier())) {
negativeAnnotations.add(anno);
} else {
positiveAnnotations.add(anno);
}
}
示例6: next
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
@Override
public HpoDiseaseAnnotation next() throws TermAnnotationParserException, IOException {
final String[] arr = nextLine.split("\t");
if (arr.length != 14) {
throw new TermAnnotationParserException(
"Does not look like HPO disease annotation file. Invalid number of fields, expected "
+ "14 but was " + arr.length);
}
final String db = arr[0];
final String dbObjectId = arr[1];
final String dbName = arr[2];
final String qualifier = arr[3];
final ImmutableTermId hpoId = ImmutableTermId.constructWithPrefix(arr[4]);
final String dbReference = arr[5];
final String evidenceCode = arr[6];
final String onsetModifier = arr[7];
final String frequencyModifier = arr[8];
final String with = arr[9];
final String aspect = arr[10];
final String synonym = arr[11];
final String dateStr = arr[12];
final String assignedBy = arr[13];
nextLine = reader.readLine();
final ImmutableList<String> formatStrings = ImmutableList.of("yyyy.MM.dd", "yyyy-MM-dd");
Date date = null;
for (String formatString : formatStrings) {
final SimpleDateFormat format = new SimpleDateFormat(formatString);
try {
date = format.parse(dateStr);
break;
} catch (ParseException e) {
continue; // swallow
}
}
if (date == null) {
throw new TermAnnotationParserException(
"There was a problem parsing the date value " + dateStr);
}
return new HpoDiseaseAnnotation(db, dbObjectId, dbName, qualifier, hpoId, dbReference,
evidenceCode, onsetModifier, frequencyModifier, with, aspect, synonym, date, assignedBy);
}
示例7: getPositiveAnnotations
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* @return Positive disease annotations.
*/
public ImmutableList<HpoDiseaseAnnotation> getPositiveAnnotations() {
return positiveAnnotations;
}
示例8: getNegativeAnnotations
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* @return Negative disease annotations.
*/
public ImmutableList<HpoDiseaseAnnotation> getNegativeAnnotations() {
return negativeAnnotations;
}
示例9: AnnotatedDisease
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* Constructor.
*
* <p>
* The alternative disease names will be sorted on construction.
* </p>
*
* @param diseaseId The disease ID.
* @param name The name of the disease.
* @param alternativeNames Alternative disease names.
* @param positiveAnnotations Positive disease annotations.
* @param negativeAnnotations Negative disease annotations.
*/
public AnnotatedDisease(DiseaseId diseaseId, String name, Collection<String> alternativeNames,
Collection<HpoDiseaseAnnotation> positiveAnnotations,
Collection<HpoDiseaseAnnotation> negativeAnnotations) {
this.diseaseId = diseaseId;
this.name = name;
this.alternativeNames = ImmutableList.sortedCopyOf(alternativeNames);
this.positiveAnnotations = ImmutableList.copyOf(positiveAnnotations);
this.negativeAnnotations = ImmutableList.copyOf(negativeAnnotations);
}
示例10: addPositiveAnnotation
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* Add positive disease annotation.
*
* @param anno The {@link HpoDiseaseAnnotation} to add.
*/
public void addPositiveAnnotation(HpoDiseaseAnnotation anno) {
this.positiveAnnotations.add(anno);
}
示例11: addNegativeAnnotation
import com.github.phenomics.ontolib.formats.hpo.HpoDiseaseAnnotation; //导入依赖的package包/类
/**
* Add positive disease annotation.
*
* @param anno The {@link HpoDiseaseAnnotation} to add.
*/
public void addNegativeAnnotation(HpoDiseaseAnnotation anno) {
this.negativeAnnotations.add(anno);
}