Geeketics / LocusZooms

Make LocusZoom-like plots with your own LD matrix.
37 stars 20 forks source link

Null device 1 error when running example code #19

Closed stankiewicz565 closed 2 years ago

stankiewicz565 commented 2 years ago

I tried running the example code and got the result of Null device 1 instead of the locuszoom graph.

# load necessary files into R
Example.assoc.linear <- read.delim("Example.assoc.linear", stringsAsFactors = FALSE, header = TRUE)
Example.ld <- read.table("Example.ld", stringsAsFactors = FALSE, header = TRUE)
Unique.genes <- read.delim("Gencode_GRCh37_Genes_UniqueList2021.txt", stringsAsFactors = FALSE, header = TRUE)

# load the locuszoom function into R
source("functions/locus_zoom.R")

# create a LocusZoom-like plot
locus.zoom(data = Example.assoc.linear,                                    # a data.frame (or a list of data.frames) with the columns CHR, BP, SNP, and P
           region = c(16, 53340000, 54550000),                             # the chromosome region to be included in the plot
           offset_bp = 0,                                                  # how many basepairs around the SNP / gene / region of interest to plot
           ld.file = Example.ld,                                           # a file with LD values relevant to the SNP specified above
           genes.data = Unique.genes,                              # a file of all the genes in the region / genome
           plot.title = "Association of FTO with BMI in Europeans",        # the plot title
           file.name = "Example.jpg",                                      # the name of the file to save the plot to
           secondary.snp = c("rs1121980", "rs8060235"),                    # a list of SNPs to label on the plot
           secondary.label = TRUE)                                         # TRUE/FALSE whether to add rsIDs of secondary SNPs to plot
Geeketics commented 2 years ago

This is not an error. The graph will not output to your screen, it is saved to a file called Example.jpg as specified in this portion of the locus.zoom() function file.name = "Example.jpg", # the name of the file to save the plot to The null device output on your screen is a standard output in R when something is saved to a jpg/png/etc.