Skip to content

Commit 3ef5381

Browse files
committed
Update label for mGapReleaseAlleleFreqStep
1 parent 7f53fcb commit 3ef5381

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static class Provider extends AbstractVariantProcessingStepProvider<mGapR
3939
{
4040
public Provider()
4141
{
42-
super("mGapReleaseAlleleFreq", "Compare VCF to mGap Release", "DiscvrVariantAnnotator", "Annotate a VCF using the AF field from an mGAP release.", List.of(
42+
super("mGapReleaseAlleleFreq", "Annotate using mGap Release AFs", "DiscvrVariantAnnotator", "Annotate a VCF using the AF field from an mGAP release.", List.of(
4343
ToolParameterDescriptor.createExpDataParam(REF_VCF, "mGAP Release", "The mGAP release VCF to use for annotation", "sequenceanalysis-sequenceoutputfileselectorfield", new JSONObject()
4444
{{
4545
put("allowBlank", false);

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,9 +1141,12 @@ private void inspectAndSummarizeVcf(JobContext ctx, File vcfInput, GeneToNameTra
11411141
return;
11421142
}
11431143

1144+
String releaseVersion = ctx.getParams().optString("releaseVersion");
1145+
11441146
long sitesInspected = 0L;
11451147
long totalVariants = 0L;
11461148
long totalPrivateVariants = 0L;
1149+
long newInThisRelease = 0L;
11471150
Map<VariantContext.Type, Long> typeCounts = new HashMap<>();
11481151

11491152
File interestingVariantTable = getVariantTableName(ctx, vcfInput);
@@ -1412,6 +1415,11 @@ else if (maxScore > 0.0)
14121415
}
14131416
}
14141417

1418+
if (vc.getAttribute("mGAPV") != null && releaseVersion.equals(vc.getAttributeAsString("mGAPV", null)))
1419+
{
1420+
newInThisRelease++;
1421+
}
1422+
14151423
for (List<String> line : queuedLines)
14161424
{
14171425
writer.writeNext(line.toArray(new String[0]));
@@ -1431,7 +1439,7 @@ else if (maxScore > 0.0)
14311439
totalSubjects = reader.getFileHeader().getSampleNamesInOrder().size();
14321440
}
14331441

1434-
generateSummaries(ctx, vcfInput, genome, totalVariants, totalPrivateVariants, totalSubjects, typeCounts);
1442+
generateSummaries(ctx, vcfInput, genome, totalVariants, totalPrivateVariants, newInThisRelease, totalSubjects, typeCounts);
14351443
}
14361444

14371445
try
@@ -1469,7 +1477,7 @@ public Collection<String> parseRawOmimPheno(VariantContext vc, Logger log)
14691477
return Collections.emptySet();
14701478
}
14711479

1472-
private static void generateSummaries(JobContext ctx, File vcf, ReferenceGenome genome, long totalVariants, long totalPrivateVariants, int totalSubjects, Map<VariantContext.Type, Long> typeCounts) throws PipelineJobException
1480+
private static void generateSummaries(JobContext ctx, File vcf, ReferenceGenome genome, long totalVariants, long totalPrivateVariants, long newInThisRelease, int totalSubjects, Map<VariantContext.Type, Long> typeCounts) throws PipelineJobException
14731481
{
14741482
//variants to table
14751483
ctx.getLogger().info("Running VariantsToTable");
@@ -1504,7 +1512,7 @@ private static void generateSummaries(JobContext ctx, File vcf, ReferenceGenome
15041512
ctx.getLogger().info("Generating summary stats from: " + variantsToTable.getName());
15051513
File summaryTable = new File(vcf.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(vcf.getName()) + ".summary.txt");
15061514
File summaryTableByField = new File(vcf.getParentFile(), SequenceAnalysisService.get().getUnzippedBaseName(vcf.getName()) + ".summaryByField.txt");
1507-
new mGapSummarizer().generateSummary(ctx, variantsToTable, summaryTable, summaryTableByField, totalVariants, totalPrivateVariants, totalSubjects, typeCounts);
1515+
new mGapSummarizer().generateSummary(ctx, variantsToTable, summaryTable, summaryTableByField, totalVariants, totalPrivateVariants, newInThisRelease, totalSubjects, typeCounts);
15081516
}
15091517

15101518
private void maybeWriteVariantLine(Set<List<String>> queuedLines, VariantContext vc, @Nullable String allele, String source, String reason, String description, Collection<String> overlappingGenes, Collection<String> omimIds, Collection<String> omimPhenotypes, Logger log, String identifier)

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,26 +190,24 @@ public static void filterCodingPotential(Set<String> codingPotential)
190190
}
191191
}
192192

193-
public void generateSummary(SequenceOutputHandler.JobContext ctx, File variantsToTable, File output, File outputPerValue, long totalVariants, long totalPrivateVariants, int totalSubjects, Map<VariantContext.Type, Long> typeCounts) throws PipelineJobException
193+
public void generateSummary(SequenceOutputHandler.JobContext ctx, File variantsToTable, File output, File outputPerValue, long totalVariants, long totalPrivateVariants, long newInThisRelease, int totalSubjects, Map<VariantContext.Type, Long> typeCounts) throws PipelineJobException
194194
{
195195
ctx.getLogger().info("reading variant table");
196-
int lineNo = 0;
197196
FieldTracker tracker = new FieldTracker(130);
198197
try (BufferedReader reader = Readers.getReader(variantsToTable))
199198
{
200-
lineNo++;
201-
if (lineNo % 500000 == 0)
202-
{
203-
ctx.getLogger().info("processed " + lineNo + " lines");
204-
}
205-
206199
String lineStr;
207200
List<String> header = new ArrayList<>();
208201
int lineCount = 0;
209202
while ((lineStr = reader.readLine()) != null)
210203
{
211204
String[] line = lineStr.split("\t");
212205
lineCount++;
206+
if (lineCount % 500000 == 0)
207+
{
208+
ctx.getLogger().info("processed " + lineCount + " lines");
209+
}
210+
213211
if (lineCount == 1)
214212
{
215213
//skip header
@@ -249,6 +247,7 @@ public void generateSummary(SequenceOutputHandler.JobContext ctx, File variantsT
249247
valWriter.writeNext(new String[]{"Field", "Level", "Total"});
250248
valWriter.writeNext(new String[]{"Counts", "TotalVariants", String.valueOf(totalVariants)});
251249
valWriter.writeNext(new String[]{"Counts", "TotalPrivateVariants", String.valueOf(totalPrivateVariants)});
250+
valWriter.writeNext(new String[]{"Counts", "TotalVariantsNewInRelease", String.valueOf(newInThisRelease)});
252251
valWriter.writeNext(new String[]{"Counts", "TotalSamples", String.valueOf(totalSubjects)});
253252

254253
for (VariantContext.Type type : typeCounts.keySet())

0 commit comments

Comments
 (0)