Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_seq_aminoacid(cfg,din):
"""
Fetches sequences if mutation format is amino acid
:param cfg: configuration dict
:param din: input data
:returns dsequences: dataframe with sequences
"""
import pyensembl
#import ensembl object that would fetch genes
# ensembl = pyensembl.EnsemblRelease(release=cfg['genomerelease'])
ensembl = pyensembl.EnsemblRelease(species=pyensembl.species.Species.register(
latin_name=cfg['host'],
synonyms=[cfg['host']],
reference_assemblies={
cfg['genomeassembly']: (cfg['genomerelease'], cfg['genomerelease']),
}),release=cfg['genomerelease'])
din.index=range(len(din))
dbedp='{}/dbedflank.bed'.format(cfg['datad'])
dbed=pd.DataFrame(columns=bed_colns)
terrpositions=[]
terrnotfound=[]
terrnoncoding=[]
bedrowi=0
# for i in trange(len(din)-1,desc='get positions for bedtools'):
for i in din.index:
if din.loc[i,'transcript: id'] in ensembl.transcript_ids():
mouse = Species.register(
latin_name="mus_musculus",
synonyms=["mouse", "house mouse"],
reference_assemblies={
"NCBIM37": (54, 67),
"GRCm38": (68, MAX_ENSEMBL_RELEASE),
})
dog = Species.register(
latin_name="canis_familiaris",
synonyms=["dog"],
reference_assemblies={"CanFam3.1": (75, MAX_ENSEMBL_RELEASE)})
cat = Species.register(
latin_name="felis_catus",
synonyms=["cat"],
reference_assemblies={"Felis_catus_6.2": (75, MAX_ENSEMBL_RELEASE)})
chicken = Species.register(
latin_name="gallus_gallus",
synonyms=["chicken"],
reference_assemblies={
"Galgal4": (75, 85),
"Gallus_gallus-5.0": (86, MAX_ENSEMBL_RELEASE)})
# Does the black rat (Rattus Rattus) get used for research too?
brown_rat = Species.register(
latin_name="rattus_norvegicus",
synonyms=["brown rat", "lab rat", "rat"],
reference_assemblies={
return Species._latin_names_to_species[latin_name]
def check_species_object(species_name_or_object):
"""
Helper for validating user supplied species names or objects.
"""
if isinstance(species_name_or_object, Species):
return species_name_or_object
elif isinstance(species_name_or_object, str):
return find_species_by_name(species_name_or_object)
else:
raise ValueError("Unexpected type for species: %s : %s" % (
species_name_or_object, type(species_name_or_object)))
human = Species.register(
latin_name="homo_sapiens",
synonyms=["human"],
reference_assemblies={
"GRCh38": (76, MAX_ENSEMBL_RELEASE),
"GRCh37": (55, 75),
"NCBI36": (54, 54),
})
mouse = Species.register(
latin_name="mus_musculus",
synonyms=["mouse", "house mouse"],
reference_assemblies={
"NCBIM37": (54, 67),
"GRCm38": (68, MAX_ENSEMBL_RELEASE),
})
reference_assemblies={"CanFam3.1": (75, MAX_ENSEMBL_RELEASE)})
cat = Species.register(
latin_name="felis_catus",
synonyms=["cat"],
reference_assemblies={"Felis_catus_6.2": (75, MAX_ENSEMBL_RELEASE)})
chicken = Species.register(
latin_name="gallus_gallus",
synonyms=["chicken"],
reference_assemblies={
"Galgal4": (75, 85),
"Gallus_gallus-5.0": (86, MAX_ENSEMBL_RELEASE)})
# Does the black rat (Rattus Rattus) get used for research too?
brown_rat = Species.register(
latin_name="rattus_norvegicus",
synonyms=["brown rat", "lab rat", "rat"],
reference_assemblies={
"Rnor_5.0": (75, 79),
"Rnor_6.0": (80, MAX_ENSEMBL_RELEASE),
})
reference_assemblies={
"GRCh38": (76, MAX_ENSEMBL_RELEASE),
"GRCh37": (55, 75),
"NCBI36": (54, 54),
})
mouse = Species.register(
latin_name="mus_musculus",
synonyms=["mouse", "house mouse"],
reference_assemblies={
"NCBIM37": (54, 67),
"GRCm38": (68, MAX_ENSEMBL_RELEASE),
})
dog = Species.register(
latin_name="canis_familiaris",
synonyms=["dog"],
reference_assemblies={"CanFam3.1": (75, MAX_ENSEMBL_RELEASE)})
cat = Species.register(
latin_name="felis_catus",
synonyms=["cat"],
reference_assemblies={"Felis_catus_6.2": (75, MAX_ENSEMBL_RELEASE)})
chicken = Species.register(
latin_name="gallus_gallus",
synonyms=["chicken"],
reference_assemblies={
"Galgal4": (75, 85),
"Gallus_gallus-5.0": (86, MAX_ENSEMBL_RELEASE)})
"NCBIM37": (54, 67),
"GRCm38": (68, MAX_ENSEMBL_RELEASE),
})
dog = Species.register(
latin_name="canis_familiaris",
synonyms=["dog"],
reference_assemblies={"CanFam3.1": (75, MAX_ENSEMBL_RELEASE)})
cat = Species.register(
latin_name="felis_catus",
synonyms=["cat"],
reference_assemblies={"Felis_catus_6.2": (75, MAX_ENSEMBL_RELEASE)})
chicken = Species.register(
latin_name="gallus_gallus",
synonyms=["chicken"],
reference_assemblies={
"Galgal4": (75, 85),
"Gallus_gallus-5.0": (86, MAX_ENSEMBL_RELEASE)})
# Does the black rat (Rattus Rattus) get used for research too?
brown_rat = Species.register(
latin_name="rattus_norvegicus",
synonyms=["brown rat", "lab rat", "rat"],
reference_assemblies={
"Rnor_5.0": (75, 79),
"Rnor_6.0": (80, MAX_ENSEMBL_RELEASE),
})
elif isinstance(species_name_or_object, str):
return find_species_by_name(species_name_or_object)
else:
raise ValueError("Unexpected type for species: %s : %s" % (
species_name_or_object, type(species_name_or_object)))
human = Species.register(
latin_name="homo_sapiens",
synonyms=["human"],
reference_assemblies={
"GRCh38": (76, MAX_ENSEMBL_RELEASE),
"GRCh37": (55, 75),
"NCBI36": (54, 54),
})
mouse = Species.register(
latin_name="mus_musculus",
synonyms=["mouse", "house mouse"],
reference_assemblies={
"NCBIM37": (54, 67),
"GRCm38": (68, MAX_ENSEMBL_RELEASE),
})
dog = Species.register(
latin_name="canis_familiaris",
synonyms=["dog"],
reference_assemblies={"CanFam3.1": (75, MAX_ENSEMBL_RELEASE)})
cat = Species.register(
latin_name="felis_catus",
synonyms=["cat"],