2017 © Pedro Peláez
 

nooku-component genes-component

image

stevenrombauts/genes-component

  • Tuesday, September 9, 2014
  • by stevenrombauts
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Genes Component

The Genes component is a reusable component for Nooku Framework. This is an example!, (*1)

By installing this component you can easily re-use the functionality its classes offer in your own components., (*2)

Installing

You can install this extension using Composer. Add the following requirements to your composer.json file in your Joomla application's root directory:, (*3)

{
    "require": {        
        "stevenrombauts/genes-component": "dev-master"
    },
    "minimum-stability": "dev"
}

Run composer install to take care of downloading and installing the package., (*4)

Examples

Gene entity

Having your entities extend the ComGenesModelEntityGene class will automatically add support for translating the DNA sequence into a protein sequence. Or call it directly:, (*5)

$sequence = <<<EOL
> A sequence
ATGCAGACTGACGATTCTTGGAAACATAATGTGTCGTTTTATACA
AATTTGGACTACACCGATAAGGATACCAAAATCAGTGCAGTTTAA
EOL;

$data = array(
     'identifier' => 'C02H7.2',
     'title'      => 'npr-19',
     'sequence'   => $sequence
);

$entity = KOBjectManager::getInstance()->getObject('com://stevenrombauts/genes.model.entity.gene', array('data' => $data));

echo $entity->protein;

Fasta filter

You can use the FASTA filter to validate and sanitize strings representings nucleotide sequences or peptide sequences., (*6)

Example:, (*7)

$filter = KObjectManager::getInstance()->getObject('com://stevenrombauts/genes.filter.fasta');

$sequence = <<<EOL
> LCBO - Prolactin precursor - Bovine
; a sample sequence in FASTA format
MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPN
EMFNEFDQVIPGAKETEPYPVWSGLPSLQTKDED
ARYSAFYNLLHCLRRDSSKIDTYLKLLNCRIIYNNNC*
EOL;

// This one should be valid:
echo ($filter->validate($sequence) === true ? "Valid sequence" : "Invalid sequence");

// Sanitizing will remove all characters that don't belong (line-breaks, comments, etc ..):
echo $filter->sanitize($sequence);

The Versions