filterDifferenceInLists
Created: 2012-05-04 13:05:16
Last updated: 2012-05-04 13:38:54
This workflow output a list of the protein or any string hits in the first list but not in the second list.
output : output file location
com : comparision protein list
our : interested protein list
out1: output as a string
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (0)
Titles (0)
Descriptions (0)
Dependencies (0)
Inputs (3)
Name |
Description |
our |
|
com |
|
output |
|
Processors (1)
Name |
Type |
Description |
differenceList |
beanshell |
Scriptimport java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
// get the scanner from the input file URL(our protein list)
Scanner getSequence =new Scanner(new File(filename));
// get the scanner from the input file URL
Scanner getComSequence =new Scanner(new File(filename1));
//get the outcome file location and assign a filewriter for that
FileOutputStream out = null;
File outcome = new File(filename2);
// if the output file doesn't exist, create it
if(!outcome.exists())
{
outcome.createNewFile();
}
out = new FileOutputStream(outcome);
//create a list for storing our protein hits
List FastaList = new ArrayList();
//create a list for storing comparision protein hits
List ComList = new ArrayList();
// copy all the our protein hits to the list
String s = getSequence.next();
while (getSequence.hasNext())
{
FastaList.add(s);
s = getSequence.next();
}
FastaList.add(s);
// copy all the comparision proteins to the list
String s = getComSequence.next();
while (getComSequence.hasNext())
{
ComList.add(s);
s = getComSequence.next();
}
ComList.add(s);
//temporary virable
int i, j;
String abc = null;
String bcd= null;
Iterator test = FastaList.iterator();
// filter all the proteins in both lists , only leave with
// the proteins in our list but not in the comparision list,
for(i=FastaList.size()-1;i>=0;i--)
{
for (j= ComList.size()-1; j >= 0; j--)
{
abc = FastaList.get(i);
bcd = ComList.get(j);
if(abc.equals(bcd))
{
FastaList.remove(i);
break;
}
}
}
//write the result protein list to the output scream
out1 = new String();
for(i=0;i |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
differenceList |
|
filename
filename1
filename2
|
out1
|
Datalinks (4)
Source |
Sink |
our |
differenceList:filename |
com |
differenceList:filename1 |
output |
differenceList:filename2 |
differenceList:out1 |
out1 |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (0)
None
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment