DeepMod2 icon indicating copy to clipboard operation
DeepMod2 copied to clipboard

Empty output.per_site.aggregated and output.per_site files

Open MH-Raza opened this issue 1 year ago • 1 comments

Hello,

I am using DeepMod 2 to detect methylation from pod5s produced using nanopore sequencing. However, the output.per_site.aggregated and output.per_site files are empty.

I am following the tutorial described here with a few modifications in the commands- https://github.com/WGLab/DeepMod2/blob/main/docs/Example.md#1-methylation-calling-from-pod5-files-with-dorado-basecalling

For base-calling

dorado basecaller --emit-moves --recursive --reference chr1.fa hac,5mCG_5hmCG ./pod5s > pcalls.bam [2025-01-22 10:46:56.221] [info] Running: "basecaller" "--emit-moves" "--recursive" "--reference" "chr1.fa" "hac,5mCG_5hmCG" "./pod5s" [2025-01-22 10:46:56.356] [info] Failed to load NVML [2025-01-22 10:46:57.018] [info] - downloading [email protected] with httplib [2025-01-22 10:46:59.630] [info] - downloading [email protected]_5mCG_5hmCG@v3 with httplib [2025-01-22 10:47:01.918] [info] Normalised: chunksize 10000 -> 9996 [2025-01-22 10:47:01.918] [info] Normalised: overlap 500 -> 498 [2025-01-22 10:47:01.918] [info] > Creating basecall pipeline [2025-01-22 10:52:43.908] [info] > Finished in (ms): 330616 [2025-01-22 10:52:43.908] [info] > Simplex reads basecalled: 165 [2025-01-22 10:52:43.908] [info] > Basecalled @ Samples/s: 3.062485e+04 [2025-01-22 10:52:44.151] [info] > Finished

For deepmod2

BAM_INPUT=./pcalls.bam

python ./tools/DeepMod2/deepmod2 detect --model bilstm_r10.4.1_5khz_v4.3 --file_type pod5 --bam $BAM_INPUT --input ./pod5s --output ./01222025/ --ref chr1.fa --t hreads 8 --seq_type dna 2025-01-22 10:53:39.997963: Starting DeepMod2.

2025-01-22 10:53:40.008563: Command: python ./tools/DeepMod2/deepmod2 detect --model bilstm_r10.4.1_5khz_v4.3 --file_type pod5 --bam ./pcalls.bam --input ./pod5s --output ./01222025/ --ref chr1.fa --threads 8 --seq_type dna

2025-01-22 10:53:40.630131: Starting Per Read Methylation Detection. 2025-01-22 10:53:40.686920: Getting motif positions from the reference. 2025-01-22 10:53:46.495379: Finished getting motif positions from the reference. 2025-01-22 10:53:46.561455: Building BAM index. 2025-01-22 10:53:46.593760: Finished building BAM index. /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') /mnt/c/dnmta/tools/DeepMod2/src/utils.py:89: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(model_path, map_location ='cpu') 2025-01-22 10:53:49.037518:Reading inputs complete. 2025-01-22 10:53:57.465430: Model predictions complete. Wrapping up output. 2025-01-22 10:53:57.496394: Number of reads processed: 165 2025-01-22 10:53:57.496597: Finished Per-Read Methylation Output. Starting Per-Site output. 2025-01-22 10:53:57.496667: Modification Tagged BAM file: ./01222025/output.bam 2025-01-22 10:53:57.496696: Per Read Prediction file: ./01222025/output.per_read 2025-01-22 10:53:57.496756: Writing Per Site Methylation Detection. 2025-01-22 10:53:57.506220: Finished Writing Per Site Methylation Output. 2025-01-22 10:53:57.506371: Per Site Prediction file: ./01222025/output.per_site 2025-01-22 10:53:57.506424: Aggregated Per Site Prediction file: ./01222025/output.per_site.aggregated

2025-01-22 10:53:57.524048: Time elapsed=17.5261s

Output of output.per_read

head ./01222025/output.per_read read_name chromosome ref_position_before ref_position read_position strand methylation_score mean_read_qscore read_length read_phase ref_motif 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 84 + 0.9174 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 147 + 0.0092 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 516 + 0.2821 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 531 + 0.3869 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 571 + 0.8131 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 757 + 0.1611 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 763 + 0.3817 3.36 1131 0 False 440058c0-b21b-4d58-a9c8-bd8c7565d55b NA NA NA 773 + 0.2967 3.36 1131 0 False 86c825fc-de5b-4565-ac7f-6f0777c1c944 NA NA NA 28 + 0.0583 2.89 1329 0 False

Output of output.per_site

printf 'chr1\t200\t700'|bedtools intersect -header -a ./01222025/output.per_site -b -|head #chromosome position_before position strand ref_cpg coverage mod_coverage unmod_coverage mod_fraction coverage_phase1 mod_coverage_phase1 unmod_coverage_phase1 mod_fraction_phase1 coverage_phase2 mod_coverage_phase2 unmod_coverage_phase2 mod_fraction_phase2

Output of output.per_site.aggregated

printf 'chr1\t200\t700'|bedtools intersect -header -a ./01222025/output.per_site.aggregated -b -|head #chromosome position_before position ref_cpg coverage mod_coverage unmod_coverage mod_fraction coverage_phase1 mod_coverage_phase1 unmod_coverage_phase1 mod_fraction_phase1 coverage_phase2 mod_coverage_phase2 unmod_coverage_phase2 mod_fraction_phase2

How should I navigate this issue? Thanks for your time.

MH-Raza avatar Jan 22 '25 16:01 MH-Raza

Hi,

It seems like your reads are not aligned to a reference genome. For instance, the per-read output shows that reads 440058c0-b21b-4d58-a9c8-bd8c7565d55b and 86c825fc-de5b-4565-ac7f-6f0777c1c944 do not have a contig field in the BAM file. Can you confirm that? Are there any reads in the BAM file that are aligned?

umahsn avatar Jan 28 '25 19:01 umahsn