This file is indexed.

/usr/include/libMems-1.6/libMems/UngappedLocalAlignment.h is in libmems-1.6-dev 1.6.0+4725-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/*******************************************************************************
 * $Id: UngappedLocalAlignment.h,v 1.10 2004/03/01 02:40:08 darling Exp $
 * This file is copyright 2002-2007 Aaron Darling and authors listed in the AUTHORS file.
 * This file is licensed under the GPL.
 * Please see the file called COPYING for licensing details.
 * **************
 ******************************************************************************/

#ifndef __UngappedLocalAlignment_h__
#define __UngappedLocalAlignment_h__

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "libGenome/gnClone.h"
#include "libGenome/gnException.h"
#include "libMems/AbstractMatch.h"

namespace mems {

/**
 * The UngappedLocalAlignment class stores the location of an <b>equal size</b> (inexact or exactly) 
 * matching region between several sequences.  This class can use one of several storage schemes
 * such as DenseAbstractMatch or SparseAbstractMatch
 */
template< class AbstractMatchImpl >
class UngappedLocalAlignment : public AbstractMatchImpl 
{

public:
	UngappedLocalAlignment();
	/**
	 * Creates a new UngappedLocalAlignment.
	 * @param seq_count The total number of sequences in the alignment
	 */
	UngappedLocalAlignment( const uint seq_count );

	// use trivial copy constructor, destructor, and operator =

	UngappedLocalAlignment* Clone() const;
	UngappedLocalAlignment* Copy() const;
	virtual void Free();

	/** comparison operator, compares two UngappedLocalAlignmentes to see if they are the same */
	boolean operator==(const UngappedLocalAlignment& mhe) const;

	gnSeqI Length( uint seqI = (std::numeric_limits<uint>::max)() ) const
	{
		if( seqI == (std::numeric_limits<uint>::max)() ) 
			return m_length;
		if( this->LeftEnd(seqI) == NO_MATCH )
			return 0;
		return m_length;
	}
	void SetLength(gnSeqI len, uint seqI = 0){m_length = len;}
	gnSeqI AlignmentLength() const{return m_length;}
	
	//warning:  none of the following do bounds checking.
	virtual void Move( int64 distance );
	virtual void CropStart(gnSeqI crop_amount);
	virtual void CropEnd(gnSeqI crop_amount);
	virtual void ExtendStart(gnSeqI extend_amount);
	virtual void ExtendEnd(gnSeqI extend_amount);

	virtual void CropLeft(gnSeqI crop_amount, uint seqI);
	virtual void CropRight(gnSeqI crop_amount, uint seqI);

	void GetAlignment( std::vector< bitset_t >& align_matrix ) const;

	void GetColumn( gnSeqI col, std::vector<gnSeqI>& pos, std::vector<bool>& column ) const;

	/**
	 * Writes the location of this UngappedLocalAlignment to the specified output stream (e.g. cout).
	 */
	template<typename AMImpl> friend std::ostream& operator<<(std::ostream& os, const UngappedLocalAlignment<AMImpl>& ula); //write to source.

	bool IsGap( uint seqI, gnSeqI col ) const {
		return (this->LeftEnd(seqI) != NO_MATCH && col < m_length);
	}

protected:

	gnSeqI m_length;
};


template< class AbstractMatchImpl >
UngappedLocalAlignment< AbstractMatchImpl >::UngappedLocalAlignment() : AbstractMatchImpl()
{
}


template< class AbstractMatchImpl >
UngappedLocalAlignment< AbstractMatchImpl >::UngappedLocalAlignment(uint seq_count)
 : AbstractMatchImpl( seq_count )
{
}


template< class AbstractMatchImpl >
UngappedLocalAlignment< AbstractMatchImpl >* 
UngappedLocalAlignment< AbstractMatchImpl >::Clone() const
{
	return new UngappedLocalAlignment(*this);
}

template< class AbstractMatchImpl >
UngappedLocalAlignment<AbstractMatchImpl>* UngappedLocalAlignment<AbstractMatchImpl>::Copy() const
{
	return m_allocateAndCopy( *this );
}
template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::Free()
{
	m_free(this);
}

template< class AbstractMatchImpl >
boolean UngappedLocalAlignment<AbstractMatchImpl>::operator==(const UngappedLocalAlignment& ula) const
{
	if(m_length != ula.m_length)
		return false;
	return AbstractMatchImpl::operator==(ula);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::Move( int64 distance )
{
	for( uint32 i=0; i < AbstractMatchImpl::SeqCount(); i++ ){
		int64 start = AbstractMatchImpl::Start(i);
		if( start != NO_MATCH )
			AbstractMatchImpl::SetStart(i, start + distance );
	}
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::CropStart(gnSeqI crop_amount)
{
	if( crop_amount > m_length )
		Throw_gnEx( genome::SeqIndexOutOfBounds() );
	m_length -= crop_amount;
	AbstractMatchImpl::MoveStart(crop_amount);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::CropEnd(gnSeqI crop_amount){
	if( crop_amount > m_length )
		Throw_gnEx( genome::SeqIndexOutOfBounds() );
	m_length -= crop_amount;
	AbstractMatchImpl::MoveEnd(crop_amount);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::ExtendStart(gnSeqI extend_amount){
	m_length += extend_amount;
	int64 amt = extend_amount;
	AbstractMatchImpl::MoveStart(-amt);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::ExtendEnd(gnSeqI extend_amount){
	m_length += extend_amount;
	int64 amt = extend_amount;
	AbstractMatchImpl::MoveEnd(-amt);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::CropLeft(gnSeqI crop_amount, uint seqI)
{
	if(AbstractMatchImpl::Orientation(seqI) == AbstractMatch::forward)
		CropStart(crop_amount);
	else
		CropEnd(crop_amount);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment<AbstractMatchImpl>::CropRight(gnSeqI crop_amount, uint seqI)
{
	if(AbstractMatchImpl::Orientation(seqI) == AbstractMatch::forward)
		CropEnd(crop_amount);
	else
		CropStart(crop_amount);
}

template< class AbstractMatchImpl >
void UngappedLocalAlignment< AbstractMatchImpl >::GetAlignment( std::vector< bitset_t >& align_matrix ) const
{
	align_matrix = std::vector< bitset_t >(this->SeqCount(), bitset_t( this->AlignmentLength(), false ) );
	for( uint seqI = 0; seqI < this->SeqCount(); seqI++ )
	{
		if( this->LeftEnd(seqI) != NO_MATCH )
			align_matrix[seqI].flip();
	}
}

template< typename AbstractMatchImpl >
std::ostream& operator<<(std::ostream& os, const UngappedLocalAlignment< AbstractMatchImpl >& ula);

template< typename AbstractMatchImpl >
std::ostream& operator<<(std::ostream& os, const UngappedLocalAlignment< AbstractMatchImpl >& ula){ //write to stream.
	os << ula.m_length;
	for(uint i=0; i < ula.SeqCount(); i++)
		os << '\t' << ula.Start(i);
	return os;
}


template< class AbstractMatchImpl >
void UngappedLocalAlignment< AbstractMatchImpl >::GetColumn( gnSeqI col, std::vector<gnSeqI>& pos, std::vector<bool>& column ) const
{
	pos = std::vector<gnSeqI>(this->SeqCount(), NO_MATCH);
	column = std::vector<bool>(this->SeqCount(), true);
	for( uint seqI = 0; seqI < this->SeqCount(); seqI++ )
	{
		if( this->Orientation(seqI) == AbstractMatch::forward )
			pos[seqI] = this->LeftEnd(seqI) + col;
		else if( this->Orientation(seqI) == AbstractMatch::reverse )
			pos[seqI] = this->RightEnd(seqI) - col;
		else
			column[seqI] = false;
	}
}

}

#endif // _UngappedLocalAlignment_h_