Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __eq__(self, other):
return (
other.__class__ is Genome and
self._fields() == other._fields()
)
os.path.basename(ensembl_release.gtf_url))
transcript_fasta_urls = [
os.path.join(
args.custom_mirror,
os.path.basename(transcript_fasta_url))
for transcript_fasta_url in ensembl_release.transcript_fasta_urls
]
protein_fasta_urls = [
os.path.join(
args.custom_mirror,
os.path.basename(protein_fasta_url))
for protein_fasta_url in
ensembl_release.protein_fasta_urls
]
reference_name = ensembl_release.reference_name
genome = Genome(
reference_name=reference_name,
annotation_name="ensembl",
annotation_version=version,
gtf_path_or_url=gtf_url,
transcript_fasta_paths_or_urls=transcript_fasta_urls,
protein_fasta_paths_or_urls=protein_fasta_urls)
genomes.append(genome)
return genomes
ensembl_release=self.release,
species=self.species.latin_name,
sequence_type="ncrna",
server=server)
]
self.protein_fasta_urls = [
make_fasta_url(
ensembl_release=self.release,
species=self.species.latin_name,
sequence_type="pep",
server=self.server)]
self.reference_name = self.species.which_reference(self.release)
Genome.__init__(
self,
reference_name=self.reference_name,
annotation_name="ensembl",
annotation_version=self.release,
gtf_path_or_url=self.gtf_url,
transcript_fasta_paths_or_urls=self.transcript_fasta_urls,
protein_fasta_paths_or_urls=self.protein_fasta_urls)
def collect_selected_genomes(args):
# If specific genome source URLs are provided, use those
if args.gtf or args.transcript_fasta or args.protein_fasta:
if args.release:
raise ValueError(
"An Ensembl release cannot be specified if "
"specific paths are also given")
if not args.reference_name:
raise ValueError("Must specify a reference name")
if not args.annotation_name:
raise ValueError("Must specify the name of the annotation source")
return [Genome(
reference_name=args.reference_name,
annotation_name=args.annotation_name,
annotation_version=args.annotation_version,
gtf_path_or_url=os.path.join(args.shared_prefix, args.gtf),
transcript_fasta_paths_or_urls=[
os.path.join(args.shared_prefix, transcript_fasta)
for transcript_fasta in args.transcript_fasta],
protein_fasta_paths_or_urls=[
os.path.join(args.shared_prefix, protein_fasta)
for protein_fasta in args.protein_fasta])]
else:
return all_combinations_of_ensembl_genomes(args)
to be specific to (a particular release of) Ensembl.
"""
from weakref import WeakValueDictionary
from .genome import Genome
from .ensembl_release_versions import check_release_number, MAX_ENSEMBL_RELEASE
from .species import check_species_object, human
from .ensembl_url_templates import (
ENSEMBL_FTP_SERVER,
make_gtf_url,
make_fasta_url
)
class EnsemblRelease(Genome):
"""
Bundles together the genomic annotation and sequence data associated with
a particular release of the Ensembl database.
"""
@classmethod
def normalize_init_values(cls, release, species, server):
"""
Normalizes the arguments which uniquely specify an EnsemblRelease
genome.
"""
release = check_release_number(release)
species = check_species_object(species)
return (release, species, server)
# Using a WeakValueDictionary instead of an ordinary dict to prevent a
# memory leak in cases where we test many different releases in sequence.