biostrings package¶
Submodules¶
biostrings.dnastring module¶
- class biostrings.dnastring.DNAString(sequence, metadata=None, _validate=True)[source]¶
Bases:
BiocObjectA string container for a DNA sequence, similar to Bioconductor’s DNAString.
This class stores the sequence internally as bytes, enforcing the DNA alphabet.
- __copy__()[source]¶
Shallow copy of the object.
- Return type:
- Returns:
Same type as the caller, a shallow copy of this object.
- __deepcopy__(memo)[source]¶
Deep copy of the object.
- Parameters:
memo – Passed to internal
deepcopy()calls.- Return type:
- Returns:
Same type as the caller, a deep copy of this object.
- __hash__ = None¶
biostrings.dnastringset module¶
- class biostrings.dnastringset.DNAStringSet(sequences=None, names=None, _pool=None, _ranges=None, metadata=None, _validate=True)[source]¶
Bases:
BiocObjectA collection of DNA sequences, similar to Bioconductor’s DNAStringSet.
This class follows the “pool and ranges” model for high memory efficiency. All sequences are stored in a single concatenated ‘bytes’ object (the pool).
An ‘IRanges’ object tracks the start and width of each sequence in the pool.
- __annotations__ = {}¶
- __copy__()[source]¶
Shallow copy of the object.
- Return type:
- Returns:
Same type as the caller, a shallow copy of this object.
- __deepcopy__(memo)[source]¶
Deep copy of the object.
- Parameters:
memo – Passed to internal
deepcopy()calls.- Return type:
- Returns:
Same type as the caller, a deep copy of this object.
- __init__(sequences=None, names=None, _pool=None, _ranges=None, metadata=None, _validate=True)[source]¶
Create a DNAStringSet.
- Parameters:
sequences (
Optional[List[str]]) – A list of Python strings to initialize the set.names (
Union[List[str],Names,None]) – An optional list of names for the sequences._pool (internal) – Used by methods like __getitem__ to create new sets without copying data.
_ranges (internal) – Used by methods like __getitem__.
metadata (
Union[Dict[str,Any],NamedList,None]) – Additional metadata. If None, defaults to an empty dictionary.validate – Whether to validate the arguments, internal use only.
- get_names()[source]¶
Get range names.
- Return type:
Optional[Names]- Returns:
List containing the names for all ranges, or None if no names are present.
- set_names(names, in_place=False)[source]¶
- Parameters:
- Return type:
- Returns:
If
in_place = False, a newDNAStringSetis returned with the modified names. Otherwise, the current object is directly modified and a reference to it is returned.
- width()[source]¶
Alias to
get_width().- Return type: