{"id":13710183,"url":"https://github.com/al-mcintyre/mCaller","last_synced_at":"2025-05-06T18:34:38.425Z","repository":{"id":52149578,"uuid":"82175473","full_name":"al-mcintyre/mCaller","owner":"al-mcintyre","description":"A python program to call methylation (m6A in DNA) from nanopore signal data ","archived":false,"fork":false,"pushed_at":"2021-06-24T22:04:33.000Z","size":139243,"stargazers_count":43,"open_issues_count":13,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-03T23:18:01.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/al-mcintyre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-16T11:52:44.000Z","updated_at":"2024-04-14T13:08:02.000Z","dependencies_parsed_at":"2022-09-09T01:40:29.361Z","dependency_job_id":null,"html_url":"https://github.com/al-mcintyre/mCaller","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-mcintyre%2FmCaller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-mcintyre%2FmCaller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-mcintyre%2FmCaller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-mcintyre%2FmCaller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/al-mcintyre","download_url":"https://codeload.github.com/al-mcintyre/mCaller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224521618,"owners_count":17325267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:00:52.820Z","updated_at":"2024-11-13T20:31:29.210Z","avatar_url":"https://github.com/al-mcintyre.png","language":"Python","funding_links":[],"categories":["Software packages"],"sub_categories":["DNA modification analysis"],"readme":"###### \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;H  \n###### \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;|  \n###### H-C-aller  \n###### \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;|  \n###### \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;H\n\nThis program is designed to call m6A from nanopore data using the differences between measured and expected currents.  \n\n## Dependencies/requirements\n\u003e - python3 (as of mCaller version 1.0)\n\u003e - nanopolish (https://github.com/jts/nanopolish)\n\u003e - an aligner to create a bam file (has been tested with graphmap and bwa mem)\npython packages\n\u003e - scikit-learn \n\u003e - h5py\n\u003e - biopython \n\u003e - matplotlib\n\u003e - seaborn\n\u003e - numpy\n\u003e - pysam\n\u003e - scipy\n\u003e - pandas\n\nother\n\u003e - nanopore sequencing data (fastq format + fast5 to run nanopolish, basecalled using Albacore or another basecaller that saves event data)\n\u003e - a reference sequence file (fasta)\n\n## Installation\nAdd softlinks for make_bed.py and mCaller.py to path or run from mCaller directory\n\n## Options\n```\nusage: mCaller.py [-h] (-p POSITIONS | -m MOTIF) -r REFERENCE -e\n                             TSV -f FASTQ [-t THREADS] [-b BASE]\n                             [-n NUM_VARIABLES] [--train] [-d MODELFILE]\n                             [-s SKIP_THRESH] [-q QUAL_THRESH] [-c CLASSIFIER]\n                             [-v]\n```\n\narguments:\n```\n  -h, --help            show this help message and exit\n  -p, --positions\n                        file with a list of positions at which to classify\n                        bases (must be formatted as space- or tab-separated\n                        file with chromosome, position, strand, and label if\n                        training)\n  -m, --motif \n                        classify every base of type --base in the motif\n                        specified instead (can be single one-mer)\n  -r, --reference \n                        fasta file with reference aligned to\n  -e, --tsv     tsv file with nanopolish event alignment\n  -f, --fastq \n                        fastq file with nanopore reads\n  -t, --threads\n                        specify number of processes (default = 1) \n\t\t\tmultiple threads now includes sorting but this can create trade-offs\n            in terms of speed\n  -b, --base  bases to classify as methylated or unmethylated (A or\n                        C, default A)\n  -n, --num_variables\n                        change the length of the context used to classify\n                        (default of 6 variables corresponds to 11-mer context\n                        (6*2-1))\n  --train               train a new model (requires labels in positions file)\n  --training_tsv \n                        provide an mCaller output file with labels for training\n  -d, --modelfile \n                        model file name\n  -s, --skip_thresh \n                        number of skips to allow within an observation\n                        (default 0)\n  -q, --qual_thresh\n                        quality threshold for reads (default none)\n  -c, --classifier \n                        use alternative classifier: options = NN (default), RF,\n                        LR, or NBC (others may severely increase runtime)\n  --plot_training       plot probabilities distributions for training\n                        positions (requires labels in positions file and\n                        --train)\n  -v, --version         print version\n\n```\n\n## Pipeline for methylation detection from R9 data\n\n1. extract template strand reads from fast5 files. Follow the most up-to-date guidelines from nanopolish (https://github.com/jts/nanopolish). As of April 2019:\n```\nnanopolish index -d \u003cfast5 directory\u003e -s sequencing_summary.txt \u003cfilename\u003e.fastq\n```\n   or \n``` \nporetools fastq --type fwd \u003cfast5 directory\u003e \u003e \u003cfilename\u003e.fastq \n```\n2. align fastq reads to reference assembly (we have used both GraphMap and bwa mem, with comparable results):\n``` \nbwa index \u003creference\u003e.fasta \nbwa mem -x ont2d -t \u003cnum_threads\u003e \u003creference\u003e.fasta \u003cfilename\u003e.fastq | samtools view -Sb - | samtools sort -T /tmp/\u003cfilename\u003e.sorted -o \u003cfilename\u003e.sorted.bam \nsamtools index \u003cfilename\u003e.sorted.bam \n```\n   or \n``` \ngraphmap align -r \u003creference\u003e.fasta -d \u003cfilename\u003e.fastq -o \u003cfilename\u003e.sam \nsamtools view -bS \u003cfilename\u003e.sam | samtools sort -T /tmp/\u003cfilename\u003e.sorted -o \u003cfilename\u003e.sorted.bam \nsamtools index \u003cfilename\u003e.sorted.bam \n``` \n4. run nanopolish with the following command to save a tsv file and the event values scaled towards the model:\n``` \nnanopolish eventalign -t \u003cnum_threads\u003e --scale-events -n -r \u003cfilename\u003e.fastq -b \u003cfilename\u003e.sorted.bam -g \u003creference\u003e.fasta \u003e \u003cfilename\u003e.eventalign.tsv\n```\n5. run mCaller to detect m6A:\n```\nmCaller.py \u003c-m GATC or -p positions.txt\u003e -r \u003creference\u003e.fasta -d r95_twobase_model_NN_6_m6A.pkl -e \u003cfilename\u003e.eventalign.tsv -f \u003cfilename\u003e.fastq -b A \n```\n   This returns a tabbed file with per-read predictions, where columns indicate chromosome, read name, genomic position, position k-mer context, features, strand, label, and probability of methylation predicted by mCaller for that position and read \n\n6. (optionally) run summary script to generate a bed file of per-position methylation predictions:\n```\nmake_bed.py -f \u003cfilename\u003e.eventalign.diffs.6 -d 15 -t 0.5 \n```\n`-d` indicates the minimum read depth for inclusion, while `-t` indicates the `--mod_threshold`, or the minimum fraction of observations of a position (ie. currents deviations in individual reads) labelled as methylated, based on a \u003e= 50% predicted probability of methylation with the mCaller model. Check make_bed.py --help for all options. \n\nResults and analysis scripts for the E. coli datasets are provided in the bioRxiv folder. \n\n## Test data\n\nReference fasta, PacBio calls for m6A and a subset of A positions, and eventalign tsv + fastq are provided for a single read for testing purposes in the \"testdata\" folder. \n\n1. To run mCaller on the testdata, use:\n``` \n./mCaller.py -p testdata/test_positions_\u003cm6A/A\u003e.txt -r testdata/pb_ecoli_polished_assembly.fasta -e testdata/masonread1.eventalign.tsv -d r95_twobase_model_NN_6_m6A.pkl -f testdata/masonread1.fastq \n```\n   Can also try using `-m GATC`, although not all GATC positions within the read were identified as methylated on both strands using PacBio and the model is slightly weighted to accept more false negatives than false positives at the moment. \n\n  This will generate the output file testdata/masonread1.eventalign.diffs.6\n\n``` \n./make_bed.py -f testdata/masonread1.eventalign.diffs.6 -d 1 -t 0.5 \n```\n  Will then generate the output bed file testdata/masonread.methylation.summary.bed with columns chrom, chromStart, chromEnd, context, % methylated, strand, depth of coverage\n\n2. To train on the testdata (don't actually use this model trained on one read), try:\n``` \n./mCaller.py -p testdata/test_positions.txt -r testdata/pb_ecoli_polished_assembly.fasta -e testdata/masonread1.eventalign.tsv -t 4 --train -f testdata/masonread1.fastq\n```\n\n  This will generate the output file model_NN_6_m6A.pkl. \n  \n  ## Results with the R9.5 model \n  ![latest results](motifs_plot.png)\n  Unsurprisingly, mCaller performs best at identifying motifs similar to those it's trained on (here, E. coli). This is a clear limitation to the method, but the results are still sufficient in many cases to verify a motif of interest. \n\n## Models provided\n- R9.4 and R9.5 models trained on E. coli data, both basecalled with albacore, as published in https://www.nature.com/articles/s41467-019-08289-9\n- R9.4 models trained on motifs “CAAYNNNNNRTAC/GTAYNNNNNRTTG” and “CRAANNNNNNNTGC/GCANNNNNNNTTYG”, respectively, basecalled with Guppy-v4.5.2, generously provided by [@wshropshire](https://github.com/wshropshire)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-mcintyre%2FmCaller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fal-mcintyre%2FmCaller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-mcintyre%2FmCaller/lists"}