PMBio / MetH5Format

HDF5-based container format for Methylation calls from long reads
MIT License
7 stars 2 forks source link

BAM file conversion #2

Open e-sollier opened 1 year ago

e-sollier commented 1 year ago

Hi Rene,

Is there any update converning the conversion from modbam (with MM and ML tags) to meth5 ? The readme mentions that this conversion is not yet operational, and the pysam issue https://github.com/pysam-developers/pysam/issues/1123 does not seem to be resolved. Since nanopolish does not support the latest R10.4 chemistry and that dorado/remora is now the standard way to get nanopore methylation calls, it would really be nice to be able to use meth5 and pycometh with the modbams generated by remora.

starsyi commented 1 year ago

Hi, Rene, I have also encountered the same issue and I don't know when we can update the direct conversion of dorado/remora BAM files.

snajder-r commented 1 year ago

Hi @starsyi, as you noticed the pysam issue hasn't been updated. But the conversion using the MetH5 CLI should theoretically work out-of-the-box as soon as the issue in pysam is fixed and pysam is updated, so no further changes in MetH5 should be required (unless of course the update breaks something else).

jazsakr commented 9 months ago

Nanopore's package modkit has a subcommand called adjust-mods that will change the ? flag to . in bam files. I changed the MM flag in my bam file and but when I tried to use meth5 convert, I got this error: meth5: error: argument subcommand: invalid choice: 'convert' (choose from 'create_m5', 'merge_m5', 'annotate_reads', 'list_chunks', 'bedgraph', 'region_stats').

snajder-r commented 9 months ago

Hi, @jazsakr. Did you try this with the release version (R1.1.1) or the main branch in the git repository (R1.2.0)? The convert subcommand has been introduced in R1.2.0, but I haven't made a conda/pypi package for that yet. You would have to clone it from the git repository and install it manually.

jazsakr commented 9 months ago

I created a conda env on HPC cluster and then tried to install it. When I ran python setup.py install I got this error:

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python3.6'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python3.6/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

I don't have much experience manually installing packages. Which directory do I specify?

snajder-r commented 9 months ago

Dear @jazsakr, Looks like you don't have python installed in your new conda environment yet.

After activating your conda environment, run:

conda install python==3.8
git clone https://github.com/PMBio/MetH5Format
cd MetH5Format
pip install .
DavYang commented 9 months ago

Hi @snajder-r,

Is meth5 convert equipped to properly handle haplotagged pacbio bam files? I am currently trying to run pycometh on pacbio files and was wondering how the conversion deals with the haplotype and DNA methylation data in a PacBio bam for comparing methylation between alleles within a sample.