Skip to content

Commit 1370932

Browse files
committed
Update GT filters for SampleSpecificGenotypeFiltrationStep
1 parent 6333ae2 commit 1370932

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

mGAP/src/org/labkey/mgap/pipeline/SampleSpecificGenotypeFiltrationStep.java

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
167167
Integer wgsMinQual = getProvider().getParameterByName("wgsMinQual").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
168168
if (wgsMinQual != null)
169169
{
170-
params.add("--genotype-filter-name");
171-
params.add("GQ-LT" + wgsMinQual);
172-
params.add("--genotype-filter-expression");
173-
params.add("WGS:GQ<" + wgsMinQual);
170+
params.addAll(addGTFilter("WGS", wgsMinQual));
174171
}
175172

176173
Integer wxsMinDepth = getProvider().getParameterByName("wxsMinDepth").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
@@ -194,10 +191,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
194191
Integer wxsMinQual = getProvider().getParameterByName("wxsMinQual").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Integer.class);
195192
if (wxsMinQual != null)
196193
{
197-
params.add("--genotype-filter-name");
198-
params.add("GQ-LT" + wxsMinQual);
199-
params.add("--genotype-filter-expression");
200-
params.add("WXS:GQ<" + wxsMinQual);
194+
params.addAll(addGTFilter("WXS", wxsMinQual));
201195
}
202196

203197
params.add("--sample-map");
@@ -222,6 +216,38 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
222216
return output;
223217
}
224218

219+
private List<String> addGTFilter(String setName, int minQual)
220+
{
221+
// g.hasGQ() && !g.hasExtendedAttribute('RGQ') && GQ<20
222+
// !g.hasGQ() && g.hasExtendedAttribute('RGQ') && RGQ<20
223+
// g.hasGQ() && g.hasExtendedAttribute('RGQ') && GQ<20 && RGQ<20
224+
// !g.hasGQ() && !g.hasExtendedAttribute('RGQ')
225+
226+
List<String> params = new ArrayList<>();
227+
228+
params.add("--genotype-filter-name");
229+
params.add("GQ-LT" + minQual + "a");
230+
params.add("--genotype-filter-expression");
231+
params.add(setName + ":g.hasGQ() && !g.hasExtendedAttribute('RGQ') && GQ<" + minQual);
232+
233+
params.add("--genotype-filter-name");
234+
params.add("GQ-LT" + minQual + "b");
235+
params.add("--genotype-filter-expression");
236+
params.add(setName + ":!g.hasGQ() && g.hasExtendedAttribute('RGQ') && RGQ<" + minQual);
237+
238+
params.add("--genotype-filter-name");
239+
params.add("GQ-LT" + minQual + "c");
240+
params.add("--genotype-filter-expression");
241+
params.add(setName + ":g.hasGQ() && g.hasExtendedAttribute('RGQ') && GQ<" + minQual + " && RGQ<" + minQual);
242+
243+
params.add("--genotype-filter-name");
244+
params.add("GQ-LT" + minQual + "d");
245+
params.add("--genotype-filter-expression");
246+
params.add(setName + ":!g.hasGQ() && !g.hasExtendedAttribute('RGQ')");
247+
248+
return params;
249+
}
250+
225251
public static class Wrapper extends AbstractDiscvrSeqWrapper
226252
{
227253
public Wrapper(Logger log)

0 commit comments

Comments
 (0)