Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Ensembl database fetch sequence problem

    hello
    i just download the mySQL data from Ensembl
    and successful construct the database (homo spaien core 73)
    but my problem is if i had a ENST ID (ex: ENST00000575820)
    how do i fetch the sequence via the database?
    i already read the manual but haven't found any info how to do it.
    plz help me , thanks!

  • #2
    It's not straight forward, since you'll need to retrieve all the exons and join them by hand.
    Here's a bit of Python + SQL that yields all transcript_id->cDNA pairs - I'm sure you can adapt it (works for any revision >= 65)
    You'll also need your own reverse complement function...

    Code:
          cur.execute("""SELECT 
                            exon.seq_region_id, 
                            exon.seq_region_start, 
                            exon.seq_region_end, 
                            exon.seq_region_strand,
                            transcript.stable_id
                            FROM
                            exon, exon_transcript, transcript, seq_region
                            WHERE
                            exon.exon_id = exon_transcript.exon_id AND
                            transcript.transcript_id = exon_transcript.transcript_id 
                            AND seq_region.seq_region_id = exon.seq_region_id
                            AND seq_region.seq_region_id = %s
                            ORDER by exon_transcript.transcript_id, exon.seq_region_start
                            """, ( seq_region_id,))
                chr_seq = self.get_chromosome_sequence(conn, seq_region_id, seq_region_length)
    
                for transcript_id, rows in itertools.groupby(cur.fetchall(), lambda x: x[4]):
                    rows = list(rows)
                    strand = rows[0][3] 
                    seqs = []
                    #print transcript_id, rows
                    for row in rows:
                        seqs.append(chr_seq[row[1] - 1:row[2]]) #ensembl intervals are 1 based, inclusive.
                    if strand == 1:
                        seq = "".join(seqs)
                    else:
                        seq = common.reverse_complement("".join(seqs)).upper()
                    found = True
                    yield (transcript_id, seq)
    Best regards,
    F

    Comment


    • #3
      We suggest the Ensembl Core Perl API or REST API for getting sequences from genes and transcripts. The MySQL query as you see is inefficient and involved, and the APIs are designed for fast and simpler querying:



      Comment

      Latest Articles

      Collapse

      • seqadmin
        Techniques and Challenges in Conservation Genomics
        by seqadmin



        The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

        Avian Conservation
        Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
        03-08-2024, 10:41 AM
      • seqadmin
        The Impact of AI in Genomic Medicine
        by seqadmin



        Artificial intelligence (AI) has evolved from a futuristic vision to a mainstream technology, highlighted by the introduction of tools like OpenAI's ChatGPT and Google's Gemini. In recent years, AI has become increasingly integrated into the field of genomics. This integration has enabled new scientific discoveries while simultaneously raising important ethical questions1. Interviews with two researchers at the center of this intersection provide insightful perspectives into...
        02-26-2024, 02:07 PM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 03-14-2024, 06:13 AM
      0 responses
      34 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-08-2024, 08:03 AM
      0 responses
      74 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-07-2024, 08:13 AM
      0 responses
      82 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-06-2024, 09:51 AM
      0 responses
      68 views
      0 likes
      Last Post seqadmin  
      Working...
      X