[ensembl-dev] core API question

Magali mr6 at ebi.ac.uk
Fri Jul 19 15:35:46 BST 2013


Hi Nathalie,

The 'fetch_all_by_external_name' method will return a list which is in
fact composed of two lists:
first, all the genes on reference slices (chromosomes), then those on
alternate slices (LRGs, patches...)

So the first object returned will always be the gene you are looking for.

There is also a method called is_reference, which applied to a slice
will return 1 if it is part of the reference assembly, 0 if not.

So adding a (if $gene->slice->is_reference) condition to your script
will skip all genes which are on patches and the like.


Hope that helps,
mag

On 19/07/13 15:27, nconte at ebi.ac.uk wrote:
> HI,
> I am fetching ensembl genes from HGNC gene list using the core API
> I am using these methods below to fetch ensembl gene objects from my HGNC
> Ids called $key:
>
> my $all_genes=$gene_adaptor->fetch_all_by_external_name($key,'HGNC');
> #then I am parsing through my gene reflist to get gene related attributes
> print  OUTFILE2 $key, "\t",$value, "\t",defined($gene->external_name) ?
> 'map with '. scalar (@{$all_genes}). '  ensembl_gene(s):
> '.$gene->external_name :'no_ensembl_gene',"\t", defined($gene->stable_id)
> ? $gene->stable_id : 'no_stableID', "\n";
>
> for some genes I get ensmebl Ids for haplotypes or  LRG or pseudoautomosal
> or  assembly patches/fixes regions. see below
>  AIF1	1	map with 6  ensembl_gene(s): AIF1	ENSG00000206428
>  AIF1	1	map with 6  ensembl_gene(s): AIF1	ENSG00000235985
>  AIF1	1	map with 6  ensembl_gene(s): AIF1	ENSG00000234836
> AIF1	1	map with 6  ensembl_gene(s): AIF1	ENSG00000237727
> AIF1	1	map with 6  ensembl_gene(s): AIF1	ENSG00000204472
>  AIF1	1	map with 6  ensembl_gene(s): AIF1	ENSG00000235588
>
> I will like only to get the GRCh37 gene IDs with chr:start-end
> coordinates.In the abose example, only ENSG00000204472. Is there a clever
> way to do this using a API method, or my only chance is to test the
> $gene->seq_name content?
> many thanks
> Nathalie
>
>
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> Posting guidelines and subscribe/unsubscribe info: http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/





More information about the Dev mailing list