예제 #1
0
 public void testBadArgs() throws Exception {
   try (TestDirectory dir = new TestDirectory("sdf2fasta")) {
     final ArrayList<InputStream> al = new ArrayList<>();
     final FastaSequenceDataSource ds = new FastaSequenceDataSource(al, new DNAFastaSymbolTable());
     final SequencesWriter sw = new SequencesWriter(ds, dir, 300000, PrereadType.UNKNOWN, false);
     sw.processSequences();
     checkHandleFlagsErr("-i", dir.toString(), "-o", "junithi", "-l", "-1");
   }
 }
예제 #2
0
 public void testValidUse2() throws Exception {
   try (TestDirectory dir = new TestDirectory("sdf2fasta")) {
     createPreread(">x" + StringUtils.LS + "actgn" + StringUtils.LS, new File(dir, "left"));
     createPreread(">x" + StringUtils.LS + "actgn" + StringUtils.LS, new File(dir, "right"));
     final String pathpr = dir.getPath();
     runCommandWithNamedOutput(JUNITOUT, pathpr, "ACTGN", "ACTGN");
     runCommandWithNamedOutput(JUNITOUT + ".FA", pathpr, "ACTGN", "ACTGN");
     runCommandWithNamedOutput(JUNITOUT + ".fasta", pathpr, "ACTGN", "ACTGN");
   }
 }
예제 #3
0
 public void testValidUse() throws Exception {
   try (TestDirectory dir = new TestDirectory("sdf2fasta")) {
     createPreread(">x" + StringUtils.LS + "actgn" + StringUtils.LS, dir);
     final String pathpr = dir.getPath();
     try {
       runCommandWithNamedOutput(JUNITOUT, pathpr, "ACTGN");
       runCommandWithNamedOutput(JUNITOUT + ".FA", pathpr, "ACTGN");
       runCommandWithNamedOutput(JUNITOUT + ".fasta", pathpr, "ACTGN");
       runCommandLineLength2(pathpr);
     } finally {
       FileHelper.deleteAll(dir);
     }
     createPrereadProtein(dir);
     runCommandWithNamedOutput(JUNITOUT, pathpr, "X*ARNDCQEGHILKMFPSTWYV");
   }
 }
예제 #4
0
  public void testValidation() throws Exception {
    try (TestDirectory main = new TestDirectory()) {
      final File in =
          FileHelper.resourceToGzFile(
              "com/rtg/vcf/resources/vcfsubset.vcf", new File(main, "vcf.vcf.gz"));
      final File foo = new File(main, "foo");
      final File out = new File(main, "out.vcf.gz");
      final File out2 = new File(main, "out.vcf");
      String err = checkHandleFlagsErr("-i", foo.getPath(), "-o", out.getPath());
      TestUtils.containsAll(TestUtils.unwrap(err), "Given file ", " does not exist.");

      err = checkHandleFlagsErr("-i", main.getPath(), "-o", out.getPath());
      TestUtils.containsAll(TestUtils.unwrap(err), main.getPath() + "\" is a directory");

      assertTrue(out.createNewFile());
      err = checkHandleFlagsErr("-i", in.getPath(), "-o", new File(main, "out.vcf").getPath());
      TestUtils.containsAll(
          TestUtils.unwrap(err), "The file \"" + out.getPath() + "\" already exists");

      assertTrue(out2.createNewFile());
      err = checkHandleFlagsErr("-i", in.getPath(), "-o", out2.getPath(), "--no-gzip");
      TestUtils.containsAll(
          TestUtils.unwrap(err), "The file \"" + out2.getPath() + "\" already exists");

      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-infos",
              "--remove-info",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-infos, --remove-info, or --keep-info can be set");
      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-infos",
              "--keep-info",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-infos, --remove-info, or --keep-info can be set");
      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-info",
              "feh",
              "--keep-info",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-infos, --remove-info, or --keep-info can be set");

      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-filters",
              "--remove-filter",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-filters, --remove-filter, or --keep-filter can be set");
      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-filters",
              "--keep-filter",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-filters, --remove-filter, or --keep-filter can be set");
      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-filter",
              "feh",
              "--keep-filter",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-filters, --remove-filter, or --keep-filter can be set");

      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-samples",
              "--remove-sample",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-samples, --remove-sample, or --keep-sample can be set");
      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-samples",
              "--keep-sample",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-samples, --remove-sample, or --keep-sample can be set");
      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-sample",
              "feh",
              "--keep-sample",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err),
          "Only one of --remove-samples, --remove-sample, or --keep-sample can be set");

      err =
          checkHandleFlagsErr(
              "-i",
              in.getPath(),
              "-o",
              new File(main, "newout.gz").getPath(),
              "--remove-format",
              "feh",
              "--keep-format",
              "blah");
      TestUtils.containsAll(
          TestUtils.unwrap(err), "Only one of --remove-format or --keep-format can be set");
    }
  }