How to rename seqlevels style (I, II, III, ...,XVI, Mito to 1,2,3,...16, 17.) in txdb granges?
1
0
Entering edit mode
vinod.acear ▴ 50
@vinodacear-8884
Last seen 4.2 years ago
India

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

 

 

 

renameSeqlevels mapSeqlevels grangeslist granges txdb • 1.5k views
ADD COMMENT
2
Entering edit mode
@hotz-hans-rudolf-3951
Last seen 4.1 years ago
Switzerland

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 COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 566 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