I have a set of genes with associated data that I want to locate on the mouse genome
My approach is to
- extract the genes in the genome
- subset the genes to include only my list
- add the extra data for my list into the GRanges as metadata
- export the relevant parts of the GRanges object.
MouseGenesGR <- genes(Mus.musculus, columns="SYMBOL")
head(means)
Hmeans Lmeans Nmeans
Aspn 3.779835 7.795773 11.534907
Angpt1 10.251626 8.220874 4.713242
Gm773 2.867759 6.118540 10.058305
Lifr 6.828385 8.136443 5.265472
Il1rl1 5.832741 8.427293 11.550407
Ogn 7.865109 9.429068 12.435698
dim(means)
[1] 1000 3
MySet1 <- MouseGenesGR[any(mcols(MouseGenesGR)$SYMBOL %in% row.names(means))] #subset my genes
length(MySet1)
[1] 911
What happened to the other 89?
And how do I query that?
Now I would like to add in the metadata with
mcols(MySet1)$HMeans <- means$Hmeans mcols(MySet1)$LMeans <- means$Lmeans mcols(MySet1)$NMeans <- means$Nmeans
but I can't because the two objects are now of different lengths
Error in `[[<-`(`*tmp*`, name, value = c(3.77983495075, 10.2516255123333, : 1000 elements in value to replace 911 elements
Any help appreciated.
Mitch
