Skip to content

Commit

Permalink
Update my code for GDB protobuf update
Browse files Browse the repository at this point in the history
  • Loading branch information
ldgauthier committed Aug 22, 2018
1 parent bdc4261 commit 5e3bf34
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public FeatureDataSource(final FeatureInput<T> featureInput, final int queryLook
* @param cloudPrefetchBuffer MB size of caching/prefetching wrapper for the data, if on Google Cloud (0 to disable).
* @param cloudIndexPrefetchBuffer MB size of caching/prefetching wrapper for the index, if on Google Cloud (0 to disable).
* @param reference Path to a reference. May be null. Needed only for reading from GenomicsDB.
* @param doGnarlyGenotyping indicates whether the GenomicsDB export configuration should be modified for the GnarlyGenotyper
*/
public FeatureDataSource(final FeatureInput<T> featureInput, final int queryLookaheadBases, final Class<? extends Feature> targetFeatureType,
final int cloudPrefetchBuffer, final int cloudIndexPrefetchBuffer, final Path reference, final boolean doGnarlyGenotyping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,18 @@ private void initializeFeatureSources( final int featureQueryLookahead, final Co
// Only create a data source for Feature arguments that were actually specified
if ( featureInput != null ) {
final Class<? extends Feature> featureType = getFeatureTypeForFeatureInputField(featureArgument.getKey());
addToFeatureSources(featureQueryLookahead, featureInput, featureType, cloudPrefetchBuffer, cloudIndexPrefetchBuffer, reference);
addToFeatureSources(featureQueryLookahead, featureInput, featureType, cloudPrefetchBuffer, cloudIndexPrefetchBuffer, reference, false);
}
}
}

void addToFeatureSources(final int featureQueryLookahead, final FeatureInput<? extends Feature> featureInput,
final Class<? extends Feature> featureType, final int cloudPrefetchBuffer,
final int cloudIndexPrefetchBuffer, final Path reference) {
// Create a new FeatureDataSource for this file, and add it to our query pool
featureSources.put(featureInput, new FeatureDataSource<>(featureInput, featureQueryLookahead, featureType, cloudPrefetchBuffer, cloudIndexPrefetchBuffer, reference, false));
}


/**
* Add the feature data source to the given feature input.
Expand All @@ -193,13 +200,16 @@ private void initializeFeatureSources( final int featureQueryLookahead, final Co
* @param featureType class of features
* @param cloudPrefetchBuffer MB size of caching/prefetching wrapper for the data, if on Google Cloud (0 to disable).
* @param cloudIndexPrefetchBuffer MB size of caching/prefetching wrapper for the index, if on Google Cloud (0 to disable).
* @param doGnarlyGenotyping indicates whether the GenomicsDB export configuration should be modified for the GnarlyGenotyper
*
* Note: package-visible to enable access from the core walker classes
* (but not actual tools, so it's not protected).
*/
void addToFeatureSources(final int featureQueryLookahead, final FeatureInput<? extends Feature> featureInput, final Class<? extends Feature> featureType, final int cloudPrefetchBuffer, final int cloudIndexPrefetchBuffer, final Path reference) {
void addToFeatureSources(final int featureQueryLookahead, final FeatureInput<? extends Feature> featureInput,
final Class<? extends Feature> featureType, final int cloudPrefetchBuffer,
final int cloudIndexPrefetchBuffer, final Path reference, final boolean doGnarlyGenotyping) {
// Create a new FeatureDataSource for this file, and add it to our query pool
featureSources.put(featureInput, new FeatureDataSource<>(featureInput, featureQueryLookahead, featureType, cloudPrefetchBuffer, cloudIndexPrefetchBuffer, reference));
featureSources.put(featureInput, new FeatureDataSource<>(featureInput, featureQueryLookahead, featureType, cloudPrefetchBuffer, cloudIndexPrefetchBuffer, reference, doGnarlyGenotyping));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void initializeDrivingVariants() {
//Add the driving datasource to the feature manager too so that it can be queried. Setting lookahead to 0 to avoid caching.
//Note: we are disabling lookahead here because of windowed queries that need to "look behind" as well.
features.addToFeatureSources(0, drivingVariantsFeatureInput, VariantContext.class, cloudPrefetchBuffer, cloudIndexPrefetchBuffer,
referenceArguments.getReferencePath());
referenceArguments.getReferencePath(), doGenotypeCalling());

//Note: the intervals for the driving variants are set in onStartup
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,6 @@ public class GnarlyGenotyperIntegrationTest extends CommandLineProgramTest {



private static String getQueryJsonForGenomicsDB(String vidMappingFile, String callsetMappingFile, String tiledbWorkspace,
String referenceGenome) throws IOException {
//Produce temporary JSON query config file
String indentString = " ";
String queryJSON = "{\n";
queryJSON += indentString + "\"scan_full\": true,\n";
queryJSON += indentString + "\"workspace\": \""+tiledbWorkspace+"\",\n";
queryJSON += indentString + "\"array\": \""+GenomicsDBConstants.DEFAULT_ARRAY_NAME+"\",\n";
queryJSON += indentString + "\"vid_mapping_file\": \""+vidMappingFile+"\",\n";
queryJSON += indentString + "\"callset_mapping_file\": \""+callsetMappingFile+"\",\n";
queryJSON += indentString + "\"produce_GT_field\": true,\n";
queryJSON += indentString + "\"max_diploid_alt_alleles_that_can_be_genotyped\": 6,\n";
queryJSON += indentString + "\"reference_genome\": \""+referenceGenome+"\"";
queryJSON += "\n}\n";
File tmpQueryJSONFile = new File(tiledbWorkspace, "query.json");
tmpQueryJSONFile.deleteOnExit();
FileWriter fptr = new FileWriter(tmpQueryJSONFile);
fptr.write(queryJSON);
fptr.close();
return tmpQueryJSONFile.getAbsolutePath();
}

@DataProvider(name="VCFdata")
public Object[][] getVCFdata() {
return new Object[][]{
Expand All @@ -92,10 +70,6 @@ public void testUsingGenomicsDB(File[] inputs, File expected, String interval, L

//copy in the extra files until Protobuf update in PR #4645 is ready
Runtime.getRuntime().exec("cp " + getTestFile("vidmap.updated.json").getAbsolutePath() +" "+ tempGenomicsDB.getAbsolutePath() + "/vidmap.json");
getQueryJsonForGenomicsDB(new File(tempGenomicsDB, GenomicsDBConstants.DEFAULT_VIDMAP_FILE_NAME).getAbsolutePath(),
new File(tempGenomicsDB, GenomicsDBConstants.DEFAULT_CALLSETMAP_FILE_NAME).getAbsolutePath(),
tempGenomicsDB.getAbsolutePath(),
reference);

File output = runTool(genomicsDBUri, interval, reference, additionalArguments);

Expand Down
Loading

0 comments on commit 5e3bf34

Please sign in to comment.