Name |
Type |
Description |
extract_snp_id |
beanshell |
This extracts the contents (snp_ids) of the first column from the input.It is important that the first column contains SNP IDs for this reason. Scriptimport java.util.*;
String [] line = string.split("\t");
out1=line[0].trim(); |
Split_string_into_string_list_by_regular_expression |
localworker |
This service splits the string value into a string list at every occurrence of the specified regular expression. The regular expression provided in this case is a new line: "\n" ScriptList split = new ArrayList();
if (!string.equals("")) {
String regexString = ",";
if (regex != void) {
regexString = regex;
}
String[] result = string.split(regexString);
for (int i = 0; i < result.length; i++) {
split.add(result[i]);
}
}
|
regex_value |
stringconstant |
Value\n |
hsapiens_snp |
biomart |
This is a Biomart service that takes the SNP ID as the input and returns chromosome name, and the position of the SNP. |
Flatten_List |
localworker |
This service flattens the inputlist by one level. It returns the result of the flattening. 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); |
Flatten_List_2 |
localworker |
This service flattens the inputlist by one level. It returns the result of the flattening. 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); |
input_chr_position |
beanshell |
The purpose of this beanshell is to manipulate the start and end positions based on the flanking width provided by the user. Scriptimport java.util.*;
List tmp_end = new ArrayList();
List tmp_start = new ArrayList();
width =Integer.parseInt(in1.get(0));
int out_end=0;
int out_start=0;
for(int i=0; i < in2.size(); i++) {
value_pos = Integer.parseInt(in2.get(i));
out_end = value_pos + width;
out_start = value_pos - width;
tmp_end.add(out_end);
tmp_start.add(out_start);
}
end_out = tmp_end;
start_out = tmp_start;
chr_out = chr_in;
|
Read_Text_File |
localworker |
This service reads the text file at the specified file path or URL and returns the file's content. ScriptBufferedReader getReader (String fileUrl, String encoding) throws IOException {
InputStreamReader reader;
try {
if (encoding == null) {
reader = new FileReader(fileUrl);
} else {
reader = new InputStreamReader(new FileInputStream(fileUrl),encoding);
}
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
if (encoding == null) {
reader = new InputStreamReader (url.openStream());
} else {
reader = new InputStreamReader (url.openStream(), encoding);
}
}
return new BufferedReader(reader);
}
StringBuffer sb = new StringBuffer(4000);
if (encoding == void) {
encoding = null;
}
BufferedReader in = getReader(fileurl, encoding);
String str;
String lineEnding = System.getProperty("line.separator");
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(lineEnding);
}
in.close();
filecontents = sb.toString();
|
Create_and_populate_temporary_file_2 |
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_2 |
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();
}
|
CheckFilename |
beanshell |
This Beanshell prevents accidental overwrite of the input file by the output file. If filenames are equal it prepends "output_" to the output filename. Scriptif (infilename.equals(outfilename)) outfilename="output_" + outfilename; |
Gene_to_Pathway |
workflow |
This nested workflow extracts gene regulatory pathways from the KEGG database that are presumably affected by the SNPs identified by GWAS. |
Flatten_List_3 |
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 (1)
Log in to make a comment
Beautifully annotated and runs without problems with its example inputs on Taverna 2.4 (14 september 2012).