private Map<ModeOfInheritance, Double> calculateScoresForModes(Gene gene, List<Disease> knownAssociatedDiseases) { EnumMap<ModeOfInheritance, Double> scoresForModes = new EnumMap<>(ModeOfInheritance.class); for (ModeOfInheritance modeOfInheritance : ModeOfInheritance.values()) { if (modeOfInheritance != ModeOfInheritance.ANY) { double score = calculateknownDiseaseInheritanceModeModifier(gene, modeOfInheritance, knownAssociatedDiseases); scoresForModes.put(modeOfInheritance, score); } } return scoresForModes; }
private ModeOfInheritance parseValueOfInheritanceMode(String value) { try { return ModeOfInheritance.valueOf(value); } catch (IllegalArgumentException e) { List<ModeOfInheritance> permitted = Arrays.stream(ModeOfInheritance.values()) .collect(toList()); throw new AnalysisParserException(String.format("'%s' is not a valid mode of inheritance. Use one of: %s", value, permitted)); } }
/** * Perform checking for compatible mode of inheritance * * @param calls * {@link Collection} of {@link GenotypeCalls} objects to perform the mode of inheritance check for in * case of non-recessive mode of inheritance * @param recessiveCalls * {@link Collection} of {@link GenotypeCalls} objects to perform the mode of * inheritance check for in case of recessive mode of inheritance * @return {@link Map} that, for each {@link ModeOfInheritance}, contains the {@link Collection} of compatible * {@link GenotypeCalls} from <code>list</code> * @throws IncompatiblePedigreeException * if the individuals in <code>calls</code> do not fit to the pedigree */ public ImmutableMap<ModeOfInheritance, ImmutableList<GenotypeCalls>> checkMendelianInheritance( Collection<GenotypeCalls> calls, Collection<GenotypeCalls> recessiveCalls) throws IncompatiblePedigreeException { ImmutableMap.Builder<ModeOfInheritance, ImmutableList<GenotypeCalls>> builder = new ImmutableMap.Builder<>(); for (ModeOfInheritance mode : ModeOfInheritance.values()) { if (mode == ModeOfInheritance.ANY) { builder.put(mode, ImmutableList.copyOf(calls)); } else { if (mode == ModeOfInheritance.AUTOSOMAL_RECESSIVE || mode == ModeOfInheritance.X_RECESSIVE) { builder.put(mode, filterCompatibleRecords(recessiveCalls, mode)); } else { builder.put(mode, filterCompatibleRecords(calls, mode)); } } } return builder.build(); }