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

argparse bug when running consolidate #78

Open
racng opened this issue Sep 28, 2024 · 0 comments
Open

argparse bug when running consolidate #78

racng opened this issue Sep 28, 2024 · 0 comments

Comments

@racng
Copy link

racng commented Sep 28, 2024

After succesfully running demultiplex and unitag, I tried running consolidate step with the following command:

SAMPLE=test
guideseq.py consolidate \
    --read1 $WORKDIR/umitagged/${SAMPLE}.r1.umitagged.fastq \
    --read2 $WORKDIR/umitagged/${SAMPLE}.r2.umitagged.fastq \
    --outfolder $WORKDIR 

I got the following error

[09/27 07:33:18PM][INFO][guideseq_cmd] Consolidating reads...
[09/27 07:33:18PM][ERROR][guideseq_cmd] Error umitagging
[09/27 07:33:18PM][ERROR][guideseq_cmd] Traceback (most recent call last):
  File "/users/rng/mambaforge/envs/guideseq/lib/python3.7/site-packages/guideseq/guideseq_cmd.py", line 186, in consolidate
    consolidate.consolidate(self.umitagged[sample]['read1'], self.consolidated[sample]['read1'], min_qual, min_freq)
  File "/users/rng/mambaforge/envs/guideseq/lib/python3.7/site-packages/umi/consolidate.py", line 92, in consolidate
    consolidation_sucess, cons_seq, cons_qual = zip(*[consolidate_position(bases, quals, min_qual, min_freq) for bases, quals in zip(read_bases, read_quals)])
  File "/users/rng/mambaforge/envs/guideseq/lib/python3.7/site-packages/umi/consolidate.py", line 92, in <listcomp>
    consolidation_sucess, cons_seq, cons_qual = zip(*[consolidate_position(bases, quals, min_qual, min_freq) for bases, quals in zip(read_bases, read_quals)])
  File "/users/rng/mambaforge/envs/guideseq/lib/python3.7/site-packages/umi/consolidate.py", line 49, in consolidate_position
    if qq > min_qual:
TypeError: '>' not supported between instances of 'int' and 'NoneType'

I then investigated this by calling consolidate from umi.consolidate directly in a python environment and didn't run into an error.

I then looked into the guideseq.py script that handles command line arguments. I modified the script to print out the values of min_qual and min_freq before it runs g.consolidate(...). Turns out both values are None.
In the following lines, the conditional is evaluated as True, even when these optional arguments are not provided.

        if 'min_quality' in args:
            min_qual = args.min_quality
        else:
            min_qual = CONSOLIDATE_MIN_QUAL

        if 'min_frequency' in args:
            min_freq = args.min_frequency
        else:
            min_freq = CONSOLIDATE_MIN_FREQ

The program works after I have changed these lines to the following:

        if args.min_quality is not None:
            min_qual = args.min_quality
        else:
            min_qual = CONSOLIDATE_MIN_QUAL

        if args.min_frequency is not None:
            min_freq = args.min_frequency
        else:
            min_freq = CONSOLIDATE_MIN_FREQ
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

1 participant