<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Monica,<br>
    <br>
    In your script, you are trying to call two methods which do not
    exist, refseq_mrna and hgnc_symbol.<br>
    Unless these have been defined later in your script, we do not have
    a direct method in ensembl to do this.<br>
    <br>
    HGNC symbols and Refseq mRNAs are attached to a gene object as an
    external reference.<br>
    Via the API, these can be accesses using the get_all_DBLinks method.<br>
    <br>
    For example, to get the hgnc symbol of a gene object, you could do
    the following:<br>
    <blockquote>my $hgnc_xrefs = $gene->get_all_DBLinks('HGNC');<br>
      foreach my $xref (@$hgnc_xrefs) {<br>
          print $xref->display_id . "\n";<br>
      }<br>
      <br>
    </blockquote>
    The same would work for RefSeq mRNAs<br>
    <blockquote>my $refseq_xrefs =
      $gene->get_all_DBLinks('Refseq_mRNA');<br>
      foreach my $xref (@$refseq_xrefs) {<br>
          print $xref->display_id . "\n";<br>
      }<br>
    </blockquote>
    <br>
    On a side note, in your script you set a logic_name
    'refseq_human_import'.<br>
    If you want to restrict your study to that specific logic_name, you
    can specify it when fetching genes<br>
    <blockquote>my $genes = $slice->get_all_Genes($logic_name);<br>
    </blockquote>
    Do bear in mind though that the gene models from the
    refseq_human_import analysis are in the otherfeatures database for
    human, not in the core one.<br>
    Hence, you would need to change your adaptor call<br>
    <blockquote>my $slice_adaptor = $registry->get_adaptor('Human',
      'otherfeatures', 'Slice');<br>
    </blockquote>
    <br>
    Hope that helps.<br>
    <br>
    <br>
    Regards,<br>
    Magali<br>
    <br>
    <div class="moz-cite-prefix">On 25/06/13 13:12, Manam, Monica
      (NIH/NCI) [F] wrote:<br>
    </div>
    <blockquote
      cite="mid:11DC039F3170B8418685189040BEEF7027F2B7@MLBXV10.nih.gov"
      type="cite">
      <pre wrap="">Hello Dev Team !

The API version used is 71.

I am an intern at the NIH(National Institutes Of health), Bethesda. I am working on a project & I need the ensembl API to extract the ref_seq mrna & HGNC symbol for a given gene .

I tried to use the following but got no results, I was getting an exception

"refseq_mrna not known " :



sub feature2string

{

    my $feature = shift;


    my $stable_id  = $feature->stable_id();

    my $seq_region = $feature->slice->seq_region_name();

    my $start      = $feature->start();

    my $end        = $feature->end();

    my $strand     = $feature->strand();


    return sprintf( "%s: %s:%d-%d (%+d)",

        $stable_id, $seq_region, $start, $end, $strand );


}

my $logic_name= 'refseq_human_import';


my $slice_adaptor = $registry->get_adaptor( 'Human', 'Core', 'Slice' );

my $slice = $slice_adaptor->fetch_by_region( 'chromosome', '2',17997763,17998368);


my $genes = $slice->get_all_Genes();

while ( my $gene = shift @{$genes} ) {

    my $gstring = feature2string($gene);

    print "$gstring\n";




 my $transcripts = $gene->get_all_Transcripts();

    while ( my $transcript = shift @{$transcripts} ) {

        my $tstring = feature2string($transcript);

        print "\t$tstring\n";

        print $logic_name."\tGene_biotype=".$gene->biotype.

            "\tTranscript_name=".$transcript->stable_id."\tTranscript_biotype=".$transcript->biotype."\n";

       print $logic_name."\tGene_refseq=".$gene->refseq_mrna."\n";


 print $logic_name."\tGene_hgnc=".$gene->hgnc_symbol."\n";


Could you kindly help me with this, asap. As this is a time constrained project.


Thanks,

Monica Manam

NIH- Intern 2013

_______________________________________________
Dev mailing list    <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
Posting guidelines and subscribe/unsubscribe info: <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>