void DisplayWindow::BuildConnections() { connect(m_qpbLike, SIGNAL(clicked()), this, SLOT(likeIt())); connect(m_qpbComment, SIGNAL(clicked()), this, SLOT(toComment())); connect(m_qpbForward, SIGNAL(clicked()), this, SLOT(forwardIt())); connect(m_qpbUser, SIGNAL(clicked()), this, SLOT(toProfile())); }
void CommentWindow::BuildSingle(int i) { m_qwSingleComment = new QWidget(m_qwComment); m_qwSingleComment->setObjectName("singleComment"); m_qwSingleComment->setMinimumWidth(SINGLECOMMENT_W*xscale); m_qwSingleComment->setMinimumHeight( SINGLECOMMENT_H*yscale); string comDate = m_mvModel.m_vComments[i].m_sDate; string date = comDate.substr(0,comDate.find_first_of(' ')); string time = comDate.substr(comDate.find_first_of(' ')); string year = date.substr(0, date.find_first_of('-')); string remainDate = date.substr(date.find_first_of('-')+1); string month = remainDate.substr(0,remainDate.find_first_of('-')); string day = remainDate.substr(remainDate.find_first_of('-')+1); m_qwDate = new QWidget(m_qwSingleComment); m_qwDate->setObjectName("date"); m_qwDate->setFixedSize(DATE_W*xscale, DATE_H*yscale); m_qlCommentMon = new QLabel(QString(toMonth(month).c_str()), m_qwDate); m_qlCommentMon->setObjectName("month"); m_qlCommentMon->setAlignment(Qt::AlignCenter); m_qlCommentDay = new QLabel(QString(day.c_str()), m_qwDate); m_qlCommentDay->setObjectName("day"); m_qlCommentDay->setAlignment(Qt::AlignCenter); QVBoxLayout *dateLayout = new QVBoxLayout(); dateLayout->addWidget(m_qlCommentMon); dateLayout->addWidget(m_qlCommentDay); m_qwDate->setLayout(dateLayout); m_qpbUsername = new QPushButton(m_mvModel.m_vComments[i].m_sCosID.c_str(), m_qwSingleComment); m_qpbUsername->setObjectName("toProfile"); m_qpbUsername->setFixedSize(TOPROFILE_W*xscale, TOPROFILE_H*yscale); connect(m_qpbUsername, SIGNAL(clicked()), this, SLOT(toProfile())); m_qlCommentCont = new QLabel(m_mvModel.m_vComments[i].m_sContains.c_str(), m_qwSingleComment); m_qlCommentCont->setObjectName("commentContent"); m_qlCommentCont->setFixedSize(COMMENTCONTENT_W*xscale, COMMENTCONTENT_H*yscale); m_qlCommentTime = new QLabel(time.c_str(), m_qwSingleComment); m_qlCommentTime->setObjectName("commentTime"); m_qlCommentTime->setFixedSize(COMMENTTIME_W*xscale, COMMENTTIME_H*yscale); QVBoxLayout *commentLayout = new QVBoxLayout(); commentLayout->addWidget(m_qpbUsername); commentLayout->addWidget(m_qlCommentCont); commentLayout->addStretch(); commentLayout->addWidget(m_qlCommentTime); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(m_qwDate,0,Qt::AlignTop); layout->addSpacing(SPACE); layout->addLayout(commentLayout); layout->addStretch(); m_qwSingleComment->setLayout(layout); }
//--------------------------------------------------------------- HAlignandum makeProfile( const HAlignandum & seqa, const HAlignment & map_seqa2profile, const HAlignandum & seqb, const HAlignment & map_seqb2profile ) { debug_func_cerr(5); HProfile profile = toProfile(makeProfile( std::max( map_seqa2profile->getColTo(), map_seqb2profile->getColTo() ))); profile->add( seqa, map_seqa2profile ); profile->add( seqb, map_seqb2profile ); return profile; }
//--------------------------------------------------------------- HAlignandum makeProfile( const HMultAlignment & mali, const HAlignandumVector & sequences ) { debug_func_cerr(5); if (sequences->size() != mali->getNumSequences()) throw AlignlibException( "ImplProfile.cpp: number of sequences given does not match number of sequences in MultAlignment"); HProfile profile = toProfile(makeProfile( mali->getLength() )); for (int x = 0; x < mali->getNumSequences(); ++x) profile->add( (*sequences)[x], (*mali)[x], true ); return profile; }
std::string calculateConservation( const HMultipleAlignment & mali, const Frequency min_frequency ) { debug_func_cerr(5); const HEncoder encoder(getDefaultEncoder()); HProfile profile( toProfile( (makeProfile( mali )))); profile->prepare(); const HFrequencyMatrix frequencies(profile->getFrequencyMatrix()); Position length = frequencies->getNumRows(); Residue width = frequencies->getNumCols(); char * buffer = new char[length + 1]; for (Position col = 0; col < length; col++) { Frequency max_frequency = min_frequency; Frequency f; Residue max_residue = encoder->getGapCode(); const Frequency * fcolumn = frequencies->getRow(col); for (Position row = 0; row < width; row++) { if ( (f = fcolumn[row]) >= max_frequency ) { max_frequency = f; max_residue = row; } } buffer[col] = encoder->decode( max_residue ); } buffer[length] = '\0'; std::string seq(buffer); delete [] buffer; return seq; }