use of org.molgenis.genotype.GenotypeDataException in project molgenis by molgenis.
the class VcfToEntity method vcfReaderFormatToMolgenisType.
private static AttributeType vcfReaderFormatToMolgenisType(VcfMetaInfo vcfMetaInfo) {
String number = vcfMetaInfo.getNumber();
boolean isListValue;
try {
isListValue = number.equals("A") || number.equals("R") || number.equals("G") || number.equals(".") || Integer.parseInt(number) > 1;
} catch (NumberFormatException ex) {
throw new GenotypeDataException("Error parsing length of vcf info field. " + number + " is not a valid int or expected preset (A, R, G, .)", ex);
}
switch(vcfMetaInfo.getType()) {
case CHARACTER:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return STRING;
case FLAG:
return BOOL;
case FLOAT:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return DECIMAL;
case INTEGER:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return INT;
case STRING:
if (isListValue) {
// TODO support list of primitives datatype
return TEXT;
}
return TEXT;
default:
throw new UnexpectedEnumException(vcfMetaInfo.getType());
}
}
use of org.molgenis.genotype.GenotypeDataException in project molgenis by molgenis.
the class VcfToEntity method vcfFieldTypeToMolgenisFieldType.
private static AttributeType vcfFieldTypeToMolgenisFieldType(VcfMetaFormat format) {
String number = format.getNumber();
boolean isListValue;
try {
isListValue = number.equals("A") || number.equals("R") || number.equals("G") || number.equals(".") || Integer.parseInt(number) > 1;
} catch (NumberFormatException ex) {
throw new GenotypeDataException("Error parsing length of vcf info field. " + number + " is not a valid int or expected preset (A, R, G, .)", ex);
}
switch(format.getType()) {
case CHARACTER:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return STRING;
case FLOAT:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return DECIMAL;
case INTEGER:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return INT;
case STRING:
if (isListValue) {
// TODO support list of primitives datatype
return STRING;
}
return STRING;
default:
throw new UnexpectedEnumException(format.getType());
}
}
Aggregations