Comments (9)
Scratch that, the problem was somewhere else!
from amalgkit.
Pushed the update here:
closing this for now, then.
from amalgkit.
yes/no options can be stored as bool using strtobool. Please check csubst for example.
from amalgkit.
I introduced strtobool for --tissue_detect as an example. Please check and apply it for other options.
f85b762
from amalgkit.
Just to add to this, I think we can simplify usage as well for arguments that use 'yes|no'. For example amalgkit getfastq --redo yes
can be reduced to just amalgkit getfastq --redo
, while amalgkit getfastq --redo no
would just be amalgkit getfastq
without the option.
from amalgkit.
I'm not positive about that. Here's how I often end up...
- Didn't work:
my_progrem -i infile --hard-to-remember-flag
- Didn't work either:
my_progrem -i infile
- Found another flag is important:
my_progrem -i infile --another-flag
- Went program website to remember what was the flag I tried first
- Worked well:
my_progrem -i infile --another-flag --hard-to-remember-flag
If it's like --hard-to-remember-flag yes
, we don't have to open a webpage or print a very long help message every time we tweak the parameters.
from amalgkit.
So I don't 100% get how strtobool interacts with argparse. I assumed it would convert argument input yes
to True
and input no
to False
. So a flag --flag1
would be False
if the default
was no
and there wasn't any additional input.
Assuming --flag1 no
, in the code I could then ask:
if args.flag1:
print("true!")
else:
print("false!")
instead of
if args.flag1 == 'yes':
...
correct?
I switched the getfastq download flags to strtobool like this:
pge.add_argument('--aws', metavar='yes|no', default='no', type=strtobool, required=False, action='store',
help='default=%(default)s: Download SRA files from Amazon Cloud (AWS), if available.')
But when getting args.aws
inside getfastq
, they are still stored as 'yes' and 'no`, rather than 'true' or 'false'.
This is actually not true, they were stored as 1 or 0.
from amalgkit.
I went through all of amalgkit to convert everything to strtobool
where there are yes|no
options.
I also introduced parent parsers to eliminate repeated code.
I couldn't figure out a way to do this with a single parent parser holding all the shared options. For example:
--out_dir
is by every subcommand.
--metadata
is used by most subcommands.
But putting both --out_dir
and --metadata
in the same parent parser, both options would show up for example for amalgkit metadata -h
, which does have --out_dir
but does not have --metadata
.
So I put those options into different parent parsers parent_parser_out
and parent_parser_meta
. These can then be combined in any way for the specific subparsers, like so:
# Sub parser: integrate
pin = subparsers.add_parser('integrate', help='see `amalgkit proc -h`', parents=[parent_parser_out, parent_parser_meta, parent_parser_threads])
[...] subparser specific arguments
# Sub parser: sanity
psa = subparsers.add_parser('sanity', help='see `amalgkit sanity -h`', parents=[parent_parser_out, parent_parser_meta])
[...] subparser specific arguments
# Sub parser: curate
pcu = subparsers.add_parser('curate', help='see `amalgkit curate -h`', parents=[parent_parser_out, parent_parser_meta, parent_parser_batch])
[...] subparser specific arguments
from amalgkit.
Sounds good!
from amalgkit.
Related Issues (20)
- is_unpaird_file --> is_unpaired_file? HOT 1
- print('layout = {}; Deleting unpaired file: {}'.format(sra_stat['layout'], unpaired_file)) NameError: name 'unpaired_file' is not defined HOT 3
- getfastq OSError: [Errno 5] Input/output error: HOT 1
- amalgkit getfastq on folder with already-processed samples is re-running HOT 13
- merge plot HOT 1
- mapping rate and cstmm factor in the curate SV predictive power plot HOT 1
- use seqkit instead of pigz to compress fastq
- Effect of negative value clipping in log(x+1) values HOT 1
- FutureWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. HOT 1
- ValueError: No objects to concatenate
- amalgkit curate --h HOT 1
- Obsoleting search_term_*.config HOT 3
- Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length
- Code for rRNA rate HOT 2
- Error in if (child1_color == child2_color) { :
- Output uncorrected tables without going through all of curate HOT 3
- cstmm - curate incompatibility HOT 4
- Metadata example command HOT 3
- Duplication rate and insert size peak from the fastp json report
- curate_group -> sample_group HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amalgkit.