Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • peterawe
    replied
    Hi! Here is a suggestion using R/Bioconductor. Good luck

    Code:
    require(rtracklayer)
    require(BSgenome.Hsapiens.UCSC.hg19)
    require(ShortRead)
    mirTrack = import('ftp://mirbase.org/pub/mirbase/20/genomes/hsa.gff3')
    
    # split into hairpin, 5arm and 3arm
    hp = mirTrack[mirTrack$type != "miRNA"]
    arm5 = mirTrack[grepl("-5p", mirTrack$Name)]
    arm3 = mirTrack[grepl("-3p", mirTrack$Name)]
    
    # make key for matching hairpin with arm5 and arm3
    hp$arm5 = match(hp$ID, arm5$Derives_from)
    hp$arm3 = match(hp$ID, arm3$Derives_from)
    
    # discard hairpins without annotated 5p and 3p arms
    hp = hp[!is.na(hp$arm3) & !is.na(hp$arm5)]
    
    # prepare
    hp$loopStart = 0
    hp$loopEnd = 0
    
    # miRNAs on pos and neg strand have to be parsed separately
    ## posStrand
    isPos = as.vector(strand(hp) =="+")
    hp$loopStart[isPos] = end(arm5[hp$arm5[isPos]])
    hp$loopEnd[isPos] = start(arm3[hp$arm3[isPos]])
    ## negStrand
    hp$loopEnd[!isPos] = start(arm5[hp$arm5[!isPos]])
    hp$loopStart[!isPos] = end(arm3[hp$arm3[!isPos]])
    # GRanges for miRNA loops
    loops = GRanges(seqnames = seqnames(hp),
    IRanges(hp$loopStart, hp$loopEnd),strand = strand(hp),
    MI = hp$ID, Name = hp$Name)
    # sanity check
    hist(width(loops), breaks = 50)
    # we dont want th efirst/last nt of bounding mature miRs
    loops = loops-1
    loops$seq = getSeq(Hsapiens, loops)
    # export
    loops
    loopsFasta = loops$seq
    names(loopsFasta) = paste("loop", loops$MI, loops$Name, sep = "_")
    writeFasta(loopsFasta, file = "mirbase20loops.fa")
    readLines("mirbase20loops.fa")

    Leave a comment:


  • peterawe
    replied
    Here is another suggestion using R/Bioconductor. Good luck!

    Code:
    require(rtracklayer)
    require(BSgenome.Hsapiens.UCSC.hg19)
    require(ShortRead)
    
    mirTrack = import('ftp://mirbase.org/pub/mirbase/20/genomes/hsa.gff3')
    
    # split into hairpin, 5arm and 3arm
    hp = mirTrack[mirTrack$type != "miRNA"]
    arm5 = mirTrack[grepl("-5p", mirTrack$Name)]
    arm3 = mirTrack[grepl("-3p", mirTrack$Name)]
    
    # make key for matching hairpin with arm5 and arm3
    hp$arm5 = match(hp$ID, arm5$Derives_from)
    hp$arm3 = match(hp$ID, arm3$Derives_from)
    
    # discard hairpins lacking annotated 5p and 3p arms (loops not defined)
    hp = hp[!is.na(hp$arm3) & !is.na(hp$arm5)]
    
    # prepare 
    hp$loopStart = 0
    hp$loopEnd = 0
    
    # miRNAs on pos and neg strand have to be parsed separately
    ## posStrand
    isPos = as.vector(strand(hp) =="+")
    hp$loopStart[isPos] = end(arm5[hp$arm5[isPos]])
    hp$loopEnd[isPos] = start(arm3[hp$arm3[isPos]])
    
    ## negStrand
    hp$loopEnd[!isPos] = start(arm5[hp$arm5[!isPos]])
    hp$loopStart[!isPos] = end(arm3[hp$arm3[!isPos]])
    
    # GRanges for miRNA loops
    loops = GRanges(seqnames = seqnames(hp), 
      IRanges(hp$loopStart, hp$loopEnd),strand = strand(hp), 
      MI = hp$ID, Name = hp$Name)
    
    # sanity check
    hist(width(loops))
    
    # we don't want the first/last nt of bounding mature miRs
    loops = loops-1
    loops$seq = getSeq(Hsapiens, loops) 
    loops
    
    # export as fastaFile
    loopsFasta = loops$seq
    names(loopsFasta) = paste("loopSeq", loops$MI, loops$Name, sep = "_")
    writeFasta(loopsFasta, file = "mirbase20loops.fa")

    Leave a comment:


  • dpryan
    replied
    I would expect that either biopython or bioperl should make this relatively straight forward. The idea is to either use base python string matching or the pairwise2 module and global alignment.

    Leave a comment:


  • Palgrave
    replied
    Originally posted by dpryan View Post
    Just align the 5p and 3p sequences to the hairpin sequence and take the bit between them.
    I have tried, but struggle to find a command that works.

    Leave a comment:


  • dpryan
    replied
    Just align the 5p and 3p sequences to the hairpin sequence and take the bit between them.

    Leave a comment:


  • Palgrave
    started a topic Get loop sequence from miRBase

    Get loop sequence from miRBase

    Does anyone know a way to extract the loop sequence from the miRNA hairpin. Basically I need to extract the part that is between the 3p- and 5p part of the hairpin.

Latest Articles

Collapse

  • seqadmin
    Recent Advances in Sequencing Technologies
    by seqadmin



    Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

    Long-Read Sequencing
    Long-read sequencing has seen remarkable advancements,...
    12-02-2024, 01:49 PM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by seqadmin, Today, 08:24 AM
0 responses
10 views
0 likes
Last Post seqadmin  
Started by seqadmin, Yesterday, 07:41 AM
0 responses
8 views
0 likes
Last Post seqadmin  
Started by seqadmin, 12-11-2024, 07:45 AM
0 responses
13 views
0 likes
Last Post seqadmin  
Started by seqadmin, 12-10-2024, 07:59 AM
0 responses
14 views
0 likes
Last Post seqadmin  
Working...
X