private static String moiAbbreviation(ModeOfInheritance modeOfInheritance) { String moiAbbreviation = modeOfInheritance.getAbbreviation(); return moiAbbreviation == null ? "" : "_" + moiAbbreviation; }
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)); } }
public boolean isDominant() { return toModeOfInheritance().isDominant(); }
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 Analysis buildAnalysis(Path vcfPath, Path pedPath, String proband, List<String> phenotypes, String geneticInterval, Float minimumQuality, Boolean removeDbSnp, Boolean keepOffTarget, Boolean keepNonPathogenic, String modeOfInheritance, String frequency, Set<String> genesToKeep, String prioritiser) { AnalysisBuilder analysisBuilder = exomiser.getAnalysisBuilder() .analysisMode(AnalysisMode.PASS_ONLY) .genomeAssembly(GenomeAssembly.HG19) .vcfPath(vcfPath) .pedigree((pedPath == null) ? Pedigree.empty() : PedFiles.readPedigree(pedPath)) .probandSampleName(proband) .hpoIds(phenotypes) .inheritanceModes((modeOfInheritance.equalsIgnoreCase("ANY"))? InheritanceModeOptions.defaults() : InheritanceModeOptions.defaultForModes(ModeOfInheritance.valueOf(modeOfInheritance))) .frequencySources(FrequencySource.ALL_EXTERNAL_FREQ_SOURCES) .pathogenicitySources(EnumSet.of(PathogenicitySource.MUTATION_TASTER, PathogenicitySource.SIFT, PathogenicitySource.POLYPHEN)); addFilters(analysisBuilder, minimumQuality, removeDbSnp, keepOffTarget, keepNonPathogenic, frequency, genesToKeep, geneticInterval); //soon these will run by default analysisBuilder.addInheritanceFilter(); analysisBuilder.addOmimPrioritiser(); //add the users choice of prioritiser addPrioritiser(analysisBuilder, prioritiser); return analysisBuilder.build(); }
public boolean isRecessive() { return toModeOfInheritance().isRecessive(); }
private FilterReport makeInheritanceFilterReport(InheritanceFilter filter, List<Gene> genes) { FilterReport report = makeDefaultGeneFilterReport(FilterType.INHERITANCE_FILTER, genes); StringJoiner stringJoiner = new StringJoiner(","); filter.getCompatibleModes().forEach(modeOfInheritance -> stringJoiner.add(modeOfInheritance.toString())); report.addMessage(String.format("Genes filtered for compatibility with %s inheritance.", stringJoiner.toString())); return report; }
/** * 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(); }
@Override public String writeString(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { //Add prettyPrintJson option to outputSettings? ObjectWriter objectWriter = new ObjectMapper().writerWithDefaultPrettyPrinter(); try (Writer stringWriter = new StringWriter()) { writeData(modeOfInheritance, analysisResults, settings.outputContributingVariantsOnly(), objectWriter, stringWriter); stringWriter.flush(); logger.info("{} {} results written to string", OUTPUT_FORMAT, (modeOfInheritance.getAbbreviation() == null) ? "ALL" : modeOfInheritance .getAbbreviation()); return stringWriter.toString(); } catch (IOException ex) { logger.error("Unable to write results to json.", ex); } return ""; }
@Override public void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { String outFileName = ResultsWriterUtils.makeOutputFilename(analysis.getVcfPath(), settings.getOutputPrefix(), OUTPUT_FORMAT, modeOfInheritance); Path outFile = Paths.get(outFileName); ObjectWriter objectWriter = new ObjectMapper().writer(); try (Writer bufferedWriter = Files.newBufferedWriter(outFile, StandardCharsets.UTF_8)) { writeData(modeOfInheritance, analysisResults, settings.outputContributingVariantsOnly(), objectWriter, bufferedWriter); } catch (IOException ex) { logger.error("Unable to write results to file {}", outFileName, ex); } logger.info("{} {} results written to file {}", OUTPUT_FORMAT, (modeOfInheritance.getAbbreviation() == null) ? "ALL" : modeOfInheritance .getAbbreviation(), outFileName); }
@Override public void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { String outFileName = ResultsWriterUtils.makeOutputFilename(analysis.getVcfPath(), settings.getOutputPrefix(), OUTPUT_FORMAT, modeOfInheritance); Path outFile = Paths.get(outFileName); try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(outFile, StandardCharsets.UTF_8), format)) { writeData(modeOfInheritance, analysisResults, printer); } catch (IOException ex) { logger.error("Unable to write results to file {}", outFileName, ex); } logger.info("{} {} results written to file {}", OUTPUT_FORMAT, modeOfInheritance.getAbbreviation(), outFileName); }
@Override public void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { String outFileName = ResultsWriterUtils.makeOutputFilename(analysis.getVcfPath(), settings.getOutputPrefix(), OUTPUT_FORMAT, modeOfInheritance); Path outFile = Paths.get(outFileName); try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(outFile, StandardCharsets.UTF_8), format)) { writeData(modeOfInheritance, analysis, analysisResults, settings.outputContributingVariantsOnly(), printer); } catch (IOException ex) { logger.error("Unable to write results to file {}", outFileName, ex); } logger.info("{} {} results written to file {}", OUTPUT_FORMAT, modeOfInheritance.getAbbreviation(), outFileName); }
@Override public void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { // create a VariantContextWriter writing to the output file path String outFileName = ResultsWriterUtils.makeOutputFilename(analysis.getVcfPath(), settings.getOutputPrefix(), OUTPUT_FORMAT, modeOfInheritance); Path outFile = Paths.get(outFileName); VCFHeader vcfHeader = getVcfHeader(analysis); try (VariantContextWriter writer = VariantContextWriterConstructionHelper.openVariantContextWriter( vcfHeader, outFile.toString(), getAdditionalHeaderLines(), false)) { writeData(modeOfInheritance, analysisResults, settings.outputContributingVariantsOnly(), writer); } logger.info("{} {} results written to file {}.", OUTPUT_FORMAT, modeOfInheritance.getAbbreviation(), outFileName); }
modes.addAll(var.getCompatibleModes().stream().map(m -> m.toModeOfInheritance().getAbbreviation()) .filter(m -> m != null).collect(Collectors.toList())); ArrayList<String> arSubModes = new ArrayList<>();