Skip to content

Commit

Permalink
Fix bug with incorrectly preprocessing multiple VCFs with the same ba…
Browse files Browse the repository at this point in the history
…se filename
  • Loading branch information
mkirsche committed Jun 28, 2021
1 parent 8d02b02 commit b0ca6a3
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

JASMINE: Jointly Accurate Sv Merging with Intersample Network Edges

Version 1.1.0
Version 1.1.1

This tool is used to merge structural variants (SVs) across samples. Each sample has a number of SV calls, consisting of position information (chromosome, start, end, length), type and strand information, and a number of other values. Jasmine represents the set of all SVs across samples as a network, and uses a modified minimum spanning forest algorithm to determine the best way of merging the variants such that each merged variants represents a set of analogous variants occurring in different samples.

Expand Down
Binary file modified jasmine.jar
Binary file not shown.
Binary file modified jasmine_igv.jar
Binary file not shown.
Binary file modified jasmine_iris.jar
Binary file not shown.
51 changes: 44 additions & 7 deletions src/PipelineManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class PipelineManager {
Expand All @@ -22,14 +23,23 @@ public class PipelineManager {
static String convertDuplicationsToInsertions(String fileList) throws Exception
{
ArrayList<String> vcfFiles = getFilesFromList(fileList);
ArrayList<String> newVcfFiles = new ArrayList<String>();
ArrayList<String> newVcfFiles = new ArrayList<String>();

HashSet<String> basenames = new HashSet<String>();

for(int i = 0; i<vcfFiles.size(); i++)
{
String vcfFile = vcfFiles.get(i);
String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(StringUtils.fileBaseName(vcfFile), "dupToIns");
String basename = StringUtils.fileBaseName(vcfFile);
while(basenames.contains(basename))
{
basename = i + "_" + basename;
}

String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(basename, "dupToIns");
newVcfFiles.add(newVcfFile);
DuplicationsToInsertions.convertFile(vcfFile, Settings.GENOME_FILE, newVcfFile);
basenames.add(basename);
}

return buildUpdatedFileList(fileList, "dupToIns", newVcfFiles);
Expand All @@ -45,14 +55,21 @@ static String normalizeTypes(String fileList) throws Exception
ArrayList<String> vcfFiles = getFilesFromList(fileList);
ArrayList<String> newVcfFiles = new ArrayList<String>();

HashSet<String> basenames = new HashSet<String>();

for(int i = 0; i<vcfFiles.size(); i++)
{
String vcfFile = vcfFiles.get(i);

String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(StringUtils.fileBaseName(vcfFile), "normalizeTypes");
String basename = StringUtils.fileBaseName(vcfFile);
while(basenames.contains(basename))
{
basename = i + "_" + basename;
}
String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(basename, "normalizeTypes");
newVcfFiles.add(newVcfFile);

NormalizeTypes.convertFile(vcfFile, newVcfFile);
basenames.add(basename);
}

return buildUpdatedFileList(fileList, "normalizeTypes", newVcfFiles);
Expand All @@ -71,11 +88,20 @@ static String runIris(String fileList) throws Exception
// Get any optional arguments to be passed to Iris that the user specified
String[] optionalArgs = Settings.IRIS_ARGS.split(",");

HashSet<String> basenames = new HashSet<String>();

// Refine one VCF file at a time
for(int i = 0; i<vcfFiles.size(); i++)
{
String vcfFile = vcfFiles.get(i);
String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(StringUtils.fileBaseName(vcfFile), "irisRefined");

String basename = StringUtils.fileBaseName(vcfFile);
while(basenames.contains(basename))
{
basename = i + "_" + basename;
}

String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(basename, "irisRefined");
String bamFile = bamFiles.get(i);
newVcfFiles.add(newVcfFile);

Expand All @@ -101,6 +127,8 @@ static String runIris(String fileList) throws Exception

// Actually run Iris
Iris.runIris(allArgs);

basenames.add(basename);
}

return buildUpdatedFileList(fileList, "irisRefined", newVcfFiles);
Expand All @@ -115,14 +143,23 @@ static String markSpecificCalls(String fileList) throws Exception
ArrayList<String> vcfFiles = getFilesFromList(fileList);
ArrayList<String> newVcfFiles = new ArrayList<String>();

//PrintWriter newFileListOut = new PrintWriter(new File(newFileList));
HashSet<String> basenames = new HashSet<String>();

for(int i = 0; i<vcfFiles.size(); i++)
{
String vcfFile = vcfFiles.get(i);
String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(StringUtils.fileBaseName(vcfFile), "markedSpec");

String basename = StringUtils.fileBaseName(vcfFile);
while(basenames.contains(basename))
{
basename = i + "_" + basename;
}

String newVcfFile = Settings.OUT_DIR + "/" + StringUtils.addDescriptor(basename, "markedSpec");
newVcfFiles.add(newVcfFile);
MarkSpecificCalls.convertFile(vcfFile, newVcfFile, Settings.SPECIFIC_MIN_RCOUNT, Settings.SPECIFIC_MIN_LENGTH);

basenames.add(basename);
}

return buildUpdatedFileList(fileList, "markedSpec", newVcfFiles);
Expand Down
4 changes: 2 additions & 2 deletions src/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class Settings {
static void usage()
{
System.out.println();
System.out.println("Jasmine version 1.1.0");
System.out.println("Jasmine version 1.1.1");
System.out.println("Usage: jasmine [args]");
System.out.println(" Example: jasmine file_list=filelist.txt out_file=out.vcf");
System.out.println();
Expand Down Expand Up @@ -177,7 +177,7 @@ static void parseArgs(String[] args) throws Exception
{
if(args.length == 1 && (args[0].equalsIgnoreCase("--version") || args[0].equalsIgnoreCase("-v")))
{
System.out.println("Jasmine version 1.1.0");
System.out.println("Jasmine version 1.1.1");
System.exit(0);
}
if(args.length == 0)
Expand Down

0 comments on commit b0ca6a3

Please sign in to comment.