PoisonAlien / trackplot

Generate IGV style locus tracks from bigWig files in R
133 stars 16 forks source link

object 'gtf' not found using track_plot function #3

Closed aspepin closed 3 years ago

aspepin commented 3 years ago

Hi, I have been able to generate figures with track_plot but I am having trouble to include the mm10 RefSeq gene model (or at least I am assuming this is the problem). Here is my code:

source("https://github.com/PoisonAlien/trackplot/blob/master/trackplot.R?raw=true")
source("./trackplot.R")

# Path to bigwig files
bigWigs <- c("file1.bw", "file2.bw", "file3.bw", "file4.bw")

#Step-1. Extract the signal for your loci of interest
track_data <- track_extract(bigWigs = bigWigs, loci="chr6:55,967,166-56,822,802")

# Step-2. 
#Basic plot - this works
track_plot(summary_list = track_data, draw_gene_track = TRUE, build = "mm10")

# Downloaded the mm10.ncbiRefSeq.gtf.gz file from: https://hgdownload.soe.ucsc.edu/goldenPath/mm10/bigZips/genes/ 

# unzipped the file
$ gunzip mm10.ncbiRefSeq.gtf.gz > mm10.ncbiRefSeq.gtf

# Load gtf file in R
mm10_RefSeq <- rtracklayer::import("./mm10.ncbiRefSeq.gtf")
mm10_RefSeq_df <- as.data.frame(mm10_RefSeq)

# Basic plot with GTF file as source for gene model
### All the following lines of code below generate the same error
track_plot(summary_list = track_data, draw_gene_track = TRUE, gene_model = mm10_RefSeq_df, isGTF = TRUE)
track_plot(summary_list = track_data, draw_gene_track = TRUE, gene_model = mm10_RefSeq_df, isGTF = FALSE)
track_plot(summary_list = track_data, draw_gene_track = TRUE, gene_model = mm10_RefSeq, isGTF = TRUE)
track_plot(summary_list = track_data, draw_gene_track = TRUE, gene_model = mm10_RefSeq, isGTF = FALSE)
track_plot(summary_list = track_data, draw_gene_track = TRUE, gene_model = "./mm10.ncbiRefSeq.gtf", isGTF = TRUE)
track_plot(summary_list = track_data, draw_gene_track = TRUE, gene_model ="./mm10.ncbiRefSeq.gtf", isGTF = FALSE)

Then I get the following error:

Error in track_plot(summary_list = track_data, draw_gene_track = TRUE,  : 
  object 'gtf' not found

What am I doing wrong? Thank you so much!

PoisonAlien commented 3 years ago

Hi, Sorry for the late reply. It was indeed a bug. I have fixed it. Please let me know if it works.

aspepin commented 3 years ago

It works - thank you so much!

aspepin commented 3 years ago

Hi, I am having the same issue again when re-running the exact same code as above which worked after the bug was fixed. Is there something that needs to be done differently? Thanks!

PoisonAlien commented 3 years ago

Hi, Sorry for the late response. Do you still have the issue?