forked from BimberLab/DiscvrLabKeyModules
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSamtoolsIndexer.java
More file actions
47 lines (37 loc) · 1.14 KB
/
SamtoolsIndexer.java
File metadata and controls
47 lines (37 loc) · 1.14 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
package org.labkey.api.sequenceanalysis.pipeline;
import org.apache.logging.log4j.Logger;
import org.labkey.api.pipeline.PipelineJobException;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by bimber on 11/4/2016.
*/
public class SamtoolsIndexer extends SamtoolsRunner
{
private static final String COMMAND = "index";
public SamtoolsIndexer(Logger log)
{
super(log);
}
public File execute(File inputBam) throws PipelineJobException
{
getLogger().info("Indexing SAM/BAM: " + inputBam.getPath());
File idx = SequencePipelineService.get().getExpectedIndex(inputBam);
if (idx.exists())
{
getLogger().debug("deleting existing index: " + idx.getPath());
idx.delete();
}
List<String> params = new ArrayList<>();
params.add(getSamtoolsPath().getPath());
params.add(COMMAND);
params.add(inputBam.getPath());
execute(params);
if (!idx.exists())
{
throw new PipelineJobException("Unable to find BAM index: " + idx.getPath());
}
return idx;
}
}