thank you very much it should be scorem[i,j]=pairwiseAlignment(sequences[[i]], sequences[[j]], type = "overlap", substitutionMatrix = "BLOSUM62", gapOpening = -9.5, gapExtension = -0.5,scoreOnly=T) i think "overlap" solves (Needleman-Wunsch) global alignment,