0
|
1 function [reads1]=clip_reads(reads1,CLIP_NUCL)
|
|
2 % This function clips the first CLIP_NUCL bases from reads1
|
|
3 if or(size(reads1,1)==0,size(reads1,2)==0)
|
|
4 return
|
|
5 end
|
|
6
|
|
7 for C_ITER=1:CLIP_NUCL
|
|
8 %Clip the first bases
|
|
9 [TEMP,FIRST_VECT]=max(reads1,[],2);
|
|
10 FIRST_MASK=sparse((1:length(FIRST_VECT))',FIRST_VECT,ones(length(FIRST_VECT),1),size(reads1,1),size(reads1,2));
|
|
11 reads1(FIRST_MASK>0)=0;
|
|
12
|
|
13 %Clip the last bases
|
|
14 [TEMP,FIRST_VECT]=max(reads1(:,end:(-1):1),[],2);
|
|
15 FIRST_VECT=size(reads1,2)-FIRST_VECT+1;
|
|
16 FIRST_MASK=sparse((1:length(FIRST_VECT))',FIRST_VECT,ones(length(FIRST_VECT),1),size(reads1,1),size(reads1,2));
|
|
17 reads1(FIRST_MASK>0)=0;
|
|
18
|
|
19 end
|