@@ -0,0 +1,1261 @@
+package com.github.sparkcaller.preprocessing;%0A%0Aimport com.github.sparkcaller.Utils;%0Aimport org.apache.spark.api.java.function.Function;%0Aimport picard.sam.markduplicates.MarkDuplicates;%0A%0Aimport java.io.File;%0Aimport java.util.ArrayList;%0A%0Apublic class DuplicateMarker implements Function%3CFile, File%3E %7B%0A    final private ArrayList%3CString%3E extraArgs;%0A%0A    public DuplicateMarker(String extraArgsString) %7B%0A        this.extraArgs = Utils.possibleStringToArgs(extraArgsString);%0A    %7D%0A%0A    public File call(File file) throws Exception %7B%0A        MarkDuplicates markDuplicates = new MarkDuplicates();%0A%0A        ArrayList%3CString%3E markerArgs = new ArrayList%3CString%3E();%0A        markerArgs.add(%22INPUT=%22);%0A        markerArgs.add(file.getPath());%0A%0A        String newFileName = Utils.removeExtenstion(file.getPath(), %22bam%22) + %22-deduped.bam%22;%0A        File outputBamFile = new File(newFileName);%0A%0A        markerArgs.add(%22OUTPUT=%22);%0A        markerArgs.add(outputBamFile.getPath());%0A%0A        markerArgs.add(%22METRICS_FILE=%22);%0A        markerArgs.add(file.getPath() + %22-metrics.txt%22);%0A%0A        if (this.extraArgs != null) %7B%0A            markerArgs.addAll(extraArgs);%0A        %7D%0A%0A        markDuplicates.instanceMain(markerArgs.toArray(new String%5B0%5D));%0A        return outputBamFile;%0A    %7D%0A%7D%0A

Create a class which is used to mark all duplicate reads.