Source of file ChromosomeProteinEntry.php

Size: 3,027 Bytes - Last Modified: 2017-12-06T17:10:31+00:00

src/Core/ProteinEntry/ChromosomeProteinEntry.php

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartValid
5960616263
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndValid
6465666768
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountValid
6970717273
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesValid
7475767778
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartInvalid1
79
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartInvalid1
80
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartInvalid1
81
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartInvalid1
8283
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartInvalid1
8485
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartValid
86
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionsStartValid
87888990
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndInvalid
91
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndInvalid
92
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndInvalid
939495
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndValid
96
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetPositionEndValid
979899100
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountInvalid
101
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountInvalid
102
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountInvalid
103104105
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountValid
106
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockCountValid
107108109110
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesInvalid
111
Covered by 2 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesValid
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesInvalid
112
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesInvalid
113
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesInvalid
114115
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesValid
116117
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesValid
118
Covered by 1 test(s):
  • pgb_liv\php_ms\Test\Unit\ChromosomeProteinEntryTest::testCanGetSetBlockSizesValid
119120
<?php
/**
 * Copyright 2016 University of Liverpool
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace pgb_liv\php_ms\Core\ProteinEntry;

/**
 * A protein entity object for adding references to a protein object.
 * Allows items such as peptides to link to specific sections of a protein string
 *
 * @author Andrew Collins
 */
class ChromosomeProteinEntry extends ProteinEntry
{

    /**
     * Chromosome start positions
     *
     * @var array
     */
    private $starts = array();

    /**
     * Chromosome end position
     *
     * @var int
     */
    private $end;

    /**
     * Chromosome block count
     *
     * @var int
     */
    private $blockCount;

    /**
     * Chromosome block sizes
     *
     * @var array
     */
    private $blockSizes = array();

    public function getChromosomePositionsStart()
    {
        return $this->starts;
    }

    public function getChromosomePositionEnd()
    {
        return $this->end;
    }

    public function getChromosomeBlockCount()
    {
        return $this->blockCount;
    }

    public function getChromosomeBlockSizes()
    {
        return $this->blockSizes;
    }

    public function setChromosomePositionsStart(array $positions)
    {
        foreach ($positions as $position) {
            if (! is_int($position)) {
                throw new \InvalidArgumentException(
                    'Argument 1 must be an array of type integer. Argument type is ' . gettype($position));
            }
        }
        
        $this->starts = $positions;
    }

    public function setChromosomePositionEnd($position)
    {
        if (! is_int($position)) {
            throw new \InvalidArgumentException(
                'Argument 1 must be of type integer. Argument type is ' . gettype($position));
        }
        
        $this->end = $position;
    }

    public function setChromosomeBlockCount($count)
    {
        if (! is_int($count)) {
            throw new \InvalidArgumentException(
                'Argument 1 must be of type integer. Argument type is ' . gettype($count));
        }
        
        $this->blockCount = $count;
    }

    public function setChromosomeBlockSizes(array $sizes)
    {
        foreach ($sizes as $size) {            
            if (! is_int($size)) {
                throw new \InvalidArgumentException(
                    'Argument 1 must be of type integer[]. Element of argument 1 is ' . gettype($size));
            }
        }
        
        $this->blockSizes = $sizes;
    }
}