public VariantBuilder setCopyNumber(int copyNumber) { initSv(); sv.setCopyNumber(copyNumber); sv.setType(getCNVSubtype(copyNumber)); return this; }
variant = new Variant(fields[CHR_COLUMN], Integer.valueOf(fields[START_COLUMN]), Integer.valueOf(fields[END_COLUMN]), UNKNOWN_NT, DUPLICATION_ALTERNATE_STR); structuralVariation.setType(StructuralVariantType.TANDEM_DUPLICATION); annotation = parseAnnotation(fields, variant); break; variant = new Variant(fields[CHR_COLUMN], Integer.valueOf(fields[START_COLUMN]), Integer.valueOf(fields[END_COLUMN]), UNKNOWN_NT, CNV_STR); structuralVariation.setType(StructuralVariantType.COPY_NUMBER_GAIN); annotation = parseAnnotation(fields, variant); break; variant = new Variant(fields[CHR_COLUMN], Integer.valueOf(fields[START_COLUMN]), Integer.valueOf(fields[END_COLUMN]), UNKNOWN_NT, CNV_STR); structuralVariation.setType(StructuralVariantType.COPY_NUMBER_LOSS); annotation = parseAnnotation(fields, variant); break;
public Variant buildVariant(String variantId, int end, String reference, String alternate) { String[] split = variantId.split(SEPARATOR, -1); String chr = split[CHR].trim(); int start = Integer.parseInt(split[POS].trim()); StructuralVariation sv = buildSv(split, reference, alternate); if (StringUtils.contains(alternate, INS_SEQ_SEPARATOR)) { String[] alternateSplit = StringUtils.splitPreserveAllTokens(alternate, INS_SEQ_SEPARATOR); alternate = alternateSplit[0]; if (sv == null) { sv = new StructuralVariation(); } sv.setLeftSvInsSeq(alternateSplit[1]); sv.setRightSvInsSeq(alternateSplit[2]); } Variant variant = new Variant(chr, start, end, reference, alternate); if (sv != null) { if (variant.getSv() != null && variant.getSv().getType() != null) { sv.setType(variant.getSv().getType()); } variant.setSv(sv); } return variant; }
@Deprecated public static StructuralVariation getStructuralVariation(Variant variant, StructuralVariantType tandemDuplication) { int[] impreciseStart = getImpreciseStart(variant); int[] impreciseEnd = getImpreciseEnd(variant); String[] svInsSeq = getSvInsSeq(variant); StructuralVariation sv = new StructuralVariation(); sv.setCiStartLeft(impreciseStart[0]); sv.setCiStartRight(impreciseStart[1]); sv.setCiEndLeft(impreciseEnd[0]); sv.setCiEndRight(impreciseEnd[1]); sv.setLeftSvInsSeq(svInsSeq[0]); sv.setRightSvInsSeq(svInsSeq[1]); // If it's not a tandem duplication, this will set the type to null sv.setType(tandemDuplication); // Will properly set the type if it's a CNV if (variant.getType().equals(VariantType.CNV)) { Integer copyNumber = getCopyNumberFromAlternate(variant.getAlternate()); if (copyNumber != null) { sv.setCopyNumber(copyNumber); sv.setType(getCNVSubtype(copyNumber)); } } return sv; }
sv.setType(StructuralVariantType.valueOf(type));
private Variant newVariant(Variant variant, VariantKeyFields keyFields, StructuralVariation sv) { Variant normalizedVariant = new Variant(variant.getChromosome(), keyFields.getStart(), keyFields.getEnd(), keyFields.getReference(), keyFields.getAlternate()) .setId(variant.getId()) .setNames(variant.getNames()) .setStrand(variant.getStrand()); if (sv != null) { if (normalizedVariant.getSv() != null) { // CI positions may change during the normalization. Update them. normalizedVariant.getSv().setCiStartLeft(sv.getCiStartLeft()); normalizedVariant.getSv().setCiStartRight(sv.getCiStartRight()); normalizedVariant.getSv().setCiEndLeft(sv.getCiEndLeft()); normalizedVariant.getSv().setCiEndRight(sv.getCiEndRight()); } else { normalizedVariant.setSv(sv); } // Variant will never have CopyNumber, because the Alternate is normalized from <CNxx> to <CNV> normalizedVariant.getSv().setCopyNumber(keyFields.getCopyNumber()); normalizedVariant.getSv().setType(VariantBuilder.getCNVSubtype(keyFields.getCopyNumber())); } return normalizedVariant; // normalizedVariant.setAnnotation(variant.getAnnotation()); // if (isSymbolic(variant)) { // StructuralVariation sv = getStructuralVariation(normalizedVariant, keyFields, null); // normalizedVariant.setSv(sv); // } }