functions for setting gentoype records and alternate bases; function for getting all rods implementing VCF

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2611 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-01-16 20:19:43 +00:00
parent d2961a3a17
commit 41392f8ff5
2 changed files with 25 additions and 1 deletions

View File

@ -283,7 +283,7 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
}
public VARIANT_TYPE getType() {
if ( !hasAlternateAllele() )
if ( ! hasAlternateAllele() )
return VARIANT_TYPE.REFERENCE;
VCFGenotypeEncoding.TYPE type = mAlts.get(0).getType();
@ -479,6 +479,12 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
mGenotypeRecords.add(mGenotypeRecord);
}
public void setGenotypeRecords(List<VCFGenotypeRecord> records) {
mGenotypeRecords.clear();
for ( VCFGenotypeRecord g : records )
addGenotypeRecord(g);
}
/**
* add an alternate base to our alternate base list. All bases are uppercased
* before being added to the list.
@ -489,6 +495,12 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
if (!mAlts.contains(base)) mAlts.add(base);
}
public void setAlternateBases(List<VCFGenotypeEncoding> bases) {
mAlts.clear();
for ( VCFGenotypeEncoding e : bases )
addAlternateBase(e);
}
/**
* add an info field to the record
*

View File

@ -19,6 +19,18 @@ public class VCFUtils {
*/
private VCFUtils() { }
public static Set<ReferenceOrderedData> getRodVCFs(GenomeAnalysisEngine toolkit) {
Set<ReferenceOrderedData> vcfs = new HashSet<ReferenceOrderedData>();
for ( ReferenceOrderedDataSource source : toolkit.getRodDataSources() ) {
ReferenceOrderedData rod = source.getReferenceOrderedData();
if ( rod.getType().equals(RodVCF.class) ) {
vcfs.add(rod);
}
}
return vcfs;
}
/**
* Gets the header fields from all VCF rods input by the user