0

I have a dataframe with 4 columns:

  • chromosome
  • start
  • end
  • score

and for each columns I have multiple rows, like this:

> neuron_df
seqnames    start      end       score
1       chrI  1540683  1540683  6.33554
2       chrI  1838049  1838049  2.81938
3       chrI  2706245  2706245  4.10906
4       chrI  2707530  2707530 13.77880

I want to trasform my dataframe in a GRanges object so I try with makeGRangesFromDataFrame

neuron_gr <- makeGRangesFromDataFrame(neuron_df, keep.extra.columns = TRUE)

but my neuron_gr don't have a IRange valid, is like this:

neuron_gr
GRanges object with 176 ranges and 1 metadata column:
        seqnames    ranges strand |     score
           <Rle> <IRanges>  <Rle> | <numeric>
    [1]     chrI   1540683      * |   6.33554
    [2]     chrI   1838049      * |   2.81938
    [3]     chrI   2706245      * |   4.10906
    [4]     chrI   2707530      * |  13.77880

I only have the start number and not the range.

How I can solve this problem? Thank you

shafee
  • 15,566
  • 3
  • 19
  • 47

0 Answers0