File: chrPosition.cpp

package info (click to toggle)
crac 2.5.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,960 kB
  • sloc: cpp: 41,838; sh: 391; makefile: 370
file content (126 lines) | stat: -rw-r--r-- 5,594 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/******************************************************************************
*  Copyright © 2009-2016 -- LIRMM/CNRS                                        *
*                           (Laboratoire d'Informatique, de Robotique et de   *
*                           Microélectronique de Montpellier /                *
*                           Centre National de la Recherche Scientifique)     *
*                           LIFL/INRIA                                        *
*                           (Laboratoire d'Informatique Fondamentale de       *
*                           Lille / Institut National de Recherche en         *
*                           Informatique et Automatique)                      *
*                           LITIS                                             *
*                           (Laboratoire d'Informatique, du Traitement de     *
*                           l'Information et des Systèmes).                   *
*                                                                             *
*  Copyright © 2011-2016 -- IRB/INSERM                                        *
*                           (Institut de Recherches en Biothérapie /          *
*                           Institut National de la Santé et de la Recherche  *
*                           Médicale).                                        *
*                                                                             *
*  Copyright © 2015-2016 -- AxLR/SATT                                         *
*                           (Lanquedoc Roussilon /                            *
*                            Societe d'Acceleration de Transfert de           *
*                            Technologie).	                              *
*                                                                             *
*  Programmeurs/Progammers:                                                   *
*                    Nicolas PHILIPPE <nphilippe.resear@gmail.com>            * 
*                    Mikaël SALSON    <mikael.salson@lifl.fr>                 *
*                    Jérôme Audoux    <jerome.audoux@gmail.com>               *  
*   with additional contribution for the packaging of:	                      *
*                    Alban MANCHERON  <alban.mancheron@lirmm.fr>              *
*                                                                             *
*   Contact:         CRAC list   <crac-bugs@lists.gforge.inria.fr>            *
*   Paper:           CRAC: An integrated RNA-Seq read analysis                *
*                    Philippe N., Salson M., Commes T., Rivals E.             *
*                    Genome Biology 2013; 14:R30.                             *
*                                                                             *
*  -------------------------------------------------------------------------  *
*                                                                             *
*   This File is part of the CRAC program.                                    *
*                                                                             *
*   This program is free software: you can redistribute it and/or modify      *
*   it under the terms of the GNU General Public License as published by      *
*   the Free Software Foundation, either version 3 of the License, or (at     *
*   your option) any later version.  This program is distributed in the       *
*   hope that it will be useful, but WITHOUT ANY WARRANTY; without even       *
*   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR       *
*   PURPOSE.  See the GNU General Public License for more details.  You       *
*   should have received a copy of the GNU General Public License along       *
*   with this program.  If not, see <http://www.gnu.org/licenses/>.           *
*                                                                             *
******************************************************************************/

#include "chrPosition.h"

ChrPosition::ChrPosition():rel_position(0), chr(NULL), strand(0) {}

ChrPosition::ChrPosition(ulong rel_position, char *chr, int chr_id, int strand):
rel_position(rel_position), chr(chr), chr_id(chr_id), strand(strand) {}

ChrPosition::ChrPosition(const ChrPosition &pos) {
  rel_position = pos.getRelativePosition();
  chr = pos.getChrPosition();
  chr_id = pos.getChrId();
  strand = pos.getStrand();
}

ulong ChrPosition::getRelativePosition() const {
  return rel_position;
}

char *ChrPosition::getChrPosition() const {
  return chr;
}

int ChrPosition::getChrId() const {
  return chr_id;
}

int ChrPosition::getStrand() const {
  return strand;
}

void ChrPosition::setStrand(int new_strand) {
  strand = new_strand;
}

ostream &operator<<(ostream &os, ChrPosition &p) {
  os << p.getChrPosition() << "|"<< p.getStrand() << "," << p.getRelativePosition();
  return os;
}

ChrPosition ChrPosition::operator+(int i) {
  return ChrPosition(*this) += i;
//   return pos;
}

ChrPosition &ChrPosition::operator+=(int i) {
  rel_position += i;
  return *this;
}

ChrPosition ChrPosition::operator-(int i) {
  return ChrPosition(*this) -= i;
}

ChrPosition &ChrPosition::operator-=(int i) {
  *this += -i;
  return *this;
}

ChrPosition ChrPosition::operator+(ulong i) {
  return ChrPosition(*this) += i;
}

ChrPosition &ChrPosition::operator+=(ulong i) {
  rel_position += i;
  return *this;
}

ChrPosition ChrPosition::operator-(ulong i) {
  return ChrPosition(*this) -= i;
}

ChrPosition &ChrPosition::operator-=(ulong i) {
  *this += -i;
  return *this;
}