Name |
Type |
Description |
get_compound |
rest |
|
extract_pathway_from_compounds_file |
beanshell |
Scriptimport java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.ArrayList;
import java.util.Iterator;
String PATHWAY_Line;
List out1 = new ArrayList();
//First grab the line that contains the word "PATHWAY"
String p = "PATHWAY\\s+(.+?)\\b[A-Z]+?\\b\\s+";
Pattern pattern = Pattern.compile(p,Pattern.DOTALL);
Matcher matcher = pattern.matcher(in1);
while (matcher.find()){
PATHWAY_Line = matcher.group(1);
}
//Now get all the pathway ids from the "PATHWAY" line
String p1 = "(ko[0-9]{5})";
Pattern pattern1 = Pattern.compile(p1,Pattern.MULTILINE);
Matcher matcher1 = pattern1.matcher(PATHWAY_Line);
while (matcher1.find()){
out1.add(matcher1.group(1));
}
|
query_for_pathways |
beanshell |
Scriptout1="path:" + in1; |
get_genes_by_pathway |
rest |
|
extract_genes_from_pathway_file |
beanshell |
Scriptimport java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.ArrayList;
import java.util.Iterator;
String Gene_Matcher;
List out1 = new ArrayList();
List tmp = new ArrayList();
//String p = "GENE\\s+(.+?)\\b[A-Z]+?\\b";
String p = "GENE\\s+(.+?)\\bCOMPOUND\\b";
Pattern pattern = Pattern.compile(p,Pattern.DOTALL);
Matcher matcher = pattern.matcher(in1);
while (matcher.find()){
Gene_Matcher = matcher.group(1);
}
if (Gene_Matcher != null) {
String [] line = Gene_Matcher.split("\\s\\s\\s+");
//Extract the gene id, remove the gene name from consideration
for (int i=0; i < line.length; i++) {
String [] line1 = line[i].split(";");
out1.add(line1[0]);
}
}
else {
out1.add("");
}
|
Flatten_List |
localworker |
Scriptflatten(inputs, outputs, depth) {
for (i = inputs.iterator(); i.hasNext();) {
element = i.next();
if (element instanceof Collection && depth > 0) {
flatten(element, outputs, depth - 1);
} else {
outputs.add(element);
}
}
}
outputlist = new ArrayList();
flatten(inputlist, outputlist, 1); |
Remove_String_Duplicates |
localworker |
ScriptList strippedlist = new ArrayList();
for (Iterator i = stringlist.iterator(); i.hasNext();) {
String item = (String) i.next();
if (strippedlist.contains(item) == false) {
strippedlist.add(item);
}
}
|
Create_and_populate_temporary_file |
beanshell |
This service creates a temporary file in a local tmp directory. ScriptFile f = File.createTempFile("taverna", ".tmp");
BufferedWriter writer = new BufferedWriter(new FileWriter(f));
writer.write(content);
writer.close();
filepath = f.getCanonicalPath(); |
Concatenate_Files |
localworker |
This service examines the files whose paths or URLs are specified in the filelist. The content of those files is concatenated. ScriptBufferedReader getReader (String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
reader = new InputStreamReader (url.openStream());
}
return new BufferedReader(reader);
}
String NEWLINE = System.getProperty("line.separator");
boolean displayResults = false;
if (displayresults != void) {
displayResults = Boolean.valueOf(displayresults).booleanValue();
}
StringBuffer sb = new StringBuffer(2000);
if (outputfile == void) {
throw new RuntimeException("The 'outputfile' parameter cannot be null");
}
if (filelist == null) {
throw new RuntimeException("The 'filelist' parameter cannot be null");
}
String str = null;
Writer writer = new FileWriter(outputfile);
for (int i = 0; i < filelist.size(); i++) {
BufferedReader reader = getReader(filelist.get(i));
while ((str = reader.readLine()) != null) {
writer.write(str);
writer.write(NEWLINE);
if (displayResults) {
sb.append(str);
sb.append(NEWLINE);
}
}
reader.close();
}
writer.flush();
writer.close();
if (displayResults) {
results= sb.toString();
}
|
Select_only_metabolic_pwy |
beanshell |
This is to insure that we select only metabolic pathways. Scriptimport java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.List;
import java.util.ArrayList;
List tmp = new ArrayList();
for(int i=0; i < in1.size(); i++) {
if( in1.get(i).toString().equals("ko00010") || in1.get(i).toString().equals("ko00020") || in1.get(i).toString().equals("ko00030") || in1.get(i).toString().equals("ko00040") || in1.get(i).toString().equals("ko00051") || in1.get(i).toString().equals("ko00052") || in1.get(i).toString().equals("ko00053") || in1.get(i).toString().equals("ko00500") || in1.get(i).toString().equals("ko00520") || in1.get(i).toString().equals("ko00620") || in1.get(i).toString().equals("ko00630") || in1.get(i).toString().equals("ko00640") || in1.get(i).toString().equals("ko00650") || in1.get(i).toString().equals("ko00660") || in1.get(i).toString().equals("ko00562") || in1.get(i).toString().equals("ko00190") || in1.get(i).toString().equals("ko00195") || in1.get(i).toString().equals("ko00196") || in1.get(i).toString().equals("ko00710") || in1.get(i).toString().equals("ko00720") || in1.get(i).toString().equals("ko00920") || in1.get(i).toString().equals("ko00061") || in1.get(i).toString().equals("ko00062") || in1.get(i).toString().equals("ko00071") || in1.get(i).toString().equals("ko00072") ||in1.get(i).toString().equals("ko00100") || in1.get(i).toString().equals("ko00120") || in1.get(i).toString().equals("ko00121") || in1.get(i).toString().equals("ko00140") || in1.get(i).toString().equals("ko00561") || in1.get(i).toString().equals("ko00564") || in1.get(i).toString().equals("ko00565") || in1.get(i).toString().equals("ko00600") || in1.get(i).toString().equals("ko00590") || in1.get(i).toString().equals("ko00591") || in1.get(i).toString().equals("ko00592") || in1.get(i).toString().equals("ko01040") ||
in1.get(i).toString().equals("ko00250") || in1.get(i).toString().equals("ko00260") || in1.get(i).toString().equals("ko00270") || in1.get(i).toString().equals("ko00280") || in1.get(i).toString().equals("ko00290") || in1.get(i).toString().equals("ko00300") || in1.get(i).toString().equals("ko00310") || in1.get(i).toString().equals("ko00330") || in1.get(i).toString().equals("ko00340") || in1.get(i).toString().equals("ko00350") || in1.get(i).toString().equals("ko00360") || in1.get(i).toString().equals("ko00380") || in1.get(i).toString().equals("ko00400") || in1.get(i).toString().equals("ko00410") || in1.get(i).toString().equals("ko00430") || in1.get(i).toString().equals("ko00440") || in1.get(i).toString().equals("ko00450") || in1.get(i).toString().equals("ko00460") || in1.get(i).toString().equals("ko00471") || in1.get(i).toString().equals("ko00472") || in1.get(i).toString().equals("ko00473") || in1.get(i).toString().equals("ko00480") || in1.get(i).toString().equals("ko00510") || in1.get(i).toString().equals("ko00513") || in1.get(i).toString().equals("ko00512") || in1.get(i).toString().equals("ko00514") || in1.get(i).toString().equals("ko00532") || in1.get(i).toString().equals("ko00534") || in1.get(i).toString().equals("ko00533") || in1.get(i).toString().equals("ko00531") || in1.get(i).toString().equals("ko00563") || in1.get(i).toString().equals("ko00601") || in1.get(i).toString().equals("ko00603") || in1.get(i).toString().equals("ko00604") || in1.get(i).toString().equals("ko00540") || in1.get(i).toString().equals("ko00550") || in1.get(i).toString().equals("ko00511") || in1.get(i).toString().equals("ko00730") || in1.get(i).toString().equals("ko00740") || in1.get(i).toString().equals("ko00750") || in1.get(i).toString().equals("ko00760") || in1.get(i).toString().equals("ko00770") ||
in1.get(i).toString().equals("ko00780") || in1.get(i).toString().equals("ko00785") || in1.get(i).toString().equals("ko00790") || in1.get(i).toString().equals("ko00670") || in1.get(i).toString().equals("ko00830") || in1.get(i).toString().equals("ko00130") || in1.get(i).toString().equals("ko04723"))
{
tmp.add(in1.get(i).toString().replace("ko","hsa"));
}
}
out1 = tmp;
|
Flatten_List_2 |
localworker |
Scriptflatten(inputs, outputs, depth) {
for (i = inputs.iterator(); i.hasNext();) {
element = i.next();
if (element instanceof Collection && depth > 0) {
flatten(element, outputs, depth - 1);
} else {
outputs.add(element);
}
}
}
outputlist = new ArrayList();
flatten(inputlist, outputlist, 1); |
Comments (0)
No comments yet
Log in to make a comment