deepTools icon indicating copy to clipboard operation
deepTools copied to clipboard

AttributeError: 'list' object has no attribute 'name'

Open szakallasn3 opened this issue 10 months ago • 1 comments

Hi. I try to compare two .bam files. The inputs are sorted and indexed. They were aligned to the same reference genome: GRCh38. I assume that It is important to mention, that these .bams corresponds to the same sample, but one of them earned by Nanopore and one by Illumina sequencing. My goal is to summarize the overlapping regions.

When I try to run the following code: bamCompare -b1 file1.bam -b2 file2.bam -o output.log2ratio.bw

I got this error message:

File "/opt/anaconda3/bin/bamCompare", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/deeptools/bamCompare.py", line 310, in main
    wr.run(FUNC, func_args, args.outFileName, blackListFileName=args.blackListFileName, format=args.outFileFormat, smoothLength=args.smoothLength)
  File "/opt/anaconda3/lib/python3.12/site-packages/deeptools/writeBedGraph.py", line 134, in run
    chrom_names_and_size, non_common = getCommonChrNames(bam_handles, verbose=False)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/deeptools/utilities.py", line 209, in getCommonChrNames
    "lengths from file\n{}\n".format(bamFileHandles.name))
                                     ^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'name'

Do you have any suggestion regarding this issue?

szakallasn3 avatar Mar 05 '25 07:03 szakallasn3

This indeed is a bug in the error reporting, but the underlying problem is that there are no common chromosomes in file1.bam and file2.bam, you should double check that..

WardDeb avatar Mar 05 '25 15:03 WardDeb