/** * Executes the given R script that is stored in a file by a call to Rscript. * Blocks until the R script is complete. * * @param scriptFile the file object for the script * @param arguments any arguments required by the script * @return the return code of the R process */ public static int executeFromFile(final File scriptFile, final String... arguments) { final String[] command = new String[arguments.length + 2]; command[0] = R_EXE; command[1] = scriptFile.getAbsolutePath(); System.arraycopy(arguments, 0, command, 2, arguments.length); LOG.info(String.format("Executing R script via command: %s", CollectionUtil.join(Arrays.asList(command), " "))); return ProcessExecutor.execute(command); }
/** * Executes the given R script that is stored in a file by a call to Rscript. * Blocks until the R script is complete. * * @param scriptFile the file object for the script * @param arguments any arguments required by the script * @return the return code of the R process */ public static int executeFromFile(final File scriptFile, final String... arguments) { final String[] command = new String[arguments.length + 2]; command[0] = R_EXE; command[1] = scriptFile.getAbsolutePath(); System.arraycopy(arguments, 0, command, 2, arguments.length); LOG.info(String.format("Executing R script via command: %s", CollectionUtil.join(Arrays.asList(command), " "))); return ProcessExecutor.execute(command); }
/** * Reviews the qualities observed thus far and throws an exception if any are below the minimum quality threshold. */ public void assertMinimumQualities() { final Collection<String> errorTokens = new LinkedList<String>(); for (final Map.Entry<Byte, AtomicInteger> entry : this.qualityCountMap.entrySet()) { /** * We're comparing revised qualities here, not observed, but the qualities that are logged in qualityCountMap are observed * qualities. So as we iterate through it, convert observed qualities into their revised value. */ if (generateRevisedQuality(entry.getKey()) < minimumRevisedQuality) { errorTokens.add(String.format("quality %s observed %s times", entry.getKey(), entry.getValue())); } } if (!errorTokens.isEmpty()) { throw new PicardException(String.format( "Found BCL qualities that fell beneath minimum threshold of %s: %s.", minimumRevisedQuality, CollectionUtil.join(errorTokens, "; ") )); } }
/** * Reviews the qualities observed thus far and throws an exception if any are below the minimum quality threshold. */ public void assertMinimumQualities() { final Collection<String> errorTokens = new LinkedList<String>(); for (final Map.Entry<Byte, AtomicInteger> entry : this.qualityCountMap.entrySet()) { /** * We're comparing revised qualities here, not observed, but the qualities that are logged in qualityCountMap are observed * qualities. So as we iterate through it, convert observed qualities into their revised value. */ if (generateRevisedQuality(entry.getKey()) < minimumRevisedQuality) { errorTokens.add(String.format("quality %s observed %s times", entry.getKey(), entry.getValue())); } } if (!errorTokens.isEmpty()) { throw new PicardException(String.format( "Found BCL qualities that fell beneath minimum threshold of %s: %s.", minimumRevisedQuality, CollectionUtil.join(errorTokens, "; ") )); } }
throw new CodecLineParsingException("Invalid GeliTextFeature row found -- incorrect element count. Expected 18, got " + tokens.length + " line = " + CollectionUtil.join(Arrays.asList(tokens), " ")); } catch (CodecLineParsingException e) { e.printStackTrace(); throw new RuntimeException("Unable to parse line " + CollectionUtil.join(Arrays.asList(tokens), " "), e); } catch (NumberFormatException e) { e.printStackTrace(); throw new RuntimeException("Unable to parse line " + CollectionUtil.join(Arrays.asList(tokens), " "), e);
@Test public void slurpTest() throws FileNotFoundException { Assert.assertEquals(IOUtil.slurp(SLURP_TEST_FILE.toFile()), CollectionUtil.join(SLURP_TEST_LINES, SLURP_TEST_LINE_SEPARATOR)); }