Plasmid
in package
A Plasmid composes a CircularDnaSequence with the PlasmidFeature annotations that make sense of it, independently of any Doctrine entity, form or graphical rendering. Every method that changes the aggregate returns a new Plasmid; the feature list order given at construction is preserved.
Class Plasmid
Tags
Table of Contents
Properties
- $description : string|null
- $externalId : string|null
- $features : array<string|int, PlasmidFeature>
- $metadata : array<string|int, mixed>
- $name : string
- $sequence : CircularDnaSequence
Methods
- __construct() : mixed
- Plasmid constructor.
- extractFeatureSequence() : DnaSequence
- Extracts the symbols covered by $oFeature, wrapping past the origin when the feature crosses it. A REVERSE strand feature is returned as the reverse complement of the upper strand slice.
- getDescription() : string|null
- getExternalId() : string|null
- getFeatures() : array<string|int, PlasmidFeature>
- getFeaturesByType() : array<string|int, PlasmidFeature>
- getLength() : int
- getMetadata() : array<string|int, mixed>
- getName() : string
- getSequence() : CircularDnaSequence
- hasDuplicateFeatureNames() : bool
- True when at least two features share the exact same name. Duplicate names are tolerated (two genuinely distinct sites can be named alike by the source data) but reported for the caller to decide what to do about them.
- rotateToOrigin() : self
- Returns a new Plasmid whose sequence, and every feature's coordinates, are recomputed so that $iNewOrigin becomes the new position 1. Every feature keeps the same length and the same symbols; only its start and end, and possibly whether it crosses the origin, change.
- withFeature() : self
- Returns a new Plasmid with $oFeature appended to the feature list.
- assertFeatureFitsSequence() : void
- assertSerializableMetadata() : void
- Rejects metadata holding anything but scalars, null, or arrays of the same, recursively.
- shiftCoordinate() : int
- Recomputes a single 1-based inclusive coordinate after the sequence has been rotated so that the old zero-based position $iZeroBasedOrigin becomes the new position 0.
Properties
$description
private
string|null
$description
= null
$externalId
private
string|null
$externalId
= null
$features
private
array<string|int, PlasmidFeature>
$features
Ordered as given at construction, or after a withFeature() append
$metadata
private
array<string|int, mixed>
$metadata
Only scalars, null and arrays of the same, recursively
$name
private
string
$name
$sequence
private
CircularDnaSequence
$sequence
Methods
__construct()
Plasmid constructor.
public
__construct(string $sName, CircularDnaSequence $oSequence[, array<string|int, PlasmidFeature> $aFeatures = [] ][, string|null $sDescription = null ][, string|null $sExternalId = null ][, array<string|int, mixed>|null $aMetadata = null ]) : mixed
Parameters
- $sName : string
-
Must not be empty
- $oSequence : CircularDnaSequence
- $aFeatures : array<string|int, PlasmidFeature> = []
-
Every coordinate must fit within $oSequence's length
- $sDescription : string|null = null
- $sExternalId : string|null = null
- $aMetadata : array<string|int, mixed>|null = null
-
Only scalars, null and arrays thereof
Tags
extractFeatureSequence()
Extracts the symbols covered by $oFeature, wrapping past the origin when the feature crosses it. A REVERSE strand feature is returned as the reverse complement of the upper strand slice.
public
extractFeatureSequence(PlasmidFeature $oFeature) : DnaSequence
Parameters
- $oFeature : PlasmidFeature
Tags
Return values
DnaSequencegetDescription()
public
getDescription() : string|null
Return values
string|nullgetExternalId()
public
getExternalId() : string|null
Return values
string|nullgetFeatures()
public
getFeatures() : array<string|int, PlasmidFeature>
Return values
array<string|int, PlasmidFeature>getFeaturesByType()
public
getFeaturesByType(string $sType) : array<string|int, PlasmidFeature>
Parameters
- $sType : string
-
One of FeatureType::VALID_TYPES
Return values
array<string|int, PlasmidFeature> —In the same relative order as getFeatures()
getLength()
public
getLength() : int
Return values
intgetMetadata()
public
getMetadata() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
public
getName() : string
Return values
stringgetSequence()
public
getSequence() : CircularDnaSequence
Return values
CircularDnaSequencehasDuplicateFeatureNames()
True when at least two features share the exact same name. Duplicate names are tolerated (two genuinely distinct sites can be named alike by the source data) but reported for the caller to decide what to do about them.
public
hasDuplicateFeatureNames() : bool
Return values
boolrotateToOrigin()
Returns a new Plasmid whose sequence, and every feature's coordinates, are recomputed so that $iNewOrigin becomes the new position 1. Every feature keeps the same length and the same symbols; only its start and end, and possibly whether it crosses the origin, change.
public
rotateToOrigin(int $iNewOrigin) : self
Parameters
- $iNewOrigin : int
-
1-based inclusive position of the new origin
Return values
selfwithFeature()
Returns a new Plasmid with $oFeature appended to the feature list.
public
withFeature(PlasmidFeature $oFeature) : self
Parameters
- $oFeature : PlasmidFeature
Tags
Return values
selfassertFeatureFitsSequence()
private
assertFeatureFitsSequence(PlasmidFeature $oFeature) : void
Parameters
- $oFeature : PlasmidFeature
Tags
assertSerializableMetadata()
Rejects metadata holding anything but scalars, null, or arrays of the same, recursively.
private
assertSerializableMetadata(array<string|int, mixed> $aMetadata) : void
Parameters
- $aMetadata : array<string|int, mixed>
shiftCoordinate()
Recomputes a single 1-based inclusive coordinate after the sequence has been rotated so that the old zero-based position $iZeroBasedOrigin becomes the new position 0.
private
shiftCoordinate(int $iOneBasedPosition, int $iZeroBasedOrigin, int $iLength) : int
Parameters
- $iOneBasedPosition : int
- $iZeroBasedOrigin : int
- $iLength : int
Return values
int —1-based inclusive