Cleanup of codec locations. No more dbSNPHelper
-- refdata/features now in utils/codecs with the other codecs -- Deleted dbsnpHelper. rsID function now in VCFutils. Remaining code either deleted or put into VariantContextAdaptors -- Many associated import updates due to code move
This commit is contained in:
parent
9c17d54cb6
commit
c2287c93d7
|
|
@ -1,10 +1,11 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata;
|
package org.broadinstitute.sting.gatk.refdata;
|
||||||
|
|
||||||
|
import net.sf.samtools.util.SequenceUtil;
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
|
import org.broad.tribble.annotation.Strand;
|
||||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
import org.broad.tribble.dbsnp.DbSNPFeature;
|
||||||
import org.broad.tribble.gelitext.GeliTextFeature;
|
import org.broad.tribble.gelitext.GeliTextFeature;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.DbSNPHelper;
|
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.codecs.hapmap.RawHapMapFeature;
|
import org.broadinstitute.sting.utils.codecs.hapmap.RawHapMapFeature;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
|
||||||
|
|
@ -92,6 +93,67 @@ public class VariantContextAdaptors {
|
||||||
// --------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
private static class DBSnpAdaptor implements VCAdaptor {
|
private static class DBSnpAdaptor implements VCAdaptor {
|
||||||
|
private static boolean isSNP(DbSNPFeature feature) {
|
||||||
|
return feature.getVariantType().contains("single") && feature.getLocationType().contains("exact");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isMNP(DbSNPFeature feature) {
|
||||||
|
return feature.getVariantType().contains("mnp") && feature.getLocationType().contains("range");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isInsertion(DbSNPFeature feature) {
|
||||||
|
return feature.getVariantType().contains("insertion");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isDeletion(DbSNPFeature feature) {
|
||||||
|
return feature.getVariantType().contains("deletion");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isIndel(DbSNPFeature feature) {
|
||||||
|
return isInsertion(feature) || isDeletion(feature) || isComplexIndel(feature);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isComplexIndel(DbSNPFeature feature) {
|
||||||
|
return feature.getVariantType().contains("in-del");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the alternate alleles. This method should return all the alleles present at the location,
|
||||||
|
* NOT including the reference base. This is returned as a string list with no guarantee ordering
|
||||||
|
* of alleles (i.e. the first alternate allele is not always going to be the allele with the greatest
|
||||||
|
* frequency).
|
||||||
|
*
|
||||||
|
* @return an alternate allele list
|
||||||
|
*/
|
||||||
|
public static List<String> getAlternateAlleleList(DbSNPFeature feature) {
|
||||||
|
List<String> ret = new ArrayList<String>();
|
||||||
|
for (String allele : getAlleleList(feature))
|
||||||
|
if (!allele.equals(String.valueOf(feature.getNCBIRefBase()))) ret.add(allele);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the alleles. This method should return all the alleles present at the location,
|
||||||
|
* including the reference base. The first allele should always be the reference allele, followed
|
||||||
|
* by an unordered list of alternate alleles.
|
||||||
|
*
|
||||||
|
* @return an alternate allele list
|
||||||
|
*/
|
||||||
|
public static List<String> getAlleleList(DbSNPFeature feature) {
|
||||||
|
List<String> alleleList = new ArrayList<String>();
|
||||||
|
// add ref first
|
||||||
|
if ( feature.getStrand() == Strand.POSITIVE )
|
||||||
|
alleleList = Arrays.asList(feature.getObserved());
|
||||||
|
else
|
||||||
|
for (String str : feature.getObserved())
|
||||||
|
alleleList.add(SequenceUtil.reverseComplement(str));
|
||||||
|
if ( alleleList.size() > 0 && alleleList.contains(feature.getNCBIRefBase())
|
||||||
|
&& !alleleList.get(0).equals(feature.getNCBIRefBase()) )
|
||||||
|
Collections.swap(alleleList, alleleList.indexOf(feature.getNCBIRefBase()), 0);
|
||||||
|
|
||||||
|
return alleleList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts non-VCF formatted dbSNP records to VariantContext.
|
* Converts non-VCF formatted dbSNP records to VariantContext.
|
||||||
* @return DbSNPFeature.
|
* @return DbSNPFeature.
|
||||||
|
|
@ -102,18 +164,18 @@ public class VariantContextAdaptors {
|
||||||
@Override
|
@Override
|
||||||
public VariantContext convert(String name, Object input, ReferenceContext ref) {
|
public VariantContext convert(String name, Object input, ReferenceContext ref) {
|
||||||
DbSNPFeature dbsnp = (DbSNPFeature)input;
|
DbSNPFeature dbsnp = (DbSNPFeature)input;
|
||||||
if ( ! Allele.acceptableAlleleBases(DbSNPHelper.getReference(dbsnp)) )
|
if ( ! Allele.acceptableAlleleBases(dbsnp.getNCBIRefBase()) )
|
||||||
return null;
|
return null;
|
||||||
Allele refAllele = Allele.create(DbSNPHelper.getReference(dbsnp), true);
|
Allele refAllele = Allele.create(dbsnp.getNCBIRefBase(), true);
|
||||||
|
|
||||||
if ( DbSNPHelper.isSNP(dbsnp) || DbSNPHelper.isIndel(dbsnp) || DbSNPHelper.isMNP(dbsnp) || dbsnp.getVariantType().contains("mixed") ) {
|
if ( isSNP(dbsnp) || isIndel(dbsnp) || isMNP(dbsnp) || dbsnp.getVariantType().contains("mixed") ) {
|
||||||
// add the reference allele
|
// add the reference allele
|
||||||
List<Allele> alleles = new ArrayList<Allele>();
|
List<Allele> alleles = new ArrayList<Allele>();
|
||||||
alleles.add(refAllele);
|
alleles.add(refAllele);
|
||||||
|
|
||||||
// add all of the alt alleles
|
// add all of the alt alleles
|
||||||
boolean sawNullAllele = refAllele.isNull();
|
boolean sawNullAllele = refAllele.isNull();
|
||||||
for ( String alt : DbSNPHelper.getAlternateAlleleList(dbsnp) ) {
|
for ( String alt : getAlternateAlleleList(dbsnp) ) {
|
||||||
if ( ! Allele.acceptableAlleleBases(alt) ) {
|
if ( ! Allele.acceptableAlleleBases(alt) ) {
|
||||||
//System.out.printf("Excluding dbsnp record %s%n", dbsnp);
|
//System.out.printf("Excluding dbsnp record %s%n", dbsnp);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -1,169 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2011, 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.refdata.features;
|
|
||||||
|
|
||||||
import net.sf.samtools.util.SequenceUtil;
|
|
||||||
import org.broad.tribble.annotation.Strand;
|
|
||||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this class contains static helper methods for DbSNP
|
|
||||||
*/
|
|
||||||
public class DbSNPHelper {
|
|
||||||
|
|
||||||
private DbSNPHelper() {} // don't make a DbSNPHelper
|
|
||||||
|
|
||||||
public static String rsIDOfFirstRealVariant(List<VariantContext> VCs, VariantContext.Type type) {
|
|
||||||
if ( VCs == null )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
String rsID = null;
|
|
||||||
for ( VariantContext vc : VCs ) {
|
|
||||||
if ( vc.getType() == type ) {
|
|
||||||
rsID = vc.getID();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rsID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the -1 * (log 10 of the error value)
|
|
||||||
*
|
|
||||||
* @return the log based error estimate
|
|
||||||
*/
|
|
||||||
public static double getNegLog10PError(DbSNPFeature feature) {
|
|
||||||
return 4; // -log10(0.0001)
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// What kind of variant are we?
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
public static boolean isSNP(DbSNPFeature feature) {
|
|
||||||
return feature.getVariantType().contains("single") && feature.getLocationType().contains("exact");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isMNP(DbSNPFeature feature) {
|
|
||||||
return feature.getVariantType().contains("mnp") && feature.getLocationType().contains("range");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toMediumString(DbSNPFeature feature) {
|
|
||||||
String s = String.format("%s:%d:%s:%s", feature.getChr(), feature.getStart(), feature.getRsID(), Utils.join("",feature.getObserved()));
|
|
||||||
if (isSNP(feature)) s += ":SNP";
|
|
||||||
if (isIndel(feature)) s += ":Indel";
|
|
||||||
if (isHapmap(feature)) s += ":Hapmap";
|
|
||||||
if (is2Hit2Allele(feature)) s += ":2Hit";
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInsertion(DbSNPFeature feature) {
|
|
||||||
return feature.getVariantType().contains("insertion");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isDeletion(DbSNPFeature feature) {
|
|
||||||
return feature.getVariantType().contains("deletion");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isIndel(DbSNPFeature feature) {
|
|
||||||
return DbSNPHelper.isInsertion(feature) || DbSNPHelper.isDeletion(feature) || DbSNPHelper.isComplexIndel(feature);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isComplexIndel(DbSNPFeature feature) {
|
|
||||||
return feature.getVariantType().contains("in-del");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isHapmap(DbSNPFeature feature) {
|
|
||||||
return feature.getValidationStatus().contains("by-hapmap");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean is2Hit2Allele(DbSNPFeature feature) {
|
|
||||||
return feature.getValidationStatus().contains("by-2hit-2allele");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean is1000genomes(DbSNPFeature feature) {
|
|
||||||
return feature.getValidationStatus().contains("by-1000genomes");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isMQ1(DbSNPFeature feature) {
|
|
||||||
return feature.getWeight() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the alternate alleles. This method should return all the alleles present at the location,
|
|
||||||
* NOT including the reference base. This is returned as a string list with no guarantee ordering
|
|
||||||
* of alleles (i.e. the first alternate allele is not always going to be the allele with the greatest
|
|
||||||
* frequency).
|
|
||||||
*
|
|
||||||
* @return an alternate allele list
|
|
||||||
*/
|
|
||||||
public static List<String> getAlternateAlleleList(DbSNPFeature feature) {
|
|
||||||
List<String> ret = new ArrayList<String>();
|
|
||||||
for (String allele : getAlleleList(feature))
|
|
||||||
if (!allele.equals(String.valueOf(feature.getNCBIRefBase()))) ret.add(allele);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean onFwdStrand(DbSNPFeature feature) {
|
|
||||||
return feature.getStrand() == Strand.POSITIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getReference(DbSNPFeature feature) {
|
|
||||||
return feature.getNCBIRefBase();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toSimpleString(DbSNPFeature feature) {
|
|
||||||
return String.format("%s:%s:%s", feature.getRsID(), feature.getObserved(), (feature.getStrand() == Strand.POSITIVE) ? "+" : "-");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the alleles. This method should return all the alleles present at the location,
|
|
||||||
* including the reference base. The first allele should always be the reference allele, followed
|
|
||||||
* by an unordered list of alternate alleles.
|
|
||||||
*
|
|
||||||
* @return an alternate allele list
|
|
||||||
*/
|
|
||||||
public static List<String> getAlleleList(DbSNPFeature feature) {
|
|
||||||
List<String> alleleList = new ArrayList<String>();
|
|
||||||
// add ref first
|
|
||||||
if ( onFwdStrand(feature) )
|
|
||||||
alleleList = Arrays.asList(feature.getObserved());
|
|
||||||
else
|
|
||||||
for (String str : feature.getObserved())
|
|
||||||
alleleList.add(SequenceUtil.reverseComplement(str));
|
|
||||||
if ( alleleList.size() > 0 && alleleList.contains(getReference(feature)) && !alleleList.get(0).equals(getReference(feature)) )
|
|
||||||
Collections.swap(alleleList, alleleList.indexOf(getReference(feature)), 0);
|
|
||||||
|
|
||||||
return alleleList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
package org.broadinstitute.sting.gatk.walkers;
|
package org.broadinstitute.sting.gatk.walkers;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
|
||||||
import org.broadinstitute.sting.commandline.Argument;
|
import org.broadinstitute.sting.commandline.Argument;
|
||||||
import org.broadinstitute.sting.commandline.Input;
|
import org.broadinstitute.sting.commandline.Input;
|
||||||
import org.broadinstitute.sting.commandline.Output;
|
import org.broadinstitute.sting.commandline.Output;
|
||||||
|
|
@ -34,9 +33,6 @@ import org.broadinstitute.sting.commandline.RodBinding;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.DbSNPHelper;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,11 @@ import org.broadinstitute.sting.commandline.RodBinding;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.DbSNPHelper;
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotationInterfaceManager;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotationInterfaceManager;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
|
||||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
|
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
|
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
|
|
@ -158,7 +154,7 @@ public class VariantAnnotatorEngine {
|
||||||
private void annotateDBs(RefMetaDataTracker tracker, ReferenceContext ref, VariantContext vc, Map<String, Object> infoAnnotations) {
|
private void annotateDBs(RefMetaDataTracker tracker, ReferenceContext ref, VariantContext vc, Map<String, Object> infoAnnotations) {
|
||||||
for ( Map.Entry<RodBinding<VariantContext>, String> dbSet : dbAnnotations.entrySet() ) {
|
for ( Map.Entry<RodBinding<VariantContext>, String> dbSet : dbAnnotations.entrySet() ) {
|
||||||
if ( dbSet.getValue().equals(VCFConstants.DBSNP_KEY) ) {
|
if ( dbSet.getValue().equals(VCFConstants.DBSNP_KEY) ) {
|
||||||
String rsID = DbSNPHelper.rsIDOfFirstRealVariant(tracker.getValues(dbSet.getKey(), ref.getLocus()), vc.getType());
|
String rsID = VCFUtils.rsIDOfFirstRealVariant(tracker.getValues(dbSet.getKey(), ref.getLocus()), vc.getType());
|
||||||
infoAnnotations.put(VCFConstants.DBSNP_KEY, rsID != null);
|
infoAnnotations.put(VCFConstants.DBSNP_KEY, rsID != null);
|
||||||
// annotate dbsnp id if available and not already there
|
// annotate dbsnp id if available and not already there
|
||||||
if ( rsID != null && (!vc.hasID() || vc.getID().equals(VCFConstants.EMPTY_ID_FIELD)) )
|
if ( rsID != null && (!vc.hasID() || vc.getID().equals(VCFConstants.EMPTY_ID_FIELD)) )
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
|
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.beagle.BeagleFeature;
|
import org.broadinstitute.sting.utils.codecs.beagle.BeagleFeature;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.SampleUtils;
|
import org.broadinstitute.sting.utils.SampleUtils;
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.SeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.SeekableRODIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqCodec;
|
import org.broadinstitute.sting.utils.codecs.refseq.RefSeqCodec;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
|
import org.broadinstitute.sting.utils.codecs.refseq.RefSeqFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ import org.broadinstitute.sting.gatk.filters.PlatformUnitFilter;
|
||||||
import org.broadinstitute.sting.gatk.filters.PlatformUnitFilterHelper;
|
import org.broadinstitute.sting.gatk.filters.PlatformUnitFilterHelper;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.SeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.SeekableRODIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.Transcript;
|
import org.broadinstitute.sting.utils.codecs.refseq.Transcript;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqCodec;
|
import org.broadinstitute.sting.utils.codecs.refseq.RefSeqCodec;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
|
import org.broadinstitute.sting.utils.codecs.refseq.RefSeqFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import org.broadinstitute.sting.commandline.RodBinding;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.sampileup.SAMPileupFeature;
|
import org.broadinstitute.sting.utils.codecs.sampileup.SAMPileupFeature;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,8 @@ import org.broadinstitute.sting.commandline.RodBinding;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
|
import org.broadinstitute.sting.utils.codecs.table.TableFeature;
|
||||||
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RMD;
|
|
||||||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
|
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.DbSNPHelper;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
|
|
@ -120,7 +119,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
|
||||||
if ( tracker == null || !BaseUtils.isRegularBase(ref.getBase()) )
|
if ( tracker == null || !BaseUtils.isRegularBase(ref.getBase()) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
String rsID = dbsnp == null ? null : DbSNPHelper.rsIDOfFirstRealVariant(tracker.getValues(dbsnp.dbsnp, context.getLocation()), VariantContext.Type.SNP);
|
String rsID = dbsnp == null ? null : VCFUtils.rsIDOfFirstRealVariant(tracker.getValues(dbsnp.dbsnp, context.getLocation()), VariantContext.Type.SNP);
|
||||||
|
|
||||||
Collection<VariantContext> contexts = getVariantContexts(tracker, ref);
|
Collection<VariantContext> contexts = getVariantContexts(tracker, ref);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.beagle;
|
package org.broadinstitute.sting.utils.codecs.beagle;
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 The Broad Institute
|
* Copyright (c) 2010 The Broad Institute
|
||||||
*
|
*
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.beagle;
|
package org.broadinstitute.sting.utils.codecs.beagle;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.refseq;
|
package org.broadinstitute.sting.utils.codecs.refseq;
|
||||||
|
|
||||||
import org.apache.commons.io.filefilter.FalseFileFilter;
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broad.tribble.TribbleException;
|
import org.broad.tribble.TribbleException;
|
||||||
import org.broad.tribble.readers.LineReader;
|
import org.broad.tribble.readers.LineReader;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.refseq;
|
package org.broadinstitute.sting.utils.codecs.refseq;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.refseq;
|
package org.broadinstitute.sting.utils.codecs.refseq;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.HasGenomeLocation;
|
import org.broadinstitute.sting.utils.HasGenomeLocation;
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.sampileup;
|
package org.broadinstitute.sting.utils.codecs.sampileup;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broad.tribble.FeatureCodec;
|
import org.broad.tribble.FeatureCodec;
|
||||||
|
|
@ -35,7 +35,7 @@ import java.util.ArrayList;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static org.broadinstitute.sting.gatk.refdata.features.sampileup.SAMPileupFeature.VariantType;
|
import static org.broadinstitute.sting.utils.codecs.sampileup.SAMPileupFeature.VariantType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Tribble encoder / decoder for SAM pileup data.
|
* A Tribble encoder / decoder for SAM pileup data.
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.sampileup;
|
package org.broadinstitute.sting.utils.codecs.sampileup;
|
||||||
|
|
||||||
import net.sf.samtools.util.StringUtil;
|
import net.sf.samtools.util.StringUtil;
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.samread;
|
package org.broadinstitute.sting.utils.codecs.samread;
|
||||||
|
|
||||||
import net.sf.samtools.Cigar;
|
import net.sf.samtools.Cigar;
|
||||||
import net.sf.samtools.TextCigarCodec;
|
import net.sf.samtools.TextCigarCodec;
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.samread;
|
package org.broadinstitute.sting.utils.codecs.samread;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.table;
|
package org.broadinstitute.sting.utils.codecs.table;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReferenceDependentFeatureCodec;
|
import org.broadinstitute.sting.gatk.refdata.ReferenceDependentFeatureCodec;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.table;
|
package org.broadinstitute.sting.utils.codecs.table;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broad.tribble.readers.LineReader;
|
import org.broad.tribble.readers.LineReader;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.broadinstitute.sting.gatk.refdata.features.table;
|
package org.broadinstitute.sting.utils.codecs.table;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
@ -180,4 +180,19 @@ public class VCFUtils {
|
||||||
|
|
||||||
return new HashSet<VCFHeaderLine>(map.values());
|
return new HashSet<VCFHeaderLine>(map.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String rsIDOfFirstRealVariant(List<VariantContext> VCs, VariantContext.Type type) {
|
||||||
|
if ( VCs == null )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String rsID = null;
|
||||||
|
for ( VariantContext vc : VCs ) {
|
||||||
|
if ( vc.getType() == type ) {
|
||||||
|
rsID = vc.getID();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rsID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.beagle.BeagleFeature;
|
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
|
@ -35,7 +34,6 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import javax.script.Bindings;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.testng.Assert;
|
||||||
import org.broadinstitute.sting.BaseTest;
|
import org.broadinstitute.sting.BaseTest;
|
||||||
import org.broadinstitute.sting.gatk.datasources.reads.Shard;
|
import org.broadinstitute.sting.gatk.datasources.reads.Shard;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
|
import org.broadinstitute.sting.utils.codecs.table.TableFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet.RMDStorageType;
|
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet.RMDStorageType;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
|
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import org.broadinstitute.sting.commandline.Tags;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.broadinstitute.sting.BaseTest;
|
import org.broadinstitute.sting.BaseTest;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
|
import org.broadinstitute.sting.utils.codecs.table.TableFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
|
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet.RMDStorageType;
|
import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet.RMDStorageType;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.broadinstitute.sting.BaseTest;
|
||||||
import org.broadinstitute.sting.commandline.RodBinding;
|
import org.broadinstitute.sting.commandline.RodBinding;
|
||||||
import org.broadinstitute.sting.commandline.Tags;
|
import org.broadinstitute.sting.commandline.Tags;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
|
import org.broadinstitute.sting.utils.codecs.table.TableFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import org.broad.tribble.Feature;
|
import org.broad.tribble.Feature;
|
||||||
import org.broad.tribble.FeatureCodec;
|
import org.broad.tribble.FeatureCodec;
|
||||||
import org.broadinstitute.sting.BaseTest;
|
import org.broadinstitute.sting.BaseTest;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.table.BedTableCodec;
|
import org.broadinstitute.sting.utils.codecs.table.BedTableCodec;
|
||||||
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
|
import org.broadinstitute.sting.utils.codecs.table.TableFeature;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCF3Codec;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCF3Codec;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue