|
MASA-Core
|
00001 /******************************************************************************* 00002 * 00003 * Copyright (c) 2010-2015 Edans Sandes 00004 * 00005 * This file is part of MASA-Core. 00006 * 00007 * MASA-Core is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * MASA-Core is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with MASA-Core. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 ******************************************************************************/ 00021 00022 #include "AlignmentParams.hpp" 00023 00024 #include <stdio.h> 00025 #include "Constants.hpp" 00026 00027 AlignmentParams::AlignmentParams() { 00028 00029 } 00030 00031 AlignmentParams::~AlignmentParams() { 00032 00033 } 00034 00035 void AlignmentParams::swapSequences() { 00036 if (sequences.size() == 2) { 00037 Sequence* tmp = sequences[1]; 00038 sequences[1] = sequences[0]; 00039 sequences[0] = tmp; 00040 } 00041 } 00042 00043 Sequence* AlignmentParams::getSequence(int id) { 00044 return sequences[id]; 00045 } 00046 00047 vector<Sequence*> AlignmentParams::getSequences() { 00048 return sequences; 00049 } 00050 00051 int AlignmentParams::getAlignmentMethod() const { 00052 return alignmentMethod; 00053 } 00054 00055 void AlignmentParams::setAlignmentMethod(int alignmentMethod) { 00056 this->alignmentMethod = alignmentMethod; 00057 } 00058 00059 00060 void AlignmentParams::setAffineGapPenalties(int gapOpen, int gapExtension) { 00061 setPenaltySystem(PENALTY_AFFINE_GAP); 00062 this->gapOpen = gapOpen; 00063 this->gapExtension = gapExtension; 00064 } 00065 00066 int AlignmentParams::getGapOpen() const { 00067 return gapOpen; 00068 } 00069 00070 int AlignmentParams::getGapExtension() const { 00071 return gapExtension; 00072 } 00073 00074 void AlignmentParams::setMatchMismatchScores(int match, int mismatch) { 00075 setScoreSystem(SCORE_MATCH_MISMATCH); 00076 this->match = match; 00077 this->mismatch = mismatch; 00078 } 00079 00080 int AlignmentParams::getMatch() const { 00081 return match; 00082 } 00083 00084 int AlignmentParams::getMismatch() const { 00085 return mismatch; 00086 } 00087 00088 int AlignmentParams::getPenaltySystem() const { 00089 return penaltySystem; 00090 } 00091 00092 void AlignmentParams::setPenaltySystem(int penaltySystem) { 00093 this->penaltySystem = penaltySystem; 00094 } 00095 00096 int AlignmentParams::getScoreSystem() const { 00097 return scoreSystem; 00098 } 00099 00100 void AlignmentParams::setScoreSystem(int scoreSystem) { 00101 this->scoreSystem = scoreSystem; 00102 } 00103 00104 int AlignmentParams::getSequencesCount() const { 00105 return sequences.size(); 00106 } 00107 00108 void AlignmentParams::addSequence(Sequence* sequence) { 00109 sequences.push_back(sequence); 00110 } 00111 00112 void AlignmentParams::printParams(FILE* file) { 00113 fprintf(file, "SW PARAM: %d/%d/%d/%d\n", match, mismatch, gapOpen, gapExtension); 00114 00115 fprintf(file, "--Alignment sequences:\n"); 00116 for (int i=0; i<sequences.size(); i++) { 00117 fprintf(file, ">%s (%d)\n", sequences[i]->getInfo()->getAccession().c_str(), sequences[i]->getLen()); 00118 } 00119 }
1.7.6.1