bcgsc / pavfinder

:mag: Post Assembly Variants Finder
Other
17 stars 5 forks source link

error in cmp_genome_coords: '<' not supported between instances of 'str' and 'int' #18

Closed rhalperin closed 2 years ago

rhalperin commented 2 years ago

Running the find_sv_transcriptome.py script, I am seeing the error below. By adding some print statements, it appears to be trying to compare chromosome 'X/Y' to autosomes.

Traceback (most recent call last):
 File "/opt/conda/bin/find_sv_transcriptome.py", line 259, in <module>
    main()
  File "/opt/conda/bin/find_sv_transcriptome.py", line 257, in main
    Adjacency.report_events(events_filtered, '{}/sv.bedpe'.format(args.outdir), sort_by_coord=args.sort_by_coord, header=(software, '{} {}'.format(time, cmd)))
  File "/opt/conda/lib/python3.8/site-packages/pavfinder/transcriptome/adjacency.py", line 542, in report_events
    events_sorted = sorted(events_grouped[event_type], key=cmp_to_key(compare_event))
  File "/opt/conda/lib/python3.8/site-packages/pavfinder/transcriptome/adjacency.py", line 506, in compare_event
    cmp_coord_result = cls.cmp_genome_coords((e1.chroms[0], e1.genome_breaks[0], e1.genome_breaks[1]),
  File "/opt/conda/lib/python3.8/site-packages/pavfinder/transcriptome/adjacency.py", line 626, in cmp_genome_coords
    if chrom1 < chrom2:
TypeError: '<' not supported between instances of 'str' and 'int'
readmanchiu commented 2 years ago

Thanks for reporting the issue. Surprised to see this bug considering I've processed many samples with results reported in both the autosome and chrX. May I ask what version you are using? Are your chromosome names prefixed with "chr"?

rhalperin commented 2 years ago

I am using pavfinder 1.8.1. My chromosome names do not have the "chr" prefix. The following edits to adjacency.py fixes the issue:

613             if chrom.isdigit():
614                 return None, int(chrom)
615             elif chrom=="X":
616                 return None, 23
617             elif chrom=="Y":
618                 return None,24
619             else:
readmanchiu commented 2 years ago

ok, thanks, I'll give this a try and incorporate your fix if everything's ok

rhalperin commented 2 years ago

@readmanchiu have you gotten a chance to look at this yet?

readmanchiu commented 2 years ago

Sorry for the late reply, I've introduced some changes to fix the bug. Please download again and run to check if the bug is fixed. Thanks for your test in advance!

rhalperin commented 2 years ago

Sorry, for the delay - just realized I hadn't replied. Yes this appears fixed. Thanks for your help!