Skip to content

Commit

Permalink
add reverse focus for metajunction plot
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-mRNA committed Nov 8, 2024
1 parent 9cc4327 commit 86e0455
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Binary file modified assets/metajunction_m6A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -393,17 +399,20 @@ fn main() {
matches.get_one::<String>("cutoff").unwrap().clone(),
matches.get_one::<String>("cutoff_type").unwrap().clone(),
];

if let Some(method) = matches.get_one::<String>("confidence_method") {
args.extend_from_slice(&["-c".to_string(), method.clone()]);
}
if let Some(table) = matches.get_one::<String>("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) => {
Expand Down

0 comments on commit 86e0455

Please sign in to comment.