How to resolve the error which I get when I try to make objects for GRanges.
1
0
Entering edit mode
2.1 years ago
s.singh ▴ 70

Hi,

I am trying to use ChIPseeker to annotate the ChIP peaks which I called using MACS2.

I don't know why I get this error:

Error in .normarg_seqnames1(seqnames) : object 'chr' not found

when I try to make objects for GRanges using this command:

H3K27me3_Rep1 <- with(H3K27me3_Rep1, 
                    GRanges(chr,
                            IRanges(start,end),
                    length=length,
                    log10q = qvalue
                    ))

The same command works perfectly fine on other CSV files. I have tried writing chromosome names in different formats like "chr1,chr2..." also "chrI, chrII..." etc nothing seems to work. Do you know what might be the problem?

Any help will be highly appreciated.

Thanks

-S

ChIPseeker GRanges • 966 views
ADD COMMENT
0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.
code_formatting

ADD REPLY
0
Entering edit mode

Thanks for pointing it out. I didn't know.

ADD REPLY
0
Entering edit mode
2.1 years ago

That error typically refers to missing column names. Either your CSV doesn't contain the column names in the first line as header or there is another issue with reading that file in.

What is the output of

str(H3K27me3_Rep1)

?

ADD COMMENT
0
Entering edit mode

Hi, Thanks for getting back. My file has headers. I am also able to read the file. This is what I get after doing str(H3K27me3_Rep1)

    > str(H3K27me3_Rep1)
'data.frame':   14275 obs. of  5 variables:
 $ ï..chr: chr  "chrI" "chrI" "chrI" "chrI" ...
 $ start : int  624 37913 44456 45428 55598 56728 58907 119676 122471 138332 ...
 $ end   : int  1212 38522 44729 45776 56205 57172 60163 121109 122871 139406 ...
 $ length: int  589 610 274 349 608 445 1257 1434 401 1075 ...
 $ qvalue: num  5.02 3.62 2.5 2.54 3.76 ...
ADD REPLY
1
Entering edit mode

Then we already have identified the culprit. The name of the first column is mangled. It should be chr but in reality is ï..chr. You can test that with trying to access H3K27me3_Rep1$start (should work) and H3K27me3_Rep1$chr (should return NULL).

You can now either manually rename the first column in R with colnames(H3K27me3_Rep1)[1] <- "chr" or fix the source CSV file by removing the non-displayable character(s) before the chr that R reads as ï...

Lycka till from Sweden Matthias

ADD REPLY
0
Entering edit mode

Ahh!!!!! Thanks so so much!!!!! This makes sense. I don't know why I didn't notice. How careless of me.

ADD REPLY

Login before adding your answer.

Traffic: 2515 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6