Package: methamplicons
MethAmplicons2Command line tool written in Python for generation of lollipop and ridgleline plots from targeted bisulfite sequencing.Generate lollipop plots that show the most frequent epialleles for a region of interest as well as a "combined" epiallele that is an average of less frequent (<5%) epialleles e.g. the RAD51C promoter region:Can also plot the combined/average epialleles for multiple samples of interest together:Lastly, you can plot ridgeline plots that allow one to view the distribution of the number of methylated CpGs per epiallele by sample. This provides another visual tool to assess the proportion of non-methylated, partially methylated, and fully methylated epialleles in a sample:This repo provides a generalised "CLI tool" version of the code fromMethAmpliconswhich is a collection of scripts used for the analysis of RAD51C methylation data in:Nesic, K, Kondrashova, O et al. "AcquiredRAD51Cpromoter methylation loss causes PARP inhibitor resistance in high grade serous ovarian carcinoma." Cancer Research (2021)This tool usesFLASHpaired-end read merging software for merging reads:FLASH: Fast length adjustment of short reads to improve genome assemblies. T. Magoc and S. Salzberg. Bioinformatics 27:21 (2011), 2957-63Getting StartedTo get started with the tool, follow the steps INSTALLATION and USE below.INSTALLATION:pipinstallmethampliconsUSE:#simple casemethamplicons--PE_read_dirtest4--amplicon_infotest4/BS_primers_amplicons_CDS_RC.tsv--sample_labelstest4/SampleID_labels_amplicon_meth.csv--output_dirAOCS34059# specifying optional parametersmethamplicons--PE_read_dirfinal_test_260221--amplicon_infofinal_test_260221/BS_primers_amplicons_CDS_RC.tsv--sample_labelsfinal_test_260221/SampleID_labels_amplicon_meth.csv--output_dir260221_output--min_seq_freq0.01--verbosefalse--save_intermediatesfalseNote: the flash binary used to merge reads is only compiled for Macs (arm64 and intel). See Alternative OS Support for where to find binaries for other systems.Requirements for directories and files provided as arguments:Example tsv and csv files are provided under tests--PE_read_dir - directory containing paired end read files:An assumption of the program is that the last instance of R1 or R2 before the file extension (.fastq, .fastq.gz) indicates that a file contains read 1s of a pair or read 2s of a pair.The tested files had read 1s at the same line (position) as the read 2s in the other file, however order shouldn't be important as each fastq files reads are placed in dictionaries and so a read's counterpart can be searched.--amplicon_info - tsv file containing the information about the amplified regions:The tab-delimited (tsv) file should have data organised into 'columns':AmpliconName, Primer1, Primer2, Sequence, and CDSColumns should contain:AmpliconName is the name given to the amplicon.Primer1 and Primer2 are the primers that will match the reads (they ARE bisulfite converted). Primer2 is assumed to be the reverse primer and therefore its reverse complement is used by the program (the user can provide the reverse primer sequence as is).Sequence - reference sequence for the amplified region that is NOT bisulfite converted. The reference sequence should start with primer 1's sequence and ends with primer 2's (reverse complement) sequence.CDS is the distance of the first base in the reference sequence relative to the first base in the CDS. For genes on the reverse strand the direction of the amplicon and primer 1 and 2 need to be considered. 0 may be put as a stand in value.If multiple regions are targeted in a single analysis, multiple amplicon entries can be provided (including overlapping regions/amplicons). These will be extracted from the reads and analysed separately.Example tsv file:Amplicon_NamePrimer1Primer2SequenceCDSRAD51CGAAAATTTATAAGATTGCGTAAAGTTGTAAGGCTAACCCCGAAACAACCAAACTCCGAAAATTTACAAGACTGCGCAAAGCTGCAAGGCCCGGAGCCCCGTGCGGCCAGGCCGCAGAGCCGGCCCCTTCCGCTTTACGTCTGACGTCACGCCGCACGCCCCAGCGAGGGCGTGCGGAGTTTGGCTGCTCCGGGGTTAG-84BRCA1_lTTGTTGTTTAGCGGTAGTTTTTTGGTTAACCTATCCCCCGTCCAAAAACTGCTGCTTAGCGGTAGCCCCTTGGTTTCCGTGGCAACGGAAAAGCGCGGGAATTACAGATAAATTAAAACTGCGACTGCGCGGCGTGAGCTCGCTGAGACTTCCTGGACGGGGGACAGGCT-87BRCA1_sTTGTTGTTTAGCGGTAGTTTTTTGGTTCAATCGCAATTTTAATTTATCTATAATTCCCCTGCTGCTTAGCGGTAGCCCCTTGGTTTCCGTGGCAACGGAAAAGCGCGGGAATTACAGATAAATTAAAACTGCGACTG-87--sample_labels - csv file containing sample label information (optional):This file is not required, however it can be used to map the Sample Id (name used in the fastq files) to the SampleLabel or ShortLabel if the CSV includes the following columns:SampleID, SampleLabel, ShortLabelExample output files and directories:.
├── BRCA1_l
│   ├── sample1_barplot.pdf
│   ├── sample2_barplot.pdf
│   ├── All_samples_combined_avgd_meth_BRCA1_l.pdf
│   ├── average_BRCA1_l_meth_by_sample.csv
│   ├── Ridgeline_data_BRCA1_l.csv
│   ├── ridgeline_plot_BRCA1_l.pdf
│   └── Specific_allele_data_BRCA1_l.csv
├── bisulfite_seq_info.csv
└── flash_stdout.txtNote: barplots may or may not include epialleles that represent <5% of the total reads. If there are epialleles with a frequency <5%, they will be shown in the barplot.bisulfite_seq_info.csv example:SampleAmpliconBS_Conv_EffNum_Ts_ObsNum_Exp_Ts_TotalNum_Reads_Used_Non_CpGNum_Non_CpG_CsRetained_for_CpG_TotalExcl_for_CpG_lengthExcl_for_CpG_AGReads_above_threshReads_below_thresh_ctHCC38RAD51CNone_w_length_refseq03102031020HCC38BRCA1_l0.995943493584899013805206.013861435.01980205.07.015516917723301628924473517Argument infousage: methamplicons [-h] [--PE_read_dir PE_READ_DIR]
                     [--amplicon_info AMPLICON_INFO]
                     [--sample_labels [SAMPLE_LABELS]]
                     [--output_dir OUTPUT_DIR] [--min_seq_freq MIN_SEQ_FREQ]
                     [--verbose {true,false}] [--save_data {true,false}]
                     [--save_intermediates {true,false}]
                     [--combine_lanes {true,false}]

CLI tool for plotting targeted bisulfite sequencing

optional arguments:
  -h, --help            show this help message and exit
  --PE_read_dir PE_READ_DIR
                        Desired input directory with fastq files, gzipped or
                        not
  --amplicon_info AMPLICON_INFO
                        Path to the amplicon info file in tsv format, e.g.:
                        AmpliconName Primer1 Primer2 ReferenceSequence
  --sample_labels [SAMPLE_LABELS]
                        Path to sample labels file in csv format
  --output_dir OUTPUT_DIR
                        Desired output directory
  --min_seq_freq MIN_SEQ_FREQ
                        Threshold frequency an extracted epiallele sequence
                        must have to be included in analysis (default:0.01)
  --verbose {true,false}
                        Print all output after file parsing (default: true).
  --save_data {true,false}
                        Save processed data in csv format (default: true).
  --save_intermediates {true,false}
                        Save 'demultiplexed' and merged read files for all
                        combinations of samples and amplicons (default: true).
  --combine_lanes {true,false}
                        Combine fastq files from different sequencing lanes
                        (L001, L002) into single R1 and R2 files (default:
                        true).Alternative OS support:After running "pip install methamplicons", navigate to the folder where it was installed - which is the bin folder of the version of Python being used. On Linux you can run "which methamplicons" to find the location. The location should look like /Python/3.9/bin/methampliconsIn the methamplicons folder are 4 python files and unix executable/binary for flash on mac. Delete the flash binary and replace it with the one for your system, which can be obtained from:https://ccb.jhu.edu/software/FLASH/E.g. for a Linux system, extract the binary from the FLASH-1.2.11-Linux-x86_64.tar.gzThe tool should now run.Credit to the creators of FLASH:
FLASH: Fast length adjustment of short reads to improve genome assemblies. T. Magoc and S. Salzberg. Bioinformatics 27:21 (2011), 2957-63.