pandas_genomics.scalars.Variant¶
-
class
pandas_genomics.scalars.
Variant
(chromosome: Optional[str] = None, position: int = 0, id: Optional[str] = None, ref: Optional[str] = 'N', alt: Optional[Union[List[str], str]] = None, ploidy: Optional[int] = None, score: Optional[int] = None)[source]¶ Information about a variant.
- Parameters
- chromosome: str, optional
None by default, through this usually is not desired.
- position: int, optional
(1-based, the default is 0 for none/unknown)
- id: str, optional
None by default
- ref: str, optional
Reference allele, ‘N’ by default
- alt: List[str] or str, optional
One (or a list of) possible alternate alleles, empty list by default
- ploidy: int, optional
The number of alleles that should be present. Assumed to be 2 if not specified.
- score: int, optional
A quality score for the Variant. No assumptions are made about the meaning.
Notes
Missing alleles are shown as ., such as A/. or ./.
Examples
>>> variant = Variant('12', 112161652, id='rs12462', ref='A', alt=['C', 'T']) >>> print(variant) rs12462[chr=12;pos=112161652;ref=A;alt=C,T]
-
__init__
(chromosome: Optional[str] = None, position: int = 0, id: Optional[str] = None, ref: Optional[str] = 'N', alt: Optional[Union[List[str], str]] = None, ploidy: Optional[int] = None, score: Optional[int] = None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([chromosome, position, id, ref, …])Initialize self.
add_allele
(allele)Add a potential allele to the variant
as_dict
()Return the variant information as a dictionary
get_allele_from_idx
(idx)Get the allele corresponding to an index value for this variant
get_idx_from_allele
(allele[, add])Get the integer value for an allele based on this variant’s list of alleles, optionally adding it as a new allele
is_same_position
(other)Confirms this is a variant at the same position
is_valid_allele_idx
(idx)Validate the integer value for an allele with respect to this variant
make_genotype
(*alleles[, add_alleles])Create a Genotype object associated with this variant using the specified allele(s)
make_genotype_from_str
(gt_str[, sep, …])Create a Genotype object associated with this variant using the specified allele string
Attributes
alt
ref