rrazaghi / modbamtools

Set of tools to manipulate and visualize modified base bam files
Apache License 2.0
49 stars 4 forks source link

error loading taidx file #10

Closed DiegoZavallo closed 2 years ago

DiegoZavallo commented 2 years ago

Hi! I´m usign modbamtools and it works really good! I want to add some tracks for genes but I don´t have a gff or bed file for this organism. I do have a transcriptome, so what I did was to mapped to the genome, convert the sam to bam (sorted and index) and then converted to bed. Then bgziped and make the taidx with: tabix -p bed Pnotatum_transcriptome.bed.gz

Then I ran modbamtools: modbamtools plot -b ../Data/Pnotatum_transcriptome.bed.gz.tbi -r CM039690.1:41885620-42624712 -o ./modbamtools/ ./megalodon_results_Q4188/mod_mappings_sorted.bam ./megalodon_results_Q4117/mod_mappings_sorted.bam ./megalodon_results_R1/mod_mappings_sorted.bam -s Q4188,Q4117,R1 -h 500 but I have this error:

Traceback (most recent call last):
  File "/usr/local/bin/modbamtools", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/cli.py", line 300, in plot
    fig = Plotter(
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/modbamviz.py", line 36, in __init__
    self.tracks, self.num_tracks = get_tracks(
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/tracks.py", line 223, in get_tracks
    elements = parse_bed_rectangle(bed, chrom, start, end)
  File "/usr/local/lib/python3.8/dist-packages/modbamtools/gene_models.py", line 189, in parse_bed_rectangle
    bed = pysam.TabixFile(bed_path)
  File "pysam/libctabix.pyx", line 350, in pysam.libctabix.TabixFile.__cinit__
  File "pysam/libctabix.pyx", line 382, in pysam.libctabix.TabixFile._open
OSError: index `../Data/Pnotatum_transcriptome.bed.gz.tbi.tbi` not found

Why it said that I don´t have the Pnotatum_transcriptome.bed.gz.tbi.tbi file? why with 2 .tbi.tbi?

Maybe I did made a mistake from the .sam to the .tbi? Could you look at mi taidx file if something is missing? I also attach the bed.gz file Pnotatum_transcriptome.zip

Thanks!

Diego

rrazaghi commented 2 years ago

I believe you have provided the tabix index file in your modbamtools -b option. you should have the file itself ending in .gz and the program will automatically look for the index file with the added .tbi extension.

DiegoZavallo commented 2 years ago

Hi! sorry to bother you again. You're right, I was loading the .tbi file instead of the .gz one. I have a couple of question: 1)Is there a way to add the name of each transcript from the trasncriptome.bed file so they appear in the modbamviz.html? 2) each box represent a C on a CpG context right? the lines between each box correspond to the sequences of the reads with out any CpG? 3) How do you know when the modification correspond to 5hmC or 5mC in the red boxes?

thanks!

Diego

rrazaghi commented 2 years ago

Hi!

  1. This is not implemented in bed option currently. But gtf option takes care of this!
  2. yes each box indicates a modified/unmodified base and the lines are indicating the read length boundaries.
  3. currently there are not context dependent coloring scheme. I hope to add this in the near future