a-slide / pycoMeth

DNA methylation analysis downstream to Nanopolish for Oxford Nanopore DNA sequencing datasets
GNU General Public License v3.0
34 stars 2 forks source link

Not recognising nanopolish file #33

Closed lab-rat-kid closed 4 years ago

lab-rat-kid commented 4 years ago

CpG_Aggregate is not recognising the tsv file output from nanopolish. This is what I get:

$ pycoMeth CpG_Aggregate -i results/methylation/nanopolish/C1_meth_calls.tsv -f results/input/genome/genome.fa -b results/methylation/pycometh_cpg_agg/C1_CpG_Agg.bed -t results/methylation/pycometh_cpg_agg/C1_CpG_Agg.tsv -s Control_1 -v -p
Cannot import dependencies required for static image export
## Checking options and input files ##
    [DEBUG]: Options summary
    [DEBUG]:    Package name: pycoMeth
    [DEBUG]:    Package version: 0.4.13
    [DEBUG]:    Timestamp: 2020-07-16 17:09:31.520055
    [DEBUG]:    nanopolish_fn: ['results/methylation/nanopolish/C1_meth_calls.tsv']
    [DEBUG]:    ref_fasta_fn: results/input/genome/genome.fa
    [DEBUG]:    output_bed_fn: results/methylation/pycometh_cpg_agg/C1_CpG_Agg.bed
    [DEBUG]:    output_tsv_fn: results/methylation/pycometh_cpg_agg/C1_CpG_Agg.tsv
    [DEBUG]:    min_depth: 10
    [DEBUG]:    sample_id: Control_1
    [DEBUG]:    min_llr: 2
    [DEBUG]:    verbose: True
    [DEBUG]:    quiet: False
    [DEBUG]:    progress: True
    [DEBUG]:    kwargs
    [DEBUG]:        subcommands: CpG_Aggregate
    [DEBUG]:        func: <function CpG_Aggregate at 0x7fd6dc2d44d0>
## Parsing methylation_calls file ##
    [DEBUG]: Opening file results/methylation/nanopolish/C1_meth_calls.tsv in normal mode
    [DEBUG]: Reading header from file: results/methylation/nanopolish/C1_meth_calls.tsv
    [DEBUG]: Column names from header: 'chromosome / start / end / read_name / log_lik_ratio / log_lik_methylated / log_lik_unmethylated / num_calling_strands / num_cpgs / sequence'
    [DEBUG]: Input file type: unknown
    [DEBUG]: Closing file:results/methylation/nanopolish/C1_meth_calls.tsv
Traceback (most recent call last):
  File "/home/tylerstevenson/miniconda3/bin/pycoMeth", line 8, in <module>
    sys.exit(main())
  File "/home/tylerstevenson/miniconda3/lib/python3.7/site-packages/pycoMeth/__main__.py", line 115, in main
    args.func(**vars(args))
  File "/home/tylerstevenson/miniconda3/lib/python3.7/site-packages/pycoMeth/CpG_Aggregate.py", line 69, in CpG_Aggregate
    raise pycoMethError("Invalid input file type passed (nanopolish_fn). Expecting Nanopolish call_methylation output TSV file")
pycoMeth.common.pycoMethError: Invalid input file type passed (nanopolish_fn). Expecting Nanopolish call_methylation output TSV file

The files were generated using nanopolish version 0.9.0 Any help would be greatly appretiated!

a-slide commented 4 years ago

Hi @lab-rat-kid Something might have changed in nanopolish Could you copy the first lines of the input file you are using ? Thanks

lab-rat-kid commented 4 years ago

Thanks so seeing this so quickly! This is what nanopolish gives:

chromosome  start   end read_name   log_lik_ratio   log_lik_methylated  log_lik_unmethylated    num_calling_strands num_cpgs    sequence
chr1    914685  914685  f25d056b-e46d-4f49-b0e1-6808e3ecc999    -0.37   -130.99 -130.62 1   1   CAGACCGTCAG
chr1    914711  914711  f25d056b-e46d-4f49-b0e1-6808e3ecc999    -0.34   -205.69 -205.35 1   1   TCCTACGGGTT
chr1    914723  914723  f25d056b-e46d-4f49-b0e1-6808e3ecc999    -8.56   -115.41 -106.85 1   1   CCTGCCGAGGT
chr1    914738  914738  f25d056b-e46d-4f49-b0e1-6808e3ecc999    3.48    -95.83  -99.31  1   1   AACCCCGGCAC
chr1    914781  914781  f25d056b-e46d-4f49-b0e1-6808e3ecc999    1.71    -140.95 -142.65 1   1   CCCCTCGGAGA
chr1    230961  230976  24486120-e4eb-4068-b35f-9a87bbbe042c    0.57    -336.70 -337.28 1   3   AAATGCGTCTCGGGAGCAGCCGTGTT

I've tried changing num_cpgs to num_motifs as I saw your script indicated this might be this problem. It didn't help.

Thanks!

lab-rat-kid commented 4 years ago

When I add a column called strand between chromosome and start, fill it with +, and change num_cpgs to num_motifs, then it works.

a-slide commented 4 years ago

Great to know that this older version is not supported. I actually checked in pycoMeth doc and is is written that version Nanopolish 0.10+ is required see installation doc Thanks for digging to the bottom.

lab-rat-kid commented 4 years ago

Thanks, I hadn't noticed I was using an old version of nanopolish! :)