Search in sources :

Example 1 with EffectBasedAnnotator

use of org.molgenis.data.annotation.core.EffectBasedAnnotator in project molgenis by molgenis.

the class CmdLineAnnotatorUtils method getOutputAttributeMetadatasForAnnotator.

private static List<Attribute> getOutputAttributeMetadatasForAnnotator(RepositoryAnnotator annotator, EntityTypeFactory entityTypeFactory, AttributeFactory attributeFactory, List<String> attributesToInclude, VcfRepository vcfRepo) {
    if (!attributesToInclude.isEmpty()) {
        checkSelectedOutputAttributeNames(annotator, attributesToInclude, vcfRepo);
    }
    // If the annotator e.g. SnpEff creates an external repository, collect the output metadata into an mref
    // entity
    // This allows for the header to be written as 'EFFECT annotations: <ouput_attributes> | <ouput_attributes>'
    List<Attribute> outputMetaData = newArrayList();
    if (annotator instanceof EffectCreatingAnnotator || annotator instanceof EffectBasedAnnotator) {
        EntityType effectRefEntity = entityTypeFactory.create(annotator.getSimpleName() + "_EFFECTS");
        for (Attribute outputAttribute : annotator.getOutputAttributes()) {
            effectRefEntity.addAttribute(outputAttribute);
        }
        Attribute effect = attributeFactory.create().setName(EFFECT);
        effect.setDataType(MREF).setRefEntity(effectRefEntity);
        outputMetaData.add(effect);
    } else {
        outputMetaData = annotator.getOutputAttributes();
    }
    return outputMetaData;
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) Attribute(org.molgenis.data.meta.model.Attribute) EffectCreatingAnnotator(org.molgenis.data.annotation.core.EffectCreatingAnnotator) EffectBasedAnnotator(org.molgenis.data.annotation.core.EffectBasedAnnotator)

Aggregations

EffectBasedAnnotator (org.molgenis.data.annotation.core.EffectBasedAnnotator)1 EffectCreatingAnnotator (org.molgenis.data.annotation.core.EffectCreatingAnnotator)1 Attribute (org.molgenis.data.meta.model.Attribute)1 EntityType (org.molgenis.data.meta.model.EntityType)1