PHPackages                             biotorrents/biophp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. biotorrents/biophp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

biotorrents/biophp
==================

BioPHP implements some light tools for manipulating genomic data

03[1 issues](https://github.com/biotorrents/biophp/issues)PHPCI passing

Since May 18Pushed 11mo agoCompare

[ Source](https://github.com/biotorrents/biophp)[ Packagist](https://packagist.org/packages/biotorrents/biophp)[ RSS](/packages/biotorrents-biophp/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

BioPHP - PHP Bioinformatics class
=================================

[](#biophp---php-bioinformatics-class)

BioPHP implements a selection of simple tools for manipulating genomic data. It aims to build tools for basic RNA, DNA, and protein manipulation. BioTorrents.de's fork is designed for [biotorrents/gazelle](https://github.com/biotorrents/gazelle)and is heavily inspired by [TimothyStiles/poly](https://github.com/TimothyStiles/poly).

Simple Usage (to be revised)
============================

[](#simple-usage-to-be-revised)

Find Reverse Complement
-----------------------

[](#find-reverse-complement)

```
$BioPHP = new BioPHP();
$result = $BioPHP->reverse('ATGAAAGCATC');
$result = $BioPHP->complement($result);
//prints TTTCAT
```

Calculate GC Content
--------------------

[](#calculate-gc-content)

```
$BioPHP = new BioPHP();
echo $BioPHP->gcContent('ATGAAAGCATC', 4)."\n";
//prints 36.3636
```

Count Point Mutations Between Two Sequences
-------------------------------------------

[](#count-point-mutations-between-two-sequences)

```
$BioPHP = new BioPHP();
echo $BioPHP->countPointMutations('CTGATGATGGGAGGAAATTTCA','CTGATGATGCGAGGGAATATCG')."\n";
//prints 4
```

Translate DNA Sequence to Amino Acid Sequence
---------------------------------------------

[](#translate-dna-sequence-to-amino-acid-sequence)

```
$BioPHP = new BioPHP();
echo $BioPHP->translateDna('CTGATGATGGGAGGAAATTTCAGA')."\n";
//prints LMMGGNFR
```

Calculate Monoisotopic Mass
---------------------------

[](#calculate-monoisotopic-mass)

```
$BioPHP = new BioPHP();
$proteinSequence = $BioPHP->translateDna('CTGATGATGGGAGGAAATTTCAGA')."\n";
echo $BioPHP->calcMonoIsotopicMass($proteinSequence)."\n\n";
//prints 906.42041
```

Finding a Motif in DNA
----------------------

[](#finding-a-motif-in-dna)

```
$BioPHP = new BioPHP();
echo $BioPHP->findMotifDNA('ATAT', 'GTATATCTATATGGCCATAT')."\n";
//prints 3 9 17
```

Get Reading Frames
------------------

[](#get-reading-frames)

```
$BioPHP = new BioPHP();
print_r( $BioPHP->getReadingFrames('GTATATCTATATGGCCATAT') );

/*
* returns array containing...
Array
(
    [0] => GTATATCTATATGGCCATAT
    [1] => TATATCTATATGGCCATAT
    [2] => ATATCTATATGGCCATAT
)
*/

//Protip: To get all 6 reading frames. Use the reverse and complement methods, then pass the result to getReadingFrames()
```

Find most common likely ancestor
--------------------------------

[](#find-most-common-likely-ancestor)

```
$fastaSequence = "
>Sequence 1
ATCCAGCT
>Sequence 2
GGGCAACT
>Sequence 3
ATGGATCT
";

$BioPHP = new BioPHP();
$fastaArray = $BioPHP->readFasta($fastaSequence); //read and parse the sequences
echo $BioPHP->mostLikelyCommonAncestor($fastaArray)."\n";

//prints ATGCAACT
```

Get a fasta result from Uniprot and calculate isotpoic mass
-----------------------------------------------------------

[](#get-a-fasta-result-from-uniprot-and-calculate-isotpoic-mass)

```
$BioPHP = new BioPHP();
$uniprotFasta =  $BioPHP->getUniprotFastaByID("B5ZC00"); //returns the result from Uniprot as a string
$fastaArray = $BioPHP->readFasta($uniprotFasta); //parses the response
echo $BioPHP->calcMonoIsotopicMass($fastaArray[0]['sequence'])."\n";

//prints 55319.0636
```

Find protein motif using a variable "shorthand" motif search
------------------------------------------------------------

[](#find-protein-motif-using-a-variable-shorthand-motif-search)

```
$BioPHP = new BioPHP();
$results = $BioPHP->findMotifProtein("N{P}[ST]{P}","B5ZC00");
print_r($results);

/*
* returns array containing...
Array
(
    [0] => 85
    [1] => 118
    [2] => 142
    [3] => 306
    [4] => 395
)
*/

//Notes: The second parameter expects a protein access ID string used to lookup the full sequence via UniProt.
```

Finding a shared motif
----------------------

[](#finding-a-shared-motif)

This task can be very CPU intensive. Using PHP 7, this method benchmarked faster than Python! Runtime results were about 1 second with a collection of 100 DNA strings of length 1 kbp each.

```
$fasta="
>Sequence 1
GATTACA
>Sequence 2
TAGACCA
>Sequence 3
ATACA";

$BioPHP = new BioPHP();
$fastaArray = $BioPHP->readFasta($fasta);
$result = $BioPHP->findLongestSharedMotif($fastaArray);
echo $result."\n";
//prints TA
```

Find open reading frames from DNA sequnce
-----------------------------------------

[](#find-open-reading-frames-from-dna-sequnce)

```
$Sequence = ">Test DNA Sequence
TCCCCGGACTCCAAACGCTCGGTAGCCGCCCCTGCTCGACATATTTAGCTCCCTGCATTG
ACGCCCTGGCAGCCCCGATCAATTTTCGTGGTTAAACGCGCGCTCGCAAGGGACATCGAC
CGGACCACAGAGCATAGCATGCCTTAGGATCGCCTGTCACTGTTCGTCTCCCTATTTGAG
CACTGTAGCCCCTGGTACCCCCGTCCTGAAGCGTGTGTGATACACGGTCTGCCCAAGATG
";

$BioPHP = new BioPHP();
$results = $BioPHP->printORFProteins($Sequence);
print_r($results);

/*
* Returns the following array
Array
(
    [0] => MP
    [1] => MLCGPVDVPCERAFNHEN
    [2] => MLCSVVRSMSLASARLTTKIDRGCQGVNAGS
    [3] => MSLASARLTTKIDRGCQGVNAGS
)

*/
```

Locating restriction sites between length of 4 and 12
-----------------------------------------------------

[](#locating-restriction-sites-between-length-of-4-and-12)

```
$BioPHP = new BioPHP();
$results = $BioPHP->findRestrictionSites("TCAATGCATGCGGGTCTATATGCAT", 4, 12);
//returns an array containing postion and length of restrictions
```

Inferring mRNA from Protein - calculates total different RNA strings from which the protein can be translated
-------------------------------------------------------------------------------------------------------------

[](#inferring-mrna-from-protein---calculates-total-different-rna-strings-from-which-the-protein-can-be-translated)

### Note: This method requires the use of the PHP Math Big Integer package which is a composer dependency of this project.

[](#note-this-method-requires-the-use-of-the-php-math-big-integer-package-which-is-a-composer-dependency-of-this-project)

```
$BioPHP = new BioPHP();
$result = $BioPHP->inferringMRnaFromProteinCount("MTIFMFHNKNICTEYMGYYDQQIMQTEHKWYWDFHTFMIPNVFYEDVIKFKMRMLMIPNCFFGPWLFCKLEKCQYYEKATEPAPIVKDYTLFATGGAGREATFWPWFWTDENRPKDYYFQRDGLHHRNEPRLPHATCRRAYYQCEMIQYAIVTSCVLLAWKMFTDYGHTGVASEPKEPQEDIKCMKFPHMSWQKTLTEAFYELFPCYPEEFPNDRPWLLGHGFGPIVCTITAIDTTDVAKNIWKAVFRPHAGNWDIGFHSPCASEGCPDIMFPYFTCHDYKGMMCCFNLTMEVCCKQPRPTGIYMMVERMRIMNNREFAGFKHYREEHIKHYWRFGIFASPFVICWSPKTKGPPTSDWYMRDSEVVTQESELKESWQDMMEQHSMFGIPHCEKERWMNDNWKCKLFYYEVILWISNCECDQHVNCCVAHDPGTQVDWAWTLDMWWDQKYFGFFVRKKGQKYNMHWGAPYWLTNPTEKKDFIQHEQLGPLQTFRHCSSPAPT");
echo $result."\n";
//prints 884608
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/61da7341f1378c05fd43bff67df4490d0a9bd53dc80938ef424f678e764f5464?d=identicon)[pjc09h](/maintainers/pjc09h)

---

Top Contributors

[![kennypavan](https://avatars.githubusercontent.com/u/1902873?v=4)](https://github.com/kennypavan "kennypavan (61 commits)")[![jeremiahscanlon](https://avatars.githubusercontent.com/u/8504998?v=4)](https://github.com/jeremiahscanlon "jeremiahscanlon (2 commits)")[![pjc09h](https://avatars.githubusercontent.com/u/48838413?v=4)](https://github.com/pjc09h "pjc09h (2 commits)")

---

Tags

bioinformaticsbioinformatics-scriptscomposerlibrary

### Embed Badge

![Health badge](/badges/biotorrents-biophp/health.svg)

```
[![Health](https://phpackages.com/badges/biotorrents-biophp/health.svg)](https://phpackages.com/packages/biotorrents-biophp)
```

###  Alternatives

[steevanb/doctrine-stats

Count managed and lazy loaded entities, hydration time etc

7182.9k1](/packages/steevanb-doctrine-stats)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
