Skip to content

Commit 93508f2

Browse files
committed
Allow missing pedigree data
1 parent de3d5f4 commit 93508f2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.apache.logging.log4j.Logger;
1111
import org.jetbrains.annotations.Nullable;
1212
import org.json.JSONObject;
13+
import org.labkey.api.collections.CaseInsensitiveHashMap;
1314
import org.labkey.api.pipeline.PipelineJobException;
1415
import org.labkey.api.reader.Readers;
1516
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
@@ -170,7 +171,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
170171
throw new PipelineJobException("Unable to find pedigree file: " + pedFile.getPath());
171172
}
172173

173-
File kingFam = createFamFile(pedFile, new File(plinkOutBed.getParentFile(), "plink.fam"), kingArgs);
174+
File kingFam = createFamFile(pedFile, new File(plinkOutBed.getParentFile(), "plink.fam"));
174175
kingArgs.add("--ped");
175176
kingArgs.add(kingFam.getPath());
176177

@@ -213,11 +214,11 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
213214
return output;
214215
}
215216

216-
private File createFamFile(File pedFile, File famFile, List<String> kingArgs) throws PipelineJobException
217+
private File createFamFile(File pedFile, File famFile) throws PipelineJobException
217218
{
218219
File newFamFile = new File(famFile.getParentFile(), "king.fam");
219220

220-
Map<String, String> pedMap = new HashMap<>();
221+
Map<String, String> pedMap = new CaseInsensitiveHashMap<>();
221222
try (BufferedReader reader = Readers.getReader(pedFile))
222223
{
223224
String line;
@@ -251,10 +252,13 @@ private File createFamFile(File pedFile, File famFile, List<String> kingArgs) th
251252
String newRow = pedMap.get(tokens[1]);
252253
if (newRow == null)
253254
{
254-
throw new PipelineJobException("Unable to find pedigree entry for: " + tokens[1]);
255+
getPipelineCtx().getLogger().warn("Unable to find pedigree entry for: " + tokens[1] + ", reusing original");
256+
writer.println(line);
257+
}
258+
else
259+
{
260+
writer.println(newRow);
255261
}
256-
257-
writer.println(newRow);
258262
}
259263
}
260264
catch (IOException e)

0 commit comments

Comments
 (0)