forked from bimberlabinternal/BimberLabKeyModules
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLiftoverVcfRunner.java
More file actions
80 lines (63 loc) · 2.1 KB
/
LiftoverVcfRunner.java
File metadata and controls
80 lines (63 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.labkey.mgap.pipeline;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.pipeline.PipelineJobException;
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
import org.labkey.api.sequenceanalysis.run.PicardWrapper;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class LiftoverVcfRunner extends PicardWrapper
{
public LiftoverVcfRunner(Logger log)
{
super(log);
}
@Override
protected String getToolName()
{
return "LiftoverVcf";
}
public void doLiftover(File inputVcf, File chainFile, File referenceFasta, @Nullable File rejectVcf, File outputVcf, double minPctMatch) throws PipelineJobException
{
getLogger().info("Liftover VCF: " + inputVcf.getPath());
List<String> params = getBaseArgs();
params.add("--INPUT");
params.add(inputVcf.getPath());
params.add("--OUTPUT");
params.add(outputVcf.getPath());
params.add("--CHAIN");
params.add(chainFile.getPath());
params.add("--REFERENCE_SEQUENCE");
params.add(referenceFasta.getPath());
params.add("--WRITE_ORIGINAL_POSITION");
params.add("true");
params.add("--WRITE_ORIGINAL_ALLELES");
params.add("true");
params.add("--LOG_FAILED_INTERVALS");
params.add("false");
params.add("--LIFTOVER_MIN_MATCH");
params.add(String.valueOf(minPctMatch));
if (rejectVcf != null)
{
params.add("--REJECT");
params.add(rejectVcf.getPath());
}
execute(params);
if (!outputVcf.exists())
{
throw new PipelineJobException("Output file could not be found: " + outputVcf.getPath());
}
if (rejectVcf != null && rejectVcf.exists())
{
try
{
SequenceAnalysisService.get().ensureVcfIndex(rejectVcf, getLogger());
}
catch (IOException e)
{
throw new PipelineJobException(e);
}
}
}
}