Hey, there,
I was following the instruction of http://www.bioconductor.org/help/workflows/rnaseqGene/#annotate to update the annotation in my DEG files. I used the code they designed:
convertIDs <- function( ids, from, to, db, ifMultiple=c("putNA", "useFirst")) {
stopifnot( inherits( db, "AnnotationDb" ) )
ifMultiple <- match.arg( ifMultiple )
suppressWarnings( selRes <- AnnotationDbi::select(
db, keys=ids, keytype=from, columns=c(from,to) ) )
if ( ifMultiple == "putNA" ) {
duplicatedIds <- selRes[ duplicated( selRes[,1] ), 1 ]
selRes <- selRes[ ! selRes[,1] %in% duplicatedIds, ]
}
return( selRes[ match( ids, selRes[,1] ), 2 ] )
}
I loaded my DEG csv file to deg_01 first. The id column has all the refseq ids.
Then
> deg_01$newMGI_symbol <- convertIDs("deg_01$id", "REFSEQ", "SYMBOL", org.Mm.eg.db)
Error in .testForValidKeys(x, keys, keytype) :
None of the keys entered are valid keys for 'REFSEQ'. Please use the keys method to see a listing of valid arguments.
I checked and the deg_01$id are all refseq ids.
> deg_01$id
[1] NM_026268 NM_025777 NM_013478 NR_015524 NM_001099297 NM_177610 NM_001122954
[8] NM_144834 NM_011110 NM_016668 NM_013820 NM_001145874 NM_001081060 NM_080457
[15] NM_007646 NM_020279 NM_172415 NM_007686 NM_001112723 NM_001173505 NM_001290565
Any suggestions? Thanks.
It looks like your IDs are factors, not character. However that should result in a different error: