-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMutant.java
63 lines (44 loc) · 1.88 KB
/
Mutant.java
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javasvmpredictui;
import java.util.ArrayList;
import java.util.Arrays;
/**
*
* @author Ritesh
*/
public class Mutant {
ArrayList<String> allMutants;
ArrayList<Integer> allPositions;
String peptideArray[] ;
Mutant(String pept){
String[] aminoAcids = new String[]{"A","C","D","E","F","G","H","I","K","L","M","N","P","Q","R","S","T","V","W","Y"};
System.out.println("Src peptide: "+ pept);
peptideArray = pept.split("");
int len = peptideArray.length;
String peptideArrayNew[] = new String[len];
System.arraycopy(peptideArray,0,peptideArrayNew,0,len);
int i;
allMutants = new ArrayList<>();
allPositions = new ArrayList<>();
// added for the original peptide
allMutants.add(pept); allPositions.add(0);
for(i=0;i<len;i++){int j;int pos=i+1;
for(j=0;j<20;j++){
String transPeptide[];
String altPeptide[];
altPeptide=Arrays.copyOf(peptideArrayNew,peptideArrayNew.length);
if(!aminoAcids[j].equals(altPeptide[i])){
altPeptide[i]=aminoAcids[j];
String mutant = Arrays.toString(altPeptide);
mutant = mutant.substring(1, mutant.length()-1).replaceAll(",", "").replaceAll(" ", "");
System.out.println(mutant+"\t"+ pos);
allMutants.add(mutant);allPositions.add(pos);
}
}
}
}
}