Skip to content

Commit b43f613

Browse files
committed
commandline options changed
1 parent 3ee09fb commit b43f613

4 files changed

Lines changed: 28 additions & 28 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ To review each of the parameters, you can type `basevar caller -h` in the Linux/
110110
$ /path/to/basevar caller -h
111111

112112
About: Call variants and estimate allele frequency by BaseVar.
113-
Usage: basevar caller [options] <-R Fasta> <--output-vcf> [-L bam.list] in1.bam [in2.bam ...] ...
113+
Usage: basevar caller [options] <-f Fasta> <--output-vcf output_file> [-L bam.list] in1.bam [in2.bam ...] ...
114114

115115
Required arguments:
116-
-R, --reference FILE Input reference fasta file.
117-
--output-vcf FILE Output VCF file.
116+
-f, --reference FILE Input reference fasta file.
117+
-o, --output FILE Output VCF file.
118118

119119
Optional options:
120120
-L, --align-file-list=FILE BAM/CRAM files list, one file per row.
@@ -127,10 +127,10 @@ Optional options:
127127
represents the number of input BAM files min(0.001000, 100/x). In most
128128
cases, users need not be overly concerned about this parameter, as it
129129
is generally handled automatically by the program.
130-
-Q, --min-BQ INT Skip bases with base quality < INT [5]
131-
-q, --mapq=INT Skip reads with mapping quality < INT [10]
132-
-B, --batch-count=INT INT simples per batchfile. [200]
133-
-t, --thread=INT Number of threads. [hardware-concurrency]
130+
-Q, --min-BQ INT Skip bases with base quality < INT [10]
131+
-q, --mapq=INT Skip reads with mapping quality < INT [5]
132+
-B, --batch-count=INT INT simples per batchfile. [500]
133+
-t, --thread=INT Number of threads. [14]
134134

135135
--filename-has-samplename If the name of bamfile is something like 'SampleID.xxxx.bam', set this
136136
argrument could save a lot of time during get the sample id from BAMfile.
@@ -145,30 +145,30 @@ This command will provide detailed information about parameters of `basevar`.
145145
### Call variants from several bamfiles
146146
147147
```bash
148-
basevar caller -R reference.fasta \
148+
basevar caller -f reference.fasta \
149149
-q 10 -Q 20 -B 500 -t 24 \
150150
--pop-group=sample_group.info \
151151
--regions=chr11:5246595-5248428,chr17:41197764-41276135 \
152-
--output-vcf test.vcf.gz 00alzqq6jw.bam 09t3r9n2rg.bam 0fkpl1p55b.bam ...
152+
--output test.vcf.gz 00alzqq6jw.bam 09t3r9n2rg.bam 0fkpl1p55b.bam ...
153153
```
154154
155155
The format of `sample_group.info` could be found [here](https://github.com/ShujiaHuang/BaseVar2/blob/main/tests/data/sample_group.info).
156156
157157
### Or call variants from bamlist
158158
159159
```bash
160-
basevar caller -R reference.fasta \
160+
basevar caller -f reference.fasta \
161161
-q 10 -Q 20 -B 500 -t 24 \
162162
-L bamfile.list \
163163
--regions=chr11:5246595-5248428,chr17:41197764-41276135 \
164164
--pop-group=sample_group.info \
165-
--output-vcf test.vcf.gz
165+
--output test.vcf.gz
166166
```
167167
168168
For stramlinened variant calling across the entire genome, you can use the pipeline generator [**create_pipeline.py**](https://github.com/ShujiaHuang/BaseVar2/blob/main/scripts/create_pipeline.py), which distributes the computational tasks based on the --delta parameter across a specific chromosome defined by the -c parameter.
169169
170170
```bash
171-
python create_pipeline.py -Q 20 -q 10 -R reference.fa --ref_fai reference_fa.fai -c chr20 --delta 5000000 -t 24 -L bamfile.list -o outdir > basevar.chr20.sh
171+
python create_pipeline.py -Q 20 -q 10 -f reference.fa --ref_fai reference_fa.fai -c chr20 --delta 5000000 -t 24 -L bamfile.list -o outdir > basevar.chr20.sh
172172
```
173173
174174
**BaseVar** is under active development. Obtain the newest version by pulling the newest version and compilling again.

scripts/create_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ def creat_basetype_pipe():
8282
if opt.pop_group:
8383
print(f'time {exe_prog} -t {opt.n_thread} -f {opt.reference} -L {opt.infilelist} '
8484
f'-G {opt.pop_group} -r {reg} --min-af={opt.min_af} -q {opt.mapq} -Q {opt.min_bq} '
85-
f'--output-vcf {opt.outdir}/{outfile_prefix}.vcf.gz --smart-rerun '
85+
f'--output {opt.outdir}/{outfile_prefix}.vcf.gz --smart-rerun '
8686
f'> {opt.outdir}/{outfile_prefix}.log && '
8787
f'echo "** {outfile_prefix} done **"')
8888
else:
8989
print(f'time {exe_prog} -t {opt.n_thread} -f {opt.reference} -L {opt.infilelist} '
9090
f'-r {reg} --min-af={opt.min_af} -q {opt.mapq} -Q {opt.min_bq} '
91-
f'--output-vcf {opt.outdir}/{outfile_prefix}.vcf.gz --smart-rerun '
91+
f'--output {opt.outdir}/{outfile_prefix}.vcf.gz --smart-rerun '
9292
f'> {opt.outdir}/{outfile_prefix}.log && '
9393
f'echo "** {outfile_prefix} done **"')
9494

src/basetype_caller.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
const std::string BaseTypeRunner::usage() const {
1212
static const std::string BASETYPE_CALLER_USAGE =
1313
"About: Call variants and estimate allele frequency by BaseVar.\n"
14-
"Usage: basevar caller [options] <-R Fasta> <--output-vcf> [-L bam.list] in1.bam [in2.bam ...] ...\n\n"
14+
"Usage: basevar caller [options] <-f Fasta> <--output-vcf output_file> [-L bam.list] in1.bam [in2.bam ...] ...\n\n"
1515

1616
"Required arguments:\n"
17-
" -R, --reference FILE Input reference fasta file.\n"
18-
" -O, --output-vcf FILE Output VCF file.\n\n"
17+
" -f, --reference FILE Input reference fasta file.\n"
18+
" -o, --output FILE Output VCF file.\n\n"
1919

2020
"Optional options:\n"
2121
" -L, --align-file-list=FILE BAM/CRAM files list, one file per row.\n"
@@ -54,8 +54,8 @@ BaseTypeRunner::BaseTypeRunner(int cmd_argc, char *cmd_argv[]) {
5454
static const struct option BASETYPE_CMDLINE_LOPTS[] = {
5555
// Optional arguments to long style command line parameters require 'equals sign' (=).
5656
// https://stackoverflow.com/questions/1052746/getopt-does-not-parse-optional-arguments-to-parameters
57-
{"reference", required_argument, NULL, 'R'},
58-
{"output-vcf", required_argument, NULL, 'O'},
57+
{"reference", required_argument, NULL, 'f'},
58+
{"output", required_argument, NULL, 'o'},
5959
{"align-file-list", optional_argument, NULL, 'L'},
6060

6161
{"min-af", optional_argument, NULL, 'm'},
@@ -84,12 +84,12 @@ BaseTypeRunner::BaseTypeRunner(int cmd_argc, char *cmd_argv[]) {
8484

8585
char c;
8686
std::vector<std::string> bv;
87-
while((c = getopt_long(cmd_argc, cmd_argv, "L:R:O:m:q:Q:B:t:r:G:h", BASETYPE_CMDLINE_LOPTS, nullptr)) >= 0) {
87+
while((c = getopt_long(cmd_argc, cmd_argv, "L:f:o:m:q:Q:B:t:r:G:h", BASETYPE_CMDLINE_LOPTS, nullptr)) >= 0) {
8888
// 字符流解决命令行参数转浮点等类型的问题
8989
std::stringstream ss(optarg ? optarg: "");
9090
switch (c) {
91-
case 'R': _args->reference = optarg; break; /* 临参 */
92-
case 'O': _args->output_vcf = optarg; break; // 恒参
91+
case 'f': _args->reference = optarg; break; /* 临参 */
92+
case 'o': _args->output_vcf = optarg; break; // 恒参
9393
case 'L':
9494
bv = ngslib::get_firstcolumn_from_file(optarg);
9595
_args->input_bf.insert(_args->input_bf.end(),
@@ -124,9 +124,9 @@ BaseTypeRunner::BaseTypeRunner(int cmd_argc, char *cmd_argv[]) {
124124
if (_args->input_bf.empty())
125125
throw std::invalid_argument("[ERROR] Missing required BAM/CRAM files.");
126126
if (_args->reference.empty())
127-
throw std::invalid_argument("[ERROR] Missing argument '-R/--reference'");
127+
throw std::invalid_argument("[ERROR] Missing argument '-f/--reference'");
128128
if (_args->output_vcf.empty())
129-
throw std::invalid_argument("[ERROR] Missing argument '--output-vcf'");
129+
throw std::invalid_argument("[ERROR] Missing argument '-o/--output-vcf'");
130130

131131
if (_args->min_af < 0)
132132
throw std::invalid_argument("[ERROR] '-m/--min-af' argument must be > 0");
@@ -147,7 +147,7 @@ BaseTypeRunner::BaseTypeRunner(int cmd_argc, char *cmd_argv[]) {
147147
// Output the commandline options
148148
std::cout <<
149149
"[INFO] BaseVar arguments:\n"
150-
"basevar caller -R "+ _args->reference + " \\ \n"
150+
"basevar caller -f "+ _args->reference + " \\ \n"
151151
" -Q " << _args->min_baseq << " \\ \n"
152152
" -q " << _args->min_mapq << " \\ \n"
153153
" -m " << _args->min_af << " \\ \n"

tests/data/work.log.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
../../bin/basevar caller --mapq=10 --min-af=0.05 --batch-count=1 --thread=1 --regions=CHROMOSOME_I:900-1200 --pop-group=sample_group.info --output-vcf vz.vcf --output-cvg t.cvg -R ce.fa.gz -I range.bam -I range.cram -I range.bam --filename-has-samplename
1+
../../bin/basevar caller --min-mapq=10 --min-af=0.05 --batch-count=1 --thread=1 --regions=CHROMOSOME_I:900-1200 --pop-group=sample_group.info --output vz.vcf -f ce.fa.gz --filename-has-samplename range.bam range.cram range.bam
22

33
#chr11:5246595-5248428,chr13:32890633-32972781,chr16:222869-227506,chr17:41197764-41276135
44
# long options
5-
../../bin/basevar caller --min-BQ=0 --min-mapq=10 --min-af=0.05 --batch-count=20 --thread=4 --regions=chr11:5246595-5248428,chr17:41197764-41276135 --pop-group=sample_group.info --output-vcf tt.vcf.gz -R ~/Projects/BaseVar/tests/data/hg19.NC_012920.fasta.gz -L bam90.list bam100/00alzqq6jw.bam bam100/09t3r9n2rg.bam bam100/0fkpl1p55b.bam bam100/13dg1gvsfk.bam bam100/17phildszl.bam bam100/1dbpgqt0dq.bam bam100/1kyws27hoc.bam bam100/1ych8rmufr.bam bam100/4e56w6ezsx.bam bam100/51rwla2fps.bam > log2
5+
../../bin/basevar caller --min-BQ=0 --min-mapq=10 --min-af=0.05 --batch-count=20 --thread=4 --regions=chr11:5246595-5248428,chr17:41197764-41276135 --pop-group=sample_group.info --output tt.vcf.gz -f ~/Projects/BaseVar/tests/data/hg19.NC_012920.fasta.gz -L bam90.list bam100/00alzqq6jw.bam bam100/09t3r9n2rg.bam bam100/0fkpl1p55b.bam bam100/13dg1gvsfk.bam bam100/17phildszl.bam bam100/1dbpgqt0dq.bam bam100/1kyws27hoc.bam bam100/1ych8rmufr.bam bam100/4e56w6ezsx.bam bam100/51rwla2fps.bam > log2
66

77
# short options
8-
ulimit -n 100000 && ../../bin/basevar caller -Q 0 -q 10 -m 0.05 -B 20 -t 4 -r chr11:5246595-5248428,chr17:41197764-41276135 -G sample_group.info --output-vcf tt.vcf -R ~/Projects/BaseVar/tests/data/hg19.NC_012920.fasta.gz -L bam90.list bam100/00alzqq6jw.bam bam100/09t3r9n2rg.bam bam100/0fkpl1p55b.bam bam100/13dg1gvsfk.bam bam100/17phildszl.bam bam100/1dbpgqt0dq.bam bam100/1kyws27hoc.bam bam100/1ych8rmufr.bam bam100/4e56w6ezsx.bam bam100/51rwla2fps.bam
8+
ulimit -n 100000 && ../../bin/basevar caller -Q 0 -q 10 -m 0.05 -B 20 -t 4 -r chr11:5246595-5248428,chr17:41197764-41276135 -G sample_group.info -o tt.vcf -f ~/Projects/BaseVar/tests/data/hg19.NC_012920.fasta.gz -L bam90.list bam100/00alzqq6jw.bam bam100/09t3r9n2rg.bam bam100/0fkpl1p55b.bam bam100/13dg1gvsfk.bam bam100/17phildszl.bam bam100/1dbpgqt0dq.bam bam100/1kyws27hoc.bam bam100/1ych8rmufr.bam bam100/4e56w6ezsx.bam bam100/51rwla2fps.bam
99

1010
# subsam
1111
../../bin/basevar subsam -i tt.vcf~ -o t.vcf 5ffp4ybnks 9jikb1nr7d

0 commit comments

Comments
 (0)