rig input
From irefindex
Generating ROGIDs and RIGIDs
The following examples expalins how to generate ROGIDs from primary amino acid sequence and also the methods to sort ROGs before creating RIGIDs
Using the IRefIndex_digester
- you require the IRefIndex_digester.jar in your class path)
IRefIndex_digester digetster = new IRefIndex_digester();
String seq = "PQITLWQRPLVTVKIGGQLKEALLDTGEICGHKAIGT"; String seq2 = "ADDTVLEEMNLPGKWKPKMIGGIGGFIKARQYDQIAI"; String ROGID_1 = digetster.getROGID(seq, 9606); String ROGID_2 = digetster.getROGID(seq2, 9606); ArrayList<String> data = new ArrayList<String>(); data.add(ROGID_1); data.add(ROGID_2); try { data = digetster.sortBase64ASCII(data); } catch (InvalidBase64Exception ex) { ex.printStackTrace(); } System.out.println("ROGID of 1 = " + ROGID_1); System.out.println("ROGID of 1 = " + ROGID_2); System.out.println("Sorted list = "+data ); String rig_input = ""; for (int i = 0; i < data.size(); i++) { rig_input = rig_input + data.get(i); } System.out.println("concat string = "+rig_input); System.out.println("RIGID = "+digetster.getSeguForWithNum(rig_input));
Creating ROGID without IRefIndex_digester
1) Create ROGIDs 2) Sort the ROGIDs 3) Create RIGID
1)Create ROGIDs
import java.security.MessageDigest; import <some>.Base64 // for this you could use the base64 class from //http://iharder.sourceforge.net/current/java/base64// or any other method which would represent the //byte output in base64
public class My_digester { public My_digester() { } public String getROGID(String seq, int taxid) { if (seq == null) { return "0"; } else { seq = seq.replaceAll("[^A-Za-z0-9]", "").trim().toUpperCase(); if (seq.length() > 0) { try { MessageDigest md = MessageDigest.getInstance("SHA"); String data = seq; md.update(data.getBytes()); byte[] digest = md.digest(); String r = Base64.encodeBytes(digest); r = r.replace("=", ""); return r + taxid; } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); } } } return "0"; } }
2) Sort the ROGIDs
import java.util.Arrays; String[] inp = {ROGID_1,ROGID2}; validate(inp); Arrays.sort(inp); inpArray.clear(); inpArray = new ArrayList(Arrays.asList(inp));
3) Create RIGID
String rig_input = ""; for (int i = 0; i < data.length; i++) { //data is the sorted list rig_input = rig_input + data[i]; } String RIGID = getRIGID(rig_input); getRIGID(String rig_input){ if (rig_input == null) { return "0"; } else { rig_input = rig_input.replaceAll("[^A-Za-z0-9]", "").trim().toUpperCase(); if (rig_input.length() > 0) { try { MessageDigest md = MessageDigest.getInstance("SHA"); String data = rig_input; md.update(data.getBytes()); byte[] digest = md.digest(); String r = Base64.encodeBytes(digest); r = r.replace("=", ""); return r; } catch (NoSuchAlgorithmException ex) { ex.printStackTrace(); } } } return "0"; }