farris_sashimi_files_df: Sashimi plot files data.frame for Farris data

farris_sashimi_files_dfR Documentation

Sashimi plot files data.frame for Farris data

Description

Sashimi plot files data.frame for Farris data

Usage

farris_sashimi_files_df

Format

data.frame suitable for use with splicejam::prepareSashimi() for the filesDF argument. The columns:

  • "sample_id" - sample label used for each panel in the Sashimi plot

  • "url" - full web URL or file path (relative or absolute, from the working directory of the R-shiny app) to each file. It should contain .bed.gz files for junctions, and big wig files for coverage data, using .pos.bw for positive strand coverage, and .neg.bw for negative strand coverage, where applicable.

  • "type" - character string indicating the type of data, using "junction" or "bw".

  • "scale_factor" - optional column with numeric value to adjust the coverage data value, by multiplying the scale factor. The default scale factor is 1.

  • "CellType","Compartment" - additional columns are used in the sample selection HTML widget to help organize and sort samples as appropriate.

Examples

#farris_sashimi_files_df
base_url <- "https://snpinfo.niehs.nih.gov/ucscview/farrisHub/mm10/";
factor1 <- c("CA1", "CA2", "CA3", "DG");
factor2 <- c("CB", "DE");
junc_suffix <- ".STAR_mm10.combinedJunctions.bed.gz";
junc_urls <- paste0(base_url,
   rep(factor1, each=2),
   "_",
   rep(factor2, 4),
   junc_suffix);
junc_sample_id <- paste(rep(factor1, each=2),
   rep(factor2, 4),
   sep="_");
junc_scale_factors <- 2^c(
   CA1_CB=-0.185,
   CA1_DE=0.146,
   CA2_CB=-0.241,
   CA2_DE=0.765,
   CA3_CB=-0.215,
   CA3_DE=0.256,
   DG_CB=-0.376,
   DG_DE=0.372);
junc_df <- data.frame(sample_id=junc_sample_id,
   url=junc_urls,
   type="junction",
   scale_factor=junc_scale_factors[junc_sample_id]);
if (suppressPackageStartupMessages(require(knitr))) {
   knitr::kable(junc_df)
} else {
   junc_df;
}

bw_factor1 <- c(factor1);
bw_factor2 <- c(factor2);
bw_base_url <- paste0(base_url, "union_bigwig/");
bw_strand <- c("pos", "neg");
bw_suffix <- ".bw";
bw_urls <- paste0(
   rep(bw_factor1, each=4),
   "_",
   rep(bw_factor2, each=2),
   ".union.",
   bw_strand,
   bw_suffix
);
bw_scale_factors <- 2^c(
   CA1_CB=-0.0157,
   CA1_DE=0.306,
   CA2_CB=-0.0266,
   CA2_DE=0.0947,
   CA3_CB=0.00839,
   CA3_DE=0.528,
   DG_CB=-0.243,
   DG_DE=-0.283);

if (suppressPackageStartupMessages(require(knitr))) {
   knitr::kable(as.data.frame(matrix(bw_urls, ncol=5)))
} else {
   as.data.frame(matrix(bw_urls, ncol=4));
}

# remove NA entries
bw_url <- jamba::rmNA(bw_urls);
bw_sample_id <- gsub("^.*(CA[123]|DG)[_]*(CB|DE).*",
   "\\1_\\2",
   bw_url);
bw_df <- data.frame(
   url=paste0(bw_base_url, bw_url),
   sample_id=bw_sample_id,
   type="bw",
   scale_factor=bw_scale_factors[bw_sample_id]);
bw_df <- bw_df[do.call(order, bw_df[,c(2,1,3)]),];

farris_sashimi_files_df <- rbind(
   junc_df,
   bw_df);
# replace missing scale_factor with 1, should not be necessary
farris_sashimi_files_df$scale_factor[is.na(farris_sashimi_files_df$scale_factor)] <- 1;
farris_sashimi_files_df$CellType <- factor(
   gsub("_.+", "",
      farris_sashimi_files_df$sample_id),
   levels=factor1);
farris_sashimi_files_df$Compartment <- factor(
   gsub("^.+_", "",
      farris_sashimi_files_df$sample_id),
   levels=factor2);
if (suppressPackageStartupMessages(require(knitr))) {
   knitr::kable(farris_sashimi_files_df)
} else {
   farris_sashimi_files_df;
}

table(farris_sashimi_files_df[,c("CellType", "Compartment", "type")]);


jmw86069/farrisdata documentation built on Oct. 14, 2024, 6:29 p.m.