Merged common VCF writing logic into phasing/WriteVCF.java

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4776 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
fromer 2010-12-02 22:03:02 +00:00
parent 4e62de4213
commit 1515bf6de9
5 changed files with 48 additions and 40 deletions

View File

@ -305,16 +305,7 @@ public class AnnotateMNPsWalker extends RodWalker<Integer, Integer> {
}
private void writeVCF(VariantContext vc) {
byte refBase;
if (!vc.isIndel()) {
Allele varAllele = vc.getReference();
refBase = SNPallelePair.getSingleBase(varAllele);
}
else {
refBase = vc.getReferenceBaseForIndel();
}
writer.add(vc, refBase);
WriteVCF.writeVCF(vc, writer, logger);
}
/*

View File

@ -111,16 +111,7 @@ public class MergeMNPsWalker extends RodWalker<Integer, Integer> {
}
private void writeVCF(VariantContext vc) {
byte refBase;
if (!vc.isIndel()) {
Allele varAllele = vc.getReference();
refBase = SNPallelePair.getSingleBase(varAllele);
}
else {
refBase = vc.getReferenceBaseForIndel();
}
vcMergerWriter.add(vc, refBase);
WriteVCF.writeVCF(vc, vcMergerWriter, logger);
}
public Integer reduce(Integer result, Integer total) {

View File

@ -146,16 +146,7 @@ public class MergeSegregatingAlternateAllelesWalker extends RodWalker<Integer, I
}
private void writeVCF(VariantContext vc) {
byte refBase;
if (!vc.isIndel()) {
Allele varAllele = vc.getReference();
refBase = SNPallelePair.getSingleBase(varAllele);
}
else {
refBase = vc.getReferenceBaseForIndel();
}
vcMergerWriter.add(vc, refBase);
WriteVCF.writeVCF(vc, vcMergerWriter, logger);
}
public Integer reduce(Integer result, Integer total) {

View File

@ -980,16 +980,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
}
private void writeVCF(VariantContext vc) {
byte refBase;
if (!vc.isIndel()) {
Allele varAllele = vc.getReference();
refBase = SNPallelePair.getSingleBase(varAllele);
}
else {
refBase = vc.getReferenceBaseForIndel();
}
writer.add(vc, refBase);
WriteVCF.writeVCF(vc, writer, logger);
}
public static boolean processVariantInPhasing(VariantContext vc) {

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2010, The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.gatk.walkers.phasing;
import org.apache.log4j.Logger;
import org.broad.tribble.util.variantcontext.Allele;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.VCFWriter;
public class WriteVCF {
public static void writeVCF(VariantContext vc, VCFWriter writer, Logger logger) {
byte refBase;
if (!vc.isIndel()) {
Allele refAllele = vc.getReference();
refBase = SNPallelePair.getSingleBase(refAllele);
}
else {
refBase = vc.getReferenceBaseForIndel();
}
writer.add(vc, refBase);
}
}