Skip to content

Commit

Permalink
models: Remove hgvs from Variant model. #179
Browse files Browse the repository at this point in the history
  • Loading branch information
j-coll committed Mar 20, 2020
1 parent c97f2bf commit 93591c2
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package org.opencb.biodata.formats.variant.annotation.io;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.MapperFeature;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.mortbay.util.ajax.JSON;
Expand All @@ -33,7 +31,7 @@
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

/**
* Created by fjlopez on 31/01/17.
Expand Down
Binary file modified biodata-formats/src/test/resources/variant-test.json.gz
Binary file not shown.
5 changes: 0 additions & 5 deletions biodata-models/src/main/avro/variant.avdl
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,6 @@ protocol Variants {
*/
VariantType type;

/**
* Unique identifier following the HGVS nomenclature.
*/
union { null, map<array<string>> } hgvs = null;

/**
* Information specific to each study the variant was read from, such as
* samples or statistics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Variant implements Serializable, Comparable<Variant> {
public static final int UNKNOWN_LENGTH = 0;

public Variant() {
impl = new VariantAvro(null, new LinkedList<>(), "", -1, -1, "", "", "+", null, 0, null, new HashMap<>(), new LinkedList<>(), null);
impl = new VariantAvro(null, new LinkedList<>(), "", -1, -1, "", "", "+", null, 0, null, new LinkedList<>(), null);
}

public Variant(VariantAvro avro) {
Expand Down Expand Up @@ -310,14 +310,6 @@ public Variant setType(VariantType value) {
return this;
}

public Map<String, List<String>> getHgvs() {
return impl.getHgvs();
}

public void setHgvs(Map<String, List<String>> value) {
impl.setHgvs(value);
}

public VariantAnnotation getAnnotation() {
return impl.getAnnotation();
}
Expand All @@ -326,18 +318,6 @@ public void setAnnotation(VariantAnnotation value) {
impl.setAnnotation(value);
}

public boolean addHgvs(String type, String value) {
List<String> listByType = getHgvs().get(type);
if (listByType == null) {
listByType = new LinkedList<>();
}
if (!listByType.contains(value)) {
return listByType.add(value);
} else {
return false; //Collection has not changed
}
}

public List<StudyEntry> getStudies() {
return getStudiesMap() == null ? null : Collections.unmodifiableList(new ArrayList<>(getStudiesMap().values()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,7 @@ protected static VariantAvro buildAvroVariant(String chromosome, int start, Inte
int length = VariantBuilder.inferLength(reference, alternate, start, end, type);
return new VariantAvro(null,
new ArrayList<>(),
chromosome, start, end, reference, alternate, "+", null, length, type,
new HashMap<>(), null, null);
chromosome, start, end, reference, alternate, "+", null, length, type, null, null);
}
}

Expand Down Expand Up @@ -1096,7 +1095,7 @@ public void inferSV() {
case CNV:
Integer copyNumber = getCopyNumberFromAlternate(alternates.get(0));
if (copyNumber == null) {
copyNumber = getCopyNumberFromFormat();
copyNumber = getCopyNumberFromSampleData();
}
if (copyNumber != null) {
sv.setCopyNumber(copyNumber);
Expand Down Expand Up @@ -1198,7 +1197,7 @@ public static Integer getCopyNumberFromAlternate(String alternate) {
}
}

public Integer getCopyNumberFromFormat() {
public Integer getCopyNumberFromSampleData() {
if (sampleDataKeys == null) {
return null;
}
Expand Down
8 changes: 0 additions & 8 deletions biodata-models/src/main/proto/protobuf/opencb/variant.proto
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,6 @@ message Variant {
*/
VariantType type = 9;

/**
* Unique identifier following the HGVS nomenclature.
*/
message HgvsEntry {
repeated string info = 1;
}
map<string, HgvsEntry> hgvss = 10;

/**
* Information specific to each study the variant was read from, such as
* samples or statistics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ private Variant _create(int numSamples, List<Region> regions) {
variant.setStrand(strand);
variant.setType(VariantType.valueOf(variantType));
variant.setAnnotation(null);
variant.setHgvs(null);
return variant;
}

Expand Down

0 comments on commit 93591c2

Please sign in to comment.