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

EVA-3308 - Set the output file to contain the input taxonomy accession #426

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -32,14 +32,16 @@ public class VariantContextWriterConfiguration {
@Bean(BeanNames.EVA_SUBMITTED_VARIANT_WRITER)
public VariantContextWriter evaVariantContextWriter(InputParameters parameters) {
Path reportPath = ReportPathResolver.getEvaReportPath(parameters.getOutputFolder(),
parameters.getAssemblyAccession());
parameters.getAssemblyAccession(),
parameters.getTaxonomy());
return new VariantContextWriter(reportPath, parameters.getAssemblyAccession());
}

@Bean(BeanNames.DBSNP_SUBMITTED_VARIANT_WRITER)
public VariantContextWriter dbsnpVariantContextWriter(InputParameters parameters) {
Path reportPath = ReportPathResolver.getDbsnpReportPath(parameters.getOutputFolder(),
parameters.getAssemblyAccession());
parameters.getAssemblyAccession(),
parameters.getTaxonomy());
return new VariantContextWriter(reportPath, parameters.getAssemblyAccession());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
*/
public class ReportPathResolver {

public static Path getEvaReportPath(String outputFolder, String referenceAssembly) {
public static Path getEvaReportPath(String outputFolder, String referenceAssembly, int taxonomy) {
final String FILE_SUFFIX = "_eva.vcf";
return Paths.get(outputFolder).resolve(referenceAssembly + FILE_SUFFIX);
return Paths.get(outputFolder).resolve(referenceAssembly + '_' + taxonomy + FILE_SUFFIX);
}

public static Path getDbsnpReportPath(String outputFolder, String referenceAssembly) {
public static Path getDbsnpReportPath(String outputFolder, String referenceAssembly, int taxonomy) {
final String FILE_SUFFIX = "_dbsnp.vcf";
return Paths.get(outputFolder).resolve(referenceAssembly + FILE_SUFFIX);
return Paths.get(outputFolder).resolve(referenceAssembly + '_' + taxonomy + FILE_SUFFIX);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void basicWrite() throws Exception {
}

private File assertWriteVcf(File outputFolder, SubmittedVariantEntity... variants) throws Exception {
Path reportPath = ReportPathResolver.getEvaReportPath(outputFolder.getAbsolutePath(), REFERENCE_ASSEMBLY);
Path reportPath = ReportPathResolver.getEvaReportPath(outputFolder.getAbsolutePath(), REFERENCE_ASSEMBLY,
TAXONOMY_ACCESSION);
VariantContextWriter writer = new VariantContextWriter(reportPath, REFERENCE_ASSEMBLY);
writer.open(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ public void tearDown() throws Exception {

private void deleteOutputFiles() {
ReportPathResolver.getDbsnpReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile().delete();
ReportPathResolver.getEvaReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile().delete();
}

Expand Down Expand Up @@ -125,13 +127,15 @@ public void variantsWritten() throws Exception {

private FileInputStream getExportedEva() throws FileNotFoundException {
return new FileInputStream(ReportPathResolver.getEvaReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile());
}

private FileInputStream getExportedDbsnp() throws FileNotFoundException {
return new FileInputStream(ReportPathResolver.getDbsnpReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ public void tearDown() {

private void deleteOutputFiles() {
ReportPathResolver.getDbsnpReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile().delete();
ReportPathResolver.getEvaReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile().delete();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ public void tearDown() {

private void deleteOutputFiles() {
ReportPathResolver.getDbsnpReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile().delete();
ReportPathResolver.getEvaReportPath(inputParameters.getOutputFolder(),
inputParameters.getAssemblyAccession())
inputParameters.getAssemblyAccession(),
inputParameters.getTaxonomy())
.toFile().delete();
}

Expand Down
Loading