Skip to content

Commit

Permalink
Merge pull request #50 from molgenis/fix/removeBloodrelCheck
Browse files Browse the repository at this point in the history
Remove blood relative check because it is broken
  • Loading branch information
dennishendriksen authored Apr 2, 2024
2 parents 0212380 + 291db82 commit d3364c9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 64 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.molgenis</groupId>
<artifactId>vip-inheritance-matcher</artifactId>
<version>3.0.2</version>
<version>3.1.0</version>

<name>vip-inheritance-matcher</name>
<description>Annotates VCF samples with mendelian violation and possible compound flags and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ private Inheritance calculateInheritanceForFamily(
Map<String, List<VariantContext>> geneVariantMap,
VariantContext variantContext, Pedigree family,
Sample sample) {
Pedigree filteredFamily = InheritanceUtils.filterBloodRelatives(family, sample);
return pedigreeInheritanceChecker.calculatePedigreeInheritance(geneVariantMap, variantContext, sample, filteredFamily, arCompoundChecker);
return pedigreeInheritanceChecker.calculatePedigreeInheritance(geneVariantMap, variantContext, sample, family, arCompoundChecker);
}

private static VCFFileReader createReader(Path vcfPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@

import htsjdk.variant.variantcontext.Allele;
import htsjdk.variant.variantcontext.Genotype;
import org.molgenis.vcf.utils.sample.model.Pedigree;
import org.molgenis.vcf.utils.sample.model.Person;
import org.molgenis.vcf.utils.sample.model.Sample;

import java.util.HashMap;
import java.util.Map;

public class InheritanceUtils {
private InheritanceUtils() {
}

public static Pedigree filterBloodRelatives(Pedigree family, Sample sample) {
Map<String, Sample> filteredFamily = new HashMap<>();
filteredFamily.put(sample.getPerson().getIndividualId(), sample);
addParents(family, sample, filteredFamily);
addChildren(sample, family, filteredFamily);
return Pedigree.builder().id(family.getId()).members(filteredFamily).build();
}

public static boolean hasParents(Sample sample) {
return !(sample.getPerson().getMaternalId().isEmpty() || sample.getPerson().getMaternalId().equals("0")) &&
!(sample.getPerson().getPaternalId().isEmpty() || sample.getPerson().getPaternalId().equals("0"));
Expand All @@ -41,30 +28,4 @@ public static boolean isHomAlt(Genotype genotype) {
public static boolean isAlt(Allele allele) {
return allele.isCalled() && allele.isNonReference();
}


private static void addChildren(Sample proband, Pedigree family, Map<String, Sample> filteredFamily) {
for (Sample sample : family.getMembers().values()) {
Person person = sample.getPerson();
Person probandPerson = proband.getPerson();
if (person.getPaternalId().equals(probandPerson.getPaternalId()) && person.getMaternalId().equals(probandPerson.getMaternalId())
|| filteredFamily.containsKey(person.getPaternalId()) && filteredFamily.containsKey(person.getMaternalId())) {
filteredFamily.put(person.getIndividualId(), sample);
}
}
}

private static void addParents(Pedigree family, Sample sample, Map<String, Sample> sampleMap) {
Person person = sample.getPerson();
Sample father = family.getMembers().get(person.getPaternalId());
Sample mother = family.getMembers().get(person.getMaternalId());
if (father != null) {
sampleMap.put(father.getPerson().getIndividualId(), father);
addParents(family, father, sampleMap);
}
if (mother != null) {
sampleMap.put(mother.getPerson().getIndividualId(), mother);
addParents(family, mother, sampleMap);
}
}
}

This file was deleted.

0 comments on commit d3364c9

Please sign in to comment.