Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud tests for CompareReferences and CheckReferenceCompatibility tools #7973

Merged
merged 4 commits into from
Aug 4, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
* <pre>
* gatk CompareReferences \
* -R reference1.fasta \
* -refcomp reference2.fasta
* -refcomp reference2.fasta \
* -O output.fasta \
* -md5-calculation-mode USE_DICT
* </pre>
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CheckReferenceCompatibilityIntegrationTest extends CommandLineProgramTest {

@@ -209,4 +212,48 @@ public void testReferenceCompatibilityNoBAMOrVCF() throws IOException {
final String[] args = new String[]{"-refcomp", ref1.getAbsolutePath()};
runCommandLine(args);
}

@DataProvider(name = "cloudInputData")
public Object[][] cloudInputData() {
String testBucket = getGCPTestInputPath() + "org/broadinstitute/hellbender/tools/reference/";
return new Object[][]{
// dict, list of refs, expected output, isBAM, isVCF
new Object[]{testBucket + "reads_data_source_test1_withmd5s.bam",
Arrays.asList(testBucket + "hg19mini.fasta"),
new File(getToolTestDataDir(), "expected.testReferenceCompatibilityBAMWithMD5s_exactmatch.table"),
true, false
},
new Object[]{ testBucket + "example_variants_withSequenceDict_withmd5.vcf",
Arrays.asList(testBucket + "hg19mini.fasta"),
new File(getToolTestDataDir(), "expected.testReferenceCompatibilityVCFWithMD5s.table"),
false, true
},
};
}

@Test(dataProvider = "cloudInputData"/*, groups = "bucket"*/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orlicohen groups = "bucket" Needs to be uncommented here and in the other test before these will be able to pass on github

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

public void testReferenceCompatibilityCloudInputs(String dict, List<String> fastas, File expected, boolean isBAM, boolean isVCF) throws IOException{
final File output = createTempFile("testCompareReferencesCloudInputs", ".table");

List<String> arguments = new ArrayList<>();
for(int i = 0; i < fastas.size(); i++){
arguments.add("-refcomp");
arguments.add(fastas.get(i));
}

if(isBAM){
arguments.add("-I");
} else if(isVCF){
arguments.add("-V");
}

arguments.add(dict);
arguments.add("-O");
arguments.add(output.getAbsolutePath());

final String[] args = arguments.toArray(new String[0]);
runCommandLine(args);

IntegrationTestSpec.assertEqualTextFiles(output, expected);
}
}
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CompareReferencesIntegrationTest extends CommandLineProgramTest {

@@ -98,6 +101,46 @@ public void testCompareReferencesUseDictMD5MissingValue() throws IOException{
runCommandLine(args);
}

@DataProvider(name = "cloudInputData")
public Object[][] cloudInputData() {
String testBucket = getGCPTestInputPath() + "org/broadinstitute/hellbender/tools/reference/";
return new Object[][]{
// list of refs, expected output
new Object[]{ Arrays.asList(testBucket + "hg19mini.fasta",
testBucket + "hg19mini_chr2snp.fasta"),
new File(getToolTestDataDir(), "expected.testCompareReferencesMissingValue.table")
},
new Object[]{ Arrays.asList(testBucket + "hg19mini.fasta",
testBucket + "hg19mini_1renamed.fasta",
testBucket + "hg19mini_chr2snp.fasta"),
new File(getToolTestDataDir(), "expected.testCompareReferencesMultipleReferences.table")
},
};
}

@Test(dataProvider = "cloudInputData"/*, groups = "bucket"*/)
public void testCompareReferencesCloudInputs(List<String> fastas, File expected) throws IOException{
final File output = createTempFile("testCompareReferencesCloudInputs", ".table");
List<String> arguments = new ArrayList<>();
for(int i = 0; i < fastas.size(); i++){
if(i == 0){
arguments.add("-R");

}
else{
arguments.add("-refcomp");
}
arguments.add(fastas.get(i));
}
arguments.add("-O");
arguments.add(output.getAbsolutePath());

final String[] args = arguments.toArray(new String[0]);
runCommandLine(args);

IntegrationTestSpec.assertEqualTextFiles(output, expected);
}

// no assertions made, testing tool runs successfully without -O argument
@Test
public void testCompareReferencesToStdOutput() throws IOException{