ensimpl_snps.fetch package¶
Submodules¶
ensimpl_snps.fetch.get module¶
ensimpl_snps.fetch.search module¶
-
ensimpl_snps.fetch.search.
by_ids
(ids, version, species)¶ Perform the search for ids.
Parameters: Returns: A
dict
withe keys returnsnps
andsnps_not_found
.Return type: Raises: ValueError
– When ids is empty.
-
ensimpl_snps.fetch.search.
by_region
(region, version, species, limit=None)¶ Perform the search by region.
Parameters: Returns: All the SNPs in region. Each element is another
list
with the following values:- chromosome
- position
- SNP identifier
- reference allele
- alternate allele
Return type: Raises: ValueError
– When region is empty.
ensimpl_snps.fetch.utils module¶
-
class
ensimpl_snps.fetch.utils.
Region
¶ Bases:
object
Encapsulates a genomic region.
-
chromosome
¶ str – The chromosome name.
-
start_position
¶ int – The start position.
-
end_position
¶ int – The end position.
-
-
ensimpl_snps.fetch.utils.
connect_to_database
(version, species)¶ Connect to the Ensimpl database.
Parameters: Returns: a connection to the database
-
ensimpl_snps.fetch.utils.
get_multiplier
(factor)¶ Get multiplying factor.
The factor value should be ‘mb’, ‘m’, or ‘k’ and the correct multiplier will be returned.
Parameters: factor (str) – One of ‘mb’, ‘m’, or ‘k’. Returns: The multiplying value. Return type: int
-
ensimpl_snps.fetch.utils.
get_tabix_file
(version, species)¶ Get the tabix file.
Parameters: Returns: A file location.
Return type:
-
ensimpl_snps.fetch.utils.
nvl
(value, default)¶ Returns value if value has a value, else default.
Parameters: - value – The value to evaluate.
- default – The default value.
Returns: Either value or default.
-
ensimpl_snps.fetch.utils.
nvli
(value, default)¶ Returns value as an int if value can be converted, else default.
Parameters: - value – The value to evaluate and convert to an it.
- default – The default value.
Returns: Either value or default.
-
ensimpl_snps.fetch.utils.
str_to_region
(location)¶ Parse a string into a genomic location.
Parameters: location (str) – The genomic location (range). Returns: A region object. Return type: Region Raises: ValueError
– If location is invalid.