How to anchor for the omic circos plot using a set of genes?

#Initialize value

seg.name <- data_frame[,1]
seg.num <- length(unique(data_frame[,1]));

# Create db
db <- segAnglePo(data_frame, seg=seg.name);
Error in names(x) <- value :
'names' attribute [5] must be the same length as the vector [4]

Any suggestions...

Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

install.reprex("reprex")

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")

For pointers specific to the community site, check out the reprex FAQ, linked to below.

This is the clipboard reprex generated. could not find function?? library OmicCircos was installed.

db <- segAnglePo(data, seg=seg.name)
#> Error in segAnglePo(data, seg = seg.name): could not find function "segAnglePo"

That's because your reprex has to contain the data and libraries (that's the self-contained bit). Check out the reprex FAQ (linked to above), there are a bunch of quick, but helpful resources to understand how a self-contained reproducible example works.

Basically, this is all I have and the error I get (I haven't had much time to really look into reprex but I tried reprex::reprex(si=true) and it took for ever to process. At any rate, Trying to anchor column 3 to the circle and this is all the code and libraries Im using.


library(OmicCircos)
options(stringsAsFactors = FALSE);

data<-read.table("DATA.txt",header=T)

#Initialize value
seg.name <- data[,3]
seg.num   <- length(unique(data[,3]));
head(data)

  Chromosome    Start   Gene Score
1       chr1 91381957 CDC14A  -330
2       chr1 91381957   CSF1     -330
3       chr1 91381957   EB100  -330
4       chr1 91381957  WNT2B  -330
5       chr1 91381957  TBX15  -330
6       chr1 91381957   DPYD  -330

# Create df
db <- segAnglePo(data, seg=seg.name);
Error in names(x) <- value : 
 'names' attribute [5] must be the same length as the vector [4]

Thanks in advance.

It doesn’t look like your data are in the format that segAnglePo() expects. From the documentation:

the segment data should be a matrix or a data frame: column 1 is the segment name or chromosome name; column 2 is the segment start; column 3 is the segment end; column 4 is segment name2 (optional); and column 5 is segment description (optional).

You can see documentation for functions in any loaded package by running:

?functionName

or

help("functionName")

It can take some investment of time on your part to figure out how to ask a well-formulated question here. However, consider that if you don’t make that investment, both you and others will often waste time on needless back-and-forth or fruitless guessing about what could be going wrong.

2 Likes

THanks again for your input. Still issues with dataframe...

When data converted to a dataframe:

library(OmicCircos)
options(stringsAsFactors = FALSE);

 data<-read.table("DATA.txt",header=T)
 gene.dataframe<-as.data.frame(data)

 #Initialize value
 gene.name <- gene.dataframe[,4]
 gene.num   <- length(unique(gene.dataframe[,4]));

 head(gene.dataframe)

  Chromosome    Start       End   Gene Score
1       chr1 91381957 120069437 CDC14A  -330
2       chr1 91381957 120069437   CSF1  -330
3       chr1 91381957 120069437   EB300  -330
4       chr1 91381957 120069437  WNT2B  -330
5       chr1 91381957 120069437  TBX15  -330
6       chr1 91381957 120069437   DPYD  -330

 # Create df
 db <- segAnglePo(gene.dataframe, seg=gene.name)
Error in Ops.factor(seg.dat[, 1], seg.n) : 
  level sets of factors are different