53
53
import org .broadinstitute .barclay .argparser .SpecialArgumentsCollection ;
54
54
import picard .cmdline .argumentcollections .OptionalReferenceArgumentCollection ;
55
55
import picard .cmdline .argumentcollections .ReferenceArgumentCollection ;
56
+ import picard .cmdline .argumentcollections .RequesterPaysArgumentCollection ;
56
57
import picard .cmdline .argumentcollections .RequiredReferenceArgumentCollection ;
57
- import picard .nio .PathProvider ;
58
+ import picard .nio .GoogleStorageUtils ;
59
+ import picard .nio .HttpNioUtils ;
58
60
import picard .nio .PicardHtsPath ;
59
61
import picard .util .RExecutor ;
60
62
61
63
import java .io .File ;
62
64
import java .net .InetAddress ;
63
65
import java .text .DecimalFormat ;
64
66
import java .util .ArrayList ;
65
- import java .util .Arrays ;
66
67
import java .util .Collections ;
67
68
import java .util .Date ;
68
69
import java .util .List ;
69
- import java .util .stream .Collectors ;
70
70
71
71
/**
72
72
* Abstract class to facilitate writing command-line programs.
85
85
*
86
86
*/
87
87
public abstract class CommandLineProgram {
88
- private static String PROPERTY_USE_LEGACY_PARSER = "picard.useLegacyParser" ;
89
- private static String PROPERTY_CONVERT_LEGACY_COMMAND_LINE = "picard.convertCommandLine" ;
88
+ private static final String PROPERTY_USE_LEGACY_PARSER = "picard.useLegacyParser" ;
89
+ private static final String PROPERTY_CONVERT_LEGACY_COMMAND_LINE = "picard.convertCommandLine" ;
90
90
private static Boolean useLegacyParser ;
91
91
public static String SYNTAX_TRANSITION_URL =
92
92
"https://github.com/broadinstitute/picard/wiki/Command-Line-Syntax-Transition-For-Users-(Pre-Transition)" ;
@@ -132,6 +132,9 @@ public abstract class CommandLineProgram {
132
132
// after argument parsing using the value established by the user in the referenceSequence argument collection.
133
133
protected File REFERENCE_SEQUENCE = Defaults .REFERENCE_FASTA ;
134
134
135
+ @ ArgumentCollection
136
+ public RequesterPaysArgumentCollection requesterPays = new RequesterPaysArgumentCollection ();
137
+
135
138
@ ArgumentCollection (doc ="Special Arguments that have meaning to the argument parsing system. " +
136
139
"It is unlikely these will ever need to be accessed by the command line program" )
137
140
public Object specialArgumentsCollection = useLegacyParser () ?
@@ -182,7 +185,7 @@ public void instanceMainWithExit(final String[] argv) {
182
185
}
183
186
184
187
public int instanceMain (final String [] argv ) {
185
- String actualArgs [] = argv ;
188
+ String [] actualArgs = argv ;
186
189
187
190
if (System .getProperty (PROPERTY_CONVERT_LEGACY_COMMAND_LINE , "false" ).equals ("true" )) {
188
191
actualArgs = CommandLineSyntaxTranslater .convertPicardStyleToPosixStyle (argv );
@@ -249,16 +252,15 @@ public int instanceMain(final String[] argv) {
249
252
// default reader factory. At least until https://github.com/samtools/htsjdk/issues/1666 is resolved
250
253
SamReaderFactory .setDefaultValidationStringency (VALIDATION_STRINGENCY );
251
254
255
+ // Configure the various filesystem providers
256
+ GoogleStorageUtils .initialize (requesterPays .getProjectForRequesterPays ());
257
+ HttpNioUtils .initialize ();
258
+
252
259
if (!QUIET ) {
253
260
System .err .println ("[" + new Date () + "] " + commandLine );
254
261
255
- // Output a one liner about who/where and what software/os we're running on
262
+ // Output a one- liner about who/where and what software/os we're running on
256
263
try {
257
- final String pathProvidersMessage =
258
- Arrays .stream (PathProvider .values ())
259
- .map (provider -> String .format ("Provider %s is%s available;" , provider .name (), provider .isAvailable ? "" : " not" ))
260
- .collect (Collectors .joining (" " ));
261
-
262
264
final boolean usingIntelDeflater = (BlockCompressedOutputStream .getDefaultDeflaterFactory () instanceof IntelDeflaterFactory &&
263
265
((IntelDeflaterFactory )BlockCompressedOutputStream .getDefaultDeflaterFactory ()).usingIntelDeflater ());
264
266
final boolean usingIntelInflater = (BlockGunzipper .getDefaultInflaterFactory () instanceof IntelInflaterFactory &&
@@ -269,7 +271,7 @@ public int instanceMain(final String[] argv) {
269
271
System .getProperty ("os.name" ), System .getProperty ("os.version" ), System .getProperty ("os.arch" ),
270
272
System .getProperty ("java.vm.name" ), System .getProperty ("java.runtime.version" ),
271
273
usingIntelDeflater ? "Intel" : "Jdk" , usingIntelInflater ? "Intel" : "Jdk" ,
272
- pathProvidersMessage ,
274
+ requesterPays . getDescription () ,
273
275
getCommandLineParser ().getVersion ());
274
276
System .err .println (msg );
275
277
}
@@ -409,7 +411,7 @@ public CommandLineParser getCommandLineParser() {
409
411
commandLineParser = useLegacyParser () ?
410
412
new LegacyCommandLineArgumentParser (this ) :
411
413
new CommandLineArgumentParser (this ,
412
- Collections .EMPTY_LIST ,
414
+ Collections .emptyList () ,
413
415
Collections .singleton (CommandLineParserOptions .APPEND_TO_COLLECTIONS ));
414
416
}
415
417
return commandLineParser ;
@@ -427,9 +429,7 @@ public CommandLineParser getCommandLineParser() {
427
429
public static boolean useLegacyParser () {
428
430
if (useLegacyParser == null ) {
429
431
final String legacyPropertyValue = System .getProperty (PROPERTY_USE_LEGACY_PARSER );
430
- useLegacyParser = legacyPropertyValue == null ?
431
- false :
432
- Boolean .parseBoolean (legacyPropertyValue );
432
+ useLegacyParser = Boolean .parseBoolean (legacyPropertyValue );
433
433
}
434
434
return useLegacyParser ;
435
435
}
@@ -475,7 +475,7 @@ public List<Header> getDefaultHeaders() {
475
475
public static String getStandardUsagePreamble (final Class <?> mainClass ) {
476
476
return "USAGE: " + mainClass .getSimpleName () +" [options]\n \n " +
477
477
(hasWebDocumentation (mainClass ) ?
478
- "Documentation: http ://broadinstitute.github.io/picard/command-line-overview.html" +
478
+ "Documentation: https ://broadinstitute.github.io/picard/command-line-overview.html" +
479
479
mainClass .getSimpleName () + "\n \n " :
480
480
"" );
481
481
}
@@ -499,7 +499,7 @@ public static boolean hasWebDocumentation(final Class<?> clazz){
499
499
* @return the link to a FAQ
500
500
*/
501
501
public static String getFaqLink () {
502
- return "To get help, see http ://broadinstitute.github.io/picard/index.html#GettingHelp" ;
502
+ return "To get help, see https ://broadinstitute.github.io/picard/index.html#GettingHelp" ;
503
503
}
504
504
505
505
/**
0 commit comments