Entering edit mode
                    3.0 years ago
        michelafrancesconi8
        
    
        ▴
    
    10
    I have a dataframe with 4 columns:
chromosome start end score and for each columns I have multiple rows, like this:
seqnames    start      end       V5
1       chrI  1540683  1540683  6.33554
2       chrI  1838049  1838049  2.81938
3       chrI  2706245  2706245  4.10906
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 |        V5
           <Rle> <IRanges>  <Rle> | <numeric>
    [1]     chrI   1540683      * |   6.33554
    [2]     chrI   1838049      * |   2.81938
    [3]     chrI   2706245      * |   4.10906
I only have the start number and not the range in IRanges.
gr <- GRanges(seqnames=neuron_df$seqnames,
              ranges = IRanges(neuron_df$start, end=neuron_df$end),
              strand = Rle(strand(c(rep("*", length(neuron_df$strand))))),
              Conc = neuron_df$V5)
I also try with this command but also in this case it don't work How I can solve this problem? Thank you
It's valid IRanges, it just doesn't show the end when printing to the screen because all of your ranges are a single base.
But when I try to do a matrix:
it is emty even if the output is like this
because I want to do a heatmap but is completely withe