Skip to content

Commit 9a12e35

Browse files
committed
Allow KING to exclude contigs
1 parent 121a5f8 commit 9a12e35

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/variant/KingInferenceStep.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.labkey.api.pipeline.PipelineJobException;
1414
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
1515
import org.labkey.api.sequenceanalysis.pipeline.AbstractVariantProcessingStepProvider;
16+
import org.labkey.api.sequenceanalysis.pipeline.CommandLineParam;
1617
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
1718
import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider;
1819
import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome;
@@ -43,8 +44,11 @@ public Provider()
4344
ToolParameterDescriptor.create("limitToChromosomes", "Limit to Chromosomes", "If checked, the analysis will include only the primary chromosomes", "checkbox", new JSONObject()
4445
{{
4546
put("checked", true);
46-
}}, true)
47-
), null, "https://www.kingrelatedness.com/manual.shtml");
47+
}}, true),
48+
ToolParameterDescriptor.create("excludedContigs", "Excluded Contigs", "A comma separated list of contigs to exclude, such as X,Y,MT.", "textfield", new JSONObject(){{
49+
50+
}}, "X,Y,MT")
51+
), null, "https://www.kingrelatedness.com/manual.shtml");
4852
}
4953

5054
@Override
@@ -90,9 +94,9 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
9094
return NumberUtils.isCreatable(name) || "X".equalsIgnoreCase(name) || "Y".equalsIgnoreCase(name);
9195
}).map(SAMSequenceRecord::getSequenceName).toList();
9296

93-
if (toKeep.size() == 0)
97+
if (toKeep.isEmpty())
9498
{
95-
getPipelineCtx().getLogger().info("The option to limit to chromosomes was selected, but no contigs were foudn with numeric names or names beginning with chr. All contigs will be used.");
99+
getPipelineCtx().getLogger().info("The option to limit to chromosomes was selected, but no contigs were found with numeric names or names beginning with chr. All contigs will be used.");
96100
}
97101
else
98102
{
@@ -101,6 +105,13 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
101105
}
102106
}
103107

108+
String excludedContigs = StringUtils.trimToNull(getProvider().getParameterByName("excludedContigs").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), String.class));
109+
if (excludedContigs != null)
110+
{
111+
plinkArgs.add("--not-chr");
112+
plinkArgs.add(excludedContigs);
113+
}
114+
104115
plinkArgs.add("--allow-extra-chr");
105116
plinkArgs.add("--silent");
106117

0 commit comments

Comments
 (0)