diff --git a/README.md b/README.md index 20e65f0..767ab4c 100644 --- a/README.md +++ b/README.md @@ -127,8 +127,8 @@ $ r2d plotMetaJunction -i "./test/annotate.bed" -o "./test/metajunction_m6A.png" The plot shows the proportion of sites that have greater than 10% m6A methylation, and their distances to local splice-junctions: -Distances to downstream junctions are indicated on the right side of the plot, and distances to upstream junctions are indicated on the left side of the plot. -To reverse the focus, so that splice junctions are centered at x = 0 and m6A sites are plotted around junctions, pass the '-r' flag to R2_plotMetaJunction.R. +By default, distances to downstream junctions are indicated on the right side of the plot, and distances to upstream junctions are indicated on the left side of the plot. +To reverse the focus, so that splice junctions are centered at x = 0 and distances to m6A sites are plotted around junctions, pass the '-r' flag to R2_plotMetaJunction.R. An example is shown below. ![Distribution of m6A sites around exon junctions](./assets/metajunction_m6A.png) diff --git a/assets/metajunction_m6A.png b/assets/metajunction_m6A.png index 5124246..645ec87 100644 Binary files a/assets/metajunction_m6A.png and b/assets/metajunction_m6A.png differ diff --git a/src/main.rs b/src/main.rs index 0957453..afd04c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -244,6 +244,12 @@ fn main() { .long("save-table") .value_name("FILE") .help("Save the aggregated metajunction data as a tab-separated file")) + .arg(Arg::new("reverse_focus") + .short('r') + .long("reverse") + .help("Reverse the x-axis sign and show distribution of m6A sites around junctions instead of distribution of junctions around m6A sites") + .action(clap::ArgAction::SetTrue) + .required(false)) ) .subcommand( Command::new("plotMetaCodon") @@ -393,17 +399,20 @@ fn main() { matches.get_one::("cutoff").unwrap().clone(), matches.get_one::("cutoff_type").unwrap().clone(), ]; - + if let Some(method) = matches.get_one::("confidence_method") { args.extend_from_slice(&["-c".to_string(), method.clone()]); } if let Some(table) = matches.get_one::("save_table") { args.extend_from_slice(&["-o".to_string(), table.clone()]); } - + if matches.get_flag("reverse_focus") { + args.push("-r".to_string()); + } + println!("Arguments being passed to R2_plotMetaJunction.R:"); println!("Rscript R2_plotMetaJunction.R {}", args.join(" ")); - + match generate_r_plots("R2_plotMetaJunction.R", &args, None) { Ok(_) => println!("PlotMetaJunction generated successfully."), Err(e) => {