Search
Question: How to rename seqlevels style (I, II, III, ...,XVI, Mito to 1,2,3,...16, 17.) in txdb granges?
0
gravatar for vinod.acear
20 months ago by
vinod.acear20
India
vinod.acear20 wrote:

Hi , i am trying to rename the seqlevels of granges (feat_ranges) from type  I, II, III, ...,VII, Mito   to 1,2,3,...16, 17. Here are steps that i took but didn't worked for me. 

>library(GenomicFeatures); library("biomaRt"); library(systemPipeR);library(GenomeInfoDb)
>txdb <- makeTxDbFromBiomart(biomart = "ensembl", dataset = "scerevisiae_gene_ensembl")
>myfeatures <- c("tx_type", "promoter", "intron", "exon", "cds", "intergenic")
>feat_ranges <- genFeatures(txdb, featuretype=myfeatures, reduce_ranges=FALSE, upstream=1000, downstream=0)newStyle=mapSeqlevels(seqlevels(feat), as.character(c(1:17)))feat=renameSeqlevels(feat,newStyle)

>newStyle=mapSeqlevels(seqlevels(feat),as.character(c(1:16))) # did not worked for me

> feat_ranges
GRangesList object of length 12:
$protein_coding 
GRanges object with 6692 ranges and 3 metadata columns:
      seqnames         ranges strand   |      feature_by featuretype_id    featuretype
         <Rle>      <IRanges>  <Rle>   | <CharacterList>    <character>    <character>
             I [  335,   649]      +   |         YAL069W        YAL069W protein_coding
             I [  538,   792]      +   |       YAL068W-A      YAL068W-A protein_coding
             I [ 2480,  2707]      +   |       YAL067W-A      YAL067W-A protein_coding
             I [10091, 10399]      +   |         YAL066W        YAL066W protein_coding
             I [12046, 12426]      +   |       YAL064W-B      YAL064W-B protein_coding
  ...      ...            ...    ... ...             ...            ...            ...
          Mito [65770, 66174]      +   |           Q0182          Q0182 protein_coding
          Mito [73758, 74513]      +   |           Q0250          Q0250 protein_coding
          Mito [74495, 75984]      +   |           Q0255          Q0255 protein_coding
          Mito [79213, 80022]      +   |           Q0275          Q0275 protein_coding
          Mito [85554, 85709]      +   |           Q0297          Q0297 protein_coding

...
<11 more elements>
-------
seqinfo: 17 sequences (1 circular) from an unspecified genome

 

 

 

ADD COMMENTlink modified 20 months ago • written 20 months ago by vinod.acear20
2
gravatar for Hotz, Hans-Rudolf
20 months ago by
Switzerland
Hotz, Hans-Rudolf380 wrote:

Hi

 

I might miss something here, but why not just:

 

> seqlevels(feat_ranges)
 [1] "I"    "II"   "III"  "IV"   "V"    "VI"   "VII"  "VIII" "IX"   "X"   
[11] "XI"   "XII"  "XIII" "XIV"  "XV"   "XVI"  "Mito"
>

> seqlevels(feat_ranges) <- as.character(c(1:17))

> feat_ranges
GRangesList object of length 12:
$protein_coding
GRanges object with 6692 ranges and 3 metadata columns:
      seqnames         ranges strand   |      feature_by featuretype_id
         <Rle>      <IRanges>  <Rle>   | <CharacterList>    <character>
             1 [  335,   649]      +   |         YAL069W        YAL069W
             1 [  538,   792]      +   |       YAL068W-A      YAL068W-A
             1 [ 2480,  2707]      +   |       YAL067W-A      YAL067W-A
             1 [10091, 10399]      +   |         YAL066W        YAL066W
             1 [12046, 12426]      +   |       YAL064W-B      YAL064W-B
  ...      ...            ...    ... ...             ...            ...
            17 [65770, 66174]      +   |           Q0182          Q0182
            17 [73758, 74513]      +   |           Q0250          Q0250
            17 [74495, 75984]      +   |           Q0255          Q0255
            17 [79213, 80022]      +   |           Q0275          Q0275
            17 [85554, 85709]      +   |           Q0297          Q0297
         featuretype
         <character>
      protein_coding
      protein_coding
      protein_coding
      protein_coding
      protein_coding
  ...            ...
      protein_coding
      protein_coding
      protein_coding
      protein_coding
      protein_coding

...
<11 more elements>
-------
seqinfo: 17 sequences (1 circular) from an unspecified genome
>

 

Regards, Hans-Rudolf

ADD COMMENTlink written 20 months ago by Hotz, Hans-Rudolf380

Oh great, it really worked for me. Thanks Hans-Rudolf

ADD REPLYlink written 20 months ago by vinod.acear20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 146 users visited in the last hour