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
        Advanced Methods for the Detection of Infectious Disease
        by seqadmin




        The recent pandemic caused worldwide health, economic, and social disruptions with its reverberations still felt today. A key takeaway from this event is the need for accurate and accessible tools for detecting and tracking infectious diseases. Timely identification is essential for early intervention, managing outbreaks, and preventing their spread. This article reviews several valuable tools employed in the detection and surveillance of infectious diseases.
        ...
        11-27-2023, 01:15 PM
      • seqadmin
        Strategies for Investigating the Microbiome
        by seqadmin




        Microbiome research has led to the discovery of important connections to human and environmental health. Sequencing has become a core investigational tool in microbiome research, a subject that we covered during a recent webinar. Our expert speakers shared a number of advancements including improved experimental workflows, research involving transmission dynamics, and invaluable analysis resources. This article recaps their informative presentations, offering insights...
        11-09-2023, 07:02 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 12-01-2023, 09:55 AM
      0 responses
      21 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 11-30-2023, 10:48 AM
      0 responses
      20 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 11-29-2023, 08:26 AM
      0 responses
      15 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 11-29-2023, 08:12 AM
      0 responses
      19 views
      0 likes
      Last Post seqadmin  
      Working...
      X