xryanglab / RiboCode

release version
MIT License
48 stars 15 forks source link

KeyError while reading BAM #18

Closed boboppie closed 5 years ago

boboppie commented 5 years ago

Dear developers,

I'm having the following error message:

Traceback (most recent call last):
  File "/home/huf/.local/bin/RiboCode", line 11, in <module>
    sys.exit(main())
  File "/home/huf/.local/lib/python2.7/site-packages/RiboCode/RiboCode.py", line 40, in main
    tpsites_sum, total_psites_number = process_bam.psites_count(configIn.configList,transcript_dict,thread_num=1)
  File "/home/huf/.local/lib/python2.7/site-packages/RiboCode/process_bam.py", line 111, in psites_count
    tpsites_sum,total_psites_number = read_bam(configList[0])
  File "/home/huf/.local/lib/python2.7/site-packages/RiboCode/process_bam.py", line 77, in read_bam
    tpsites[tid][t_psite] += 1
KeyError: 'ENSMUST00000035606.8'

I even sorted the bam, but it gave me the same error for a different transcript Id. Do you know where possibly goes wrong?

Best wishes, Fengyuan

zhengtaoxiao commented 5 years ago

Hi, this error means the transcript id "ENSMUST00000035606.8" is not in the GTF file or annotation file generated by “prepare_transcripts.py”. Make sure it can be found in the gtf file (grep ENSMUST00000035606.8 your_gtf_file) and use this correct gtf file as the input of "prepare_transcripts.py".

And also notice: The GTF file required by RiboCode should include three-level hierarchy annotations: genes,transcripts and exons. Some GTF files may lack the gene and transcript annotations, users can added these annotations by using the "GTFupdate" command in RiboCode. Please refer to GTF_update.rst for more information.

boboppie commented 5 years ago

Dear @xzt41 ,

Thank you for the reply. Yes, it seems I messed up my annotation.