Insert a sequence into a database, and loads a array of objects

1

Starting code

This is the PHP code used by this example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public function parseaswissprotdb(DatabaseInterface $databaseManager)
{
    $databaseManager->recording("humandbSwiss", "SWISSPROT", "basicswiss.txt");
    // fetch() returns the parser that read the record, not the Sequence itself
    $oSequence = $databaseManager->fetch("1375", "data/")->getSequence();
 
    // New in biophp 1.1: wrap the parsed record into a validated amino acid value object
    $oMolecularSequence = MolecularSequenceFactory::fromEntity($oSequence);
    $bHasUnknownResidue = $oMolecularSequence->hasUnknownResidue();
 
    return $this->render('default/parseswissprotdb.html.twig',
        ["sequence" => $oSequence, "hasUnknownResidue" => $bHasUnknownResidue]
    );
}
2

Result

Result returned by BioPHP for the demonstration data.

Parsed record
Primary accessionP01375
Entry nameTNFA
Length233
Start / End /
Molecule typePRT;
Date21-JUL-1986
SourceHOMO SAPIENS (HUMAN)
DescriptionTUMOR NECROSIS FACTOR PRECURSOR (TNF-ALPHA) (CACHECTIN).
Organism
  • 0 : EUKARYOTA
  • 1 : METAZOA
  • 2 : CHORDATA
  • 3 : VERTEBRATA
  • 4 : TETRAPODA
  • 5 : MAMMALIA
  • 6 : EUTHERIA
  • 7 : PRIMATES
Fragment0
Sequence
MSTESMIRDVELAEEALPKKTGGPQGSRRCLFLSLFSFLIVAGATTLFCLLHFGVIGPQREEFPRDLSLISPLAQAVRSSSRTPSDKPVAHVVANPQAEGQLQWLNRRANALLANGVELRDNQLVVPSEGLYLIYSQVLFKGQGCPSTHVLLTHTISRIAVSYQTKVNLLSAIKSPCQRETPEGAEAKPWYEPIYLGGVFQLEKGDRLSAEINRPDYLDFAESGQVYFGIIAL
New in biophp 1.1: does it hold an unknown residue, computed by wrapping the record into an AminoAcidSequence value object ?
No

The code above is the one actually executed by this page. Find the other examples in the left-hand column, or the tools in BioTools.