@@ -3436,36 +3436,34 @@ cdef class VariantRecordSample(object):
34363436 """ Data for a single sample from a :class:`VariantRecord` object. Provides data accessors for
34373437 genotypes and a mapping interface from FORMAT fields to values.
34383438
3439- Notes
3440- -----
3441- The :class:`VariantRecordSample` object implements a mapping-like object for a specific
3442- VCF/BCF row and sample column. The keys are FORMAT fields and the values are the values in
3443- the VCF/BCF file. There is special handling for "GT", through the :attr:`alleles`,
3444- :attr:`allele_indices` and :attr:`phased` attributes. There is also a :attr:`name` property
3445- that provides the sample's name.
3446-
3447- Examples
3448- --------
3449- Here is an example of accessing and printing the data in a :class:`VariantRecordSample`::
3450-
3451- variant_file = pysam.VariantFile('/path/to/file.vcf.gz')
3452- for variant_record in variant_file.fetch():
3453- for sample_name in variant_record.samples:
3454- variant_record_sample = variant_record.samples[sample_name]
3455- variant_record_sample["GT"] = (0, 1)
3456- print(dict(variant_record_sample))
3457-
3458- The above code will print the following::
3459-
3460- {
3461- 'AD': (0, 80),
3462- 'DP': 79,
3463- 'GQ': 32,
3464- 'GT': (0, 1),
3465- 'PL': (33, 34, 0),
3466- 'VAF': (1.0,)},
3467- 'PS': None
3468- }
3439+ Notes:
3440+ The :class:`VariantRecordSample` object implements a mapping-like object for a specific
3441+ VCF/BCF row and sample column. The keys are FORMAT fields and the values are the values in
3442+ the VCF/BCF file. There is special handling for "GT", through the :attr:`alleles`,
3443+ :attr:`allele_indices` and :attr:`phased` attributes. There is also a :attr:`name` property
3444+ that provides the sample's name.
3445+
3446+ Examples:
3447+ Here is an example of accessing and printing the data in a :class:`VariantRecordSample`::
3448+
3449+ variant_file = pysam.VariantFile('/path/to/file.vcf.gz')
3450+ for variant_record in variant_file.fetch():
3451+ for sample_name in variant_record.samples:
3452+ variant_record_sample = variant_record.samples[sample_name]
3453+ variant_record_sample["GT"] = (0, 1)
3454+ print(dict(variant_record_sample))
3455+
3456+ The above code will print the following::
3457+
3458+ {
3459+ 'AD': (0, 80),
3460+ 'DP': 79,
3461+ 'GQ': 32,
3462+ 'GT': (0, 1),
3463+ 'PL': (33, 34, 0),
3464+ 'VAF': (1.0,)},
3465+ 'PS': None
3466+ }
34693467 """
34703468 def __init__ (self , *args , **kwargs ):
34713469 raise TypeError (' this class cannot be instantiated from Python' )
@@ -3594,14 +3592,12 @@ cdef class VariantRecordSample(object):
35943592 def get (self , key , default = None ):
35953593 """ Retrieve sample data for FORMAT field `key`. If `key` is not present, return `default`.
35963594
3597- Parameters
3598- ----------
3599-
3600- key : str
3601- FORMAT field to retrieve for the sample.
3602- default
3603- Data to return if the `key` is not present in the FORMAT field for the sample.
3604- Defaults to `None`.
3595+ Parameters:
3596+ key : str
3597+ FORMAT field to retrieve for the sample.
3598+ default
3599+ Data to return if the `key` is not present in the FORMAT field for the sample.
3600+ Defaults to `None`.
36053601 """
36063602 try :
36073603 return self [key]
@@ -3644,11 +3640,9 @@ cdef class VariantRecordSample(object):
36443640 def update (self , items = None , **kwargs ):
36453641 """ Update the FORMAT field values for this sample.
36463642
3647- Parameters
3648- ----------
3649-
3650- items : dict | None
3651- A dictionary or dictionary-like object used to update the FORMAT field names and values.
3643+ Parameters:
3644+ items : dict | None
3645+ A dictionary or dictionary-like object used to update the FORMAT field names and values.
36523646 """
36533647 for k, v in items.items():
36543648 self [k] = v
@@ -3660,23 +3654,19 @@ cdef class VariantRecordSample(object):
36603654 def pop (self , key , default = _nothing):
36613655 """ Remove the FORMAT field `key` for this sample and returns its value.
36623656
3663- Parameters
3664- ----------
3665-
3666- key : str
3667- FORMAT field to retrieve for the sample.
3668- default: Any
3669- Data to return if the `key` is not present.
3657+ Parameters:
3658+ key : str
3659+ FORMAT field to retrieve for the sample.
3660+ default
3661+ Data to return if the `key` is not present.
36703662
3671- Raises
3672- ------
3673- KeyError
3674- When the `key` is not present and `default` is unset.
3663+ Raises:
3664+ KeyError
3665+ When the `key` is not present and `default` is unset.
36753666
3676- Returns
3677- -------
3678- value
3679- The value of the removed FORMAT field for this sample.
3667+ Returns:
3668+ value
3669+ The value of the removed FORMAT field for this sample.
36803670 """
36813671
36823672 try :
0 commit comments