Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsure about usage of --pseudo-strain #40

Closed
4 tasks done
standage opened this issue Jan 26, 2021 · 3 comments
Closed
4 tasks done

Unsure about usage of --pseudo-strain #40

standage opened this issue Jan 26, 2021 · 3 comments

Comments

@standage
Copy link

Consider the following two commands.

$ echo 36827 | taxonkit lineage | taxonkit reformat --add-prefix --format '{k};{p};{c};{o};{f};{g};{s};{T}'
36827   cellular organisms;Bacteria;Terrabacteria group;Firmicutes;Clostridia;Clostridiales;Clostridiaceae;Clostridium;Clostridium botulinum;Clostridium botulinum B        k__Bacteria;p__Firmicutes;c__Clostridia;o__Clostridiales;f__Clostridiaceae;g__Clostridium;s__Clostridium botulinum;T__
$ echo 36827 | taxonkit lineage | taxonkit reformat --add-prefix --format '{k};{p};{c};{o};{f};{g};{s};{T}' --pseudo-strain
36827   cellular organisms;Bacteria;Terrabacteria group;Firmicutes;Clostridia;Clostridiales;Clostridiaceae;Clostridium;Clostridium botulinum;Clostridium botulinum B        k__Bacteria;p__Firmicutes;c__Clostridia;o__Clostridiales;f__Clostridiaceae;g__Clostridium;s__Clostridium botulinum;T__

The lowest taxon in this lineage is below species and has no rank, so I expected the --pseudo-strain to report the name of this taxon as the strain. It doesn't work with {T} or {t}. Am I doing something wrong?


Prerequisites

  • make sure you're are using the latest version by taxonkit version
  • read the usage

Describe your issue

  • describe the problem
  • provide a reproducible example
@shenwei356
Copy link
Owner

missing -F :)

shenwei356 added a commit that referenced this issue Jan 27, 2021
@shenwei356
Copy link
Owner

I improve the flag checking.

if `{t}/{S}/{T}` found in `--format` {
    if `-S/--pseudo-strain` is on, but `-F/--fill-miss-rank` not given {
        log.info()
        turn on `-F`
    }  
} else if `-S/--pseudo-strain` is on {
    log.warning()
}

Example:

$ echo 36827 \
        | taxonkit lineage \
        | taxonkit reformat --add-prefix --format '{g};{s};{t}'  --pseudo-strain --fill-miss-rank \
        | cut -f 1,3
36827   g__Clostridium;s__Clostridium botulinum;t__Clostridium botulinum B

$ echo 36827 \
    | taxonkit lineage \
    | taxonkit reformat --add-prefix --format '{g};{s};{t}'  --pseudo-strain \
    | cut -f 1,3
08:36:01.750 [INFO] -F/--fill-miss-rank is switched on when giving flag -S/--pseudo-strain
36827   g__Clostridium;s__Clostridium botulinum;t__Clostridium botulinum B

$ echo 36827 \
    | taxonkit lineage \
    | taxonkit reformat --add-prefix --format '{g};{s}'  --pseudo-strain \
    | cut -f 1,3
08:35:01.515 [WARN] flag -S/--pseudo-strain will not work because none of "{t}", "{S}", "{T}" is found in -f/--format
36827   g__Clostridium;s__Clostridium botulinum

@standage
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants