This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Varriant Annotation-exporting results

I want to export my variant annotation results to a table and save it in my computer hard drive. I tried this "write.table(mydata, "G:/mydata.txt", sep="\t")" but did not work.

snp r

Could you show a sample from your data ? Also are you about the given location G:/mydata.txt is existing ?

Sorry I did not get the second part of the question " Also are you about the given location G:/mydata.txt is existing ?" I changed to my working directory (K drive) but did not help

> rd <- rowRanges(vcf)
> loc <- locateVariants(rd, txdb, CodingVariants())
'select()' returned many:1 mapping between keys and columns
> head(loc, 20541)
GRanges object with 9619 ranges and 9 metadata columns:
       seqnames               ranges strand   | LOCATION  LOCSTART    LOCEND
          <Rle>            <IRanges>  <Rle>   | <factor> <integer> <integer>
     1   chrA03         [2963, 2963]      -   |   coding       334       334
     2   chrA03         [2977, 2977]      -   |   coding       320       320
     3   chrA03         [2989, 2989]      -   |   coding       308       308
     4   chrA03         [4637, 4637]      -   |   coding       393       393
     5   chrA03         [4681, 4681]      -   |   coding       349       349
  >
     1         6       10747         53290        <NA>                
     2         7       10747         53290        <NA>                
     3         8       10747         53290        <NA>                
     4         9       10748         53293        <NA>                
     5        10       10748         53293        <NA>                
   ...       ...         ...           ...         ...             ...
  9615     20536       13466         68355        <NA>                
  9616     20537       13466         68355        <NA>                
  9617     20538       13466         68355        <NA>                
  9618     20539       13466         68355        <NA>                
  9619     20540       13466         68355        <NA>                
              FOLLOWID
       <CharacterList>
     1                
     2                
     3                
     4                
     5                
   ...             ...
  9615                
  9616                
  9617                
  9618                
  9619                
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths

write.table(mydata, file="K:/mydata.txt", sep="\t") Error in is.data.frame(x) : object 'mydata' not found

I was trying to say are you sure about that directory is existing but I made a typo. Anyways, first of all this is not a regular R data frame. It is called Granges object. ( https://www.bioconductor.org/packages/devel/bioc/vignettes/GenomicRanges/inst/doc/GenomicRangesIntroduction.pdf —> check for more detailed info.).

I found a previous post about similar problem. Actually I think this is what you want.

How To Write Data In A Granges Object To A Bed File.

Give it a try to this link, if you can't solve it. I will help you.

Edit: This is not what you want, but it is similar.

0 answers

No answers yet.

Log in to answer this question.