From bca3d1b943cf5d8e9e77b3254ec874c0313d97cb Mon Sep 17 00:00:00 2001 From: depristo Date: Wed, 6 Jan 2010 14:53:56 +0000 Subject: [PATCH] useful convenience function to get a genotype associated with a particular sample git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2510 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/genotype/vcf/VCFRecord.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFRecord.java b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFRecord.java index 6650f99ea..d7c40451b 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFRecord.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFRecord.java @@ -417,6 +417,16 @@ public class VCFRecord implements Variation, VariantBackedByGenotype { return names; } + public VCFGenotypeRecord getGenotype(final String sampleName) { + for ( VCFGenotypeRecord rec : getVCFGenotypeRecords() ) { + if ( rec.getSampleName().equals(sampleName) ) { + return rec; + } + } + + return null; + } + public String getGenotypeFormatString() { return mGenotypeFormatString; }// the formatting string for our genotype records