Skip to content

[BUG] speficying unstranded data ('no') leads to error #153

@pinin4fjords

Description

@pinin4fjords
  • ribotricer version: 1.3.3
  • Operating System: Linux

Description

Just experimenting with --stranded

What I Did

ribotricer detect-orfs \
    --bam SRX11780888_chr20.bam \
    --ribotricer_index homo_sapiens_chr20_candidate_orfs.tsv \
    --stranded no \
    --prefix test \
    --phase_score_cutoff 0.05

Error:

Mar 14 10:56:30 ..... started ribotricer detect-orfs
Mar 14 10:56:30 ... started parsing ribotricer index file
Mar 14 10:56:30 ... started reading bam file                                                                                                                                               
[W::hts_idx_load3] The index file is older than the data file: SRX11780888_chr20.bam.bai
  0%|                                                                                                                                                        | 0/566761 [00:00<?, ?reads/s][W::hts_idx_load3] The index file is older than the data file: SRX11780888_chr20.bam.bai
no
Traceback (most recent call last):                                                                                                                                                         
  File "/path/to/mambaforge/envs/ribotricer/bin/ribotricer", line 10, in <module>
    sys.exit(cli())
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/ribotricer/cli.py", line 244, in detect_orfs_cmd
    detect_orfs(
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/ribotricer/detect_orfs.py", line 400, in detect_orfs
    alignments, read_length_counts = split_bam(bam, protocol, prefix, read_lengths)
  File "/path/to/mambaforge/envs/ribotricer/lib/python3.10/site-packages/ribotricer/bam.py", line 122, in split_bam
    alignments[length][strand][(chrom, pos + 1)] += 1
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Without looking too hard it seems that pos does not get defined for unstranded data here.

Input files:

test_files.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions