Skip to content

Commit 77a865e

Browse files
committed
Improve verbosity for UpdateReadsetFilesHandler
1 parent 852a1d8 commit 77a865e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/analysis/UpdateReadsetFilesHandler.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import htsjdk.variant.vcf.VCFReader;
1414
import org.apache.commons.io.FileUtils;
1515
import org.apache.logging.log4j.Logger;
16+
import org.jetbrains.annotations.Nullable;
1617
import org.json.JSONObject;
1718
import org.labkey.api.module.ModuleLoader;
1819
import org.labkey.api.pipeline.PipelineJob;
@@ -36,7 +37,6 @@
3637
import java.io.File;
3738
import java.io.IOException;
3839
import java.io.PrintWriter;
39-
import java.nio.file.StandardCopyOption;
4040
import java.nio.file.StandardOpenOption;
4141
import java.util.ArrayList;
4242
import java.util.Arrays;
@@ -148,7 +148,7 @@ private SAMFileHeader getAndValidateHeaderForBam(SequenceOutputFile so, String n
148148
throw new PipelineJobException("Sample and library names match in read group(s), aborting");
149149
}
150150

151-
log.info("Readset name and header do not match: " + newRsName + " / " + distinctLibraries.stream().distinct().collect(Collectors.joining()));
151+
log.info("Readset name and header do not match: " + newRsName + " / existing library: " + distinctLibraries.stream().distinct().collect(Collectors.joining()) + ", existing sample: " + distinctSamples.stream().distinct().collect(Collectors.joining()));
152152

153153
return header;
154154
}
@@ -261,15 +261,15 @@ private void reheaderVcf(SequenceOutputFile so, JobContext ctx, String newRsName
261261
}
262262
FileUtils.moveFile(outputIdx, inputIndex);
263263

264-
addTracker(so, existingSample, newRsName);
264+
addTracker(so, existingSample, newRsName, null);
265265
}
266266
catch (IOException e)
267267
{
268268
throw new PipelineJobException(e);
269269
}
270270
}
271271

272-
private void addTracker(SequenceOutputFile so, String existingSample, String newRsName) throws IOException
272+
private void addTracker(SequenceOutputFile so, String existingSample, String newRsName, @Nullable String existingLibrary) throws IOException
273273
{
274274
File tracker = new File(so.getFile().getParentFile(), "reheaderHistory.txt");
275275
boolean preExisting = tracker.exists();
@@ -282,10 +282,10 @@ private void addTracker(SequenceOutputFile so, String existingSample, String new
282282
{
283283
if (!preExisting)
284284
{
285-
writer.println("OriginalSample\tNewSample");
285+
writer.println("OriginalSample\tNewSample\tOriginalLibrary");
286286
}
287287

288-
writer.println(existingSample + "\t" + newRsName);
288+
writer.println(existingSample + "\t" + newRsName + "\t" + (existingLibrary == null ? "N/A" : existingLibrary));
289289
}
290290
}
291291

@@ -345,7 +345,7 @@ private void reheaderBamOrCram(SequenceOutputFile so, JobContext ctx, String new
345345
}
346346
FileUtils.moveFile(outputIdx, inputIndex);
347347

348-
addTracker(so, existingSample, newRsName);
348+
addTracker(so, existingSample, newRsName, existingLibrary);
349349
}
350350
catch (IOException e)
351351
{

0 commit comments

Comments
 (0)