function top=nrwrhdrugtarget(backprobability,lanbuda,yita,gamad1,gamad2,gamat1,gamat2,drugID)
%predict potential drug-target interactions of given drug. top means the final ranking of candidate targets
% parameter drugID is the ID of the drug whose potential targets you want to predict
% parameter backprobability means that the random walker can return to seed nodes with this probability in each step.
% parameter lanbuda is the jumping probability. Large lanbuda introduces more mutual dependency of ranking between drugs and targets
% parameter yita controls the impact of two kinds of seed nodes
% parameter gamad1, gamad2, gamat1, gamat2 are all the linear coefficient of intergareting the known drug-target interactions to improve the drug-drug similarity and target-target similarity.
% The difference between NRWRH and RWRH is that NRWRH used the similarity based on the information of drug-protein interaction network
% read the adjacency matrix of drug-target interactions,
B=textread('interaction.txt');
B(1,:)=[];
B(:,1)=[];
% read the sequence similarity matrix of the target
AT1=textread('sequencesimilarity.txt');
AT1(1,:)=[];
AT1(:,1)=[];
% read the chemical structure similarity matrix of the drug
AD1=textread('chemicalsimilarity.txt');
AD1(1,:)=[];
AD1(:,1)=[];
% n is the number of targets, m is the number of drugs
[n,m]=size(B);

[AD,AT]=combinedsimilarity(B,AD1,AT1,gamad1,gamad2,gamat1,gamat2,m,n);
%construct transition matrix M
for i=1:n
    for j=1:m
        if sum(B(i,:)')==0
            MTD(i,j)=0;
        else MTD(i,j)=lanbuda*B(i,j)/sum(B(i,:)');
        end
    end
end
for i=1:m
    for j=1:n
        if sum(B(:,i))==0
            MDT(i,j)=0;
        else MDT(i,j)=lanbuda*B(j,i)/sum(B(:,i));
        end
    end
end
for i=1:n
    for j=1:n
        if sum(B(i,:)')==0
            MT(i,j)=AT(i,j)/sum(AT(i,:)');
        else        MT(i,j)=(1-lanbuda)*AT(i,j)/sum(AT(i,:)');
        end
    end
end
for i=1:m
    for j=1:m
        if sum(B(:,i))==0
            MD(i,j)=AD(i,j)/sum(AD(i,:)');
        else  MD(i,j)=(1-lanbuda)*AD(i,j)/sum(AD(i,:)');
        end
    end
end
M1=[MT,MTD];
M2=[MDT,MD];
M=[M1;M2];
%deciding the initial probability of target: u0
for i=1:n
if B(i,drugID)==1
    u0(i,1)=1;
else u0(i,1)=0;
end
end 
seedtnumber=sum(u0);
if seedtnumber~=0
u0=u0/seedtnumber;
end
%deciding the initial probability of drug: v0
v0=zeros(m,1);
v0(drugID,1)=1;
p0=[(1-yita)*u0;yita*v0];
% implement the random walk
p1=p0;
p=(1-backprobability)*M'*p1+backprobability*p0;
while max(p-p1)>10^(-10)
    p1=p;
    p=(1-backprobability)*M'*p1+backprobability*p0;
end
u=p(1:n,:);
% rank targets
ss(:,1)=1:n;
ss(:,2)=u;
[ss(:,2),bb]=sort(ss(:,2),1,'descend');


j=0;
for i=1:n
    if u0(bb(i,1),1)==0
   
        j=j+1;
        top(j)=bb(i,1);
    end
end

end