Utility function Collection<Genotype> -> Collection<String>

This commit is contained in:
Mark DePristo 2011-11-20 18:26:56 -05:00
parent 9445326c6c
commit bc44f6fd9e
1 changed files with 7 additions and 0 deletions

View File

@ -1065,4 +1065,11 @@ public class VariantContextUtils {
public static final GenomeLoc getLocation(GenomeLocParser genomeLocParser,VariantContext vc) {
return genomeLocParser.createGenomeLoc(vc.getChr(), vc.getStart(), vc.getEnd(), true);
}
public static final Set<String> genotypeNames(final Collection<Genotype> genotypes) {
final Set<String> names = new HashSet<String>(genotypes.size());
for ( final Genotype g : genotypes )
names.add(g.getSampleName());
return names;
}
}