forked from CeciliaOstertag/pathway_comparison_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRsdResultsParser.java
87 lines (75 loc) · 2.16 KB
/
RsdResultsParser.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.github.pathway_comparison_project;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
/**
* This class is used to parse the output file containing the results of the RSD algorithm used to find orthologs between two sets of sequences
*
* @see Query
* @see EnzymeFinder
* @see PathwayComparisonProject
* @see SbmlAnnotator
*
* @author Peter Bock, Guillamaury Debras, Mercia Ngoma-Komb, Cécilia Ostertag, Franck Soubes
*/
public class RsdResultsParser {
/*
* Name of the file containing the results of the RSD algorithm
*/
private String orthologFile;
/*
* List of NCBI ids of enzymes from the reference genome
*/
private ArrayList<String> orthologListRef = new ArrayList<>();
/*
* List of NCBI ids of enzymes from the subject genome
*/
private ArrayList<String> orthologListQuery = new ArrayList<>();
public RsdResultsParser(String orthologFile) {
this.orthologFile = orthologFile;
}
/**
* Parses the pairs of orthologs written in the orthology results file, and
* saves them in two ArrayList : one for the reference genome, and the other
* for the subject genome
*
**/
public void findOrthologList() {
try {
BufferedReader buff = new BufferedReader(new FileReader(orthologFile));
String line = null;
while ((line = buff.readLine()) != null) {
String[] fields = line.split("\t");
if (fields.length > 3) {
orthologListRef.add(fields[1]);
orthologListQuery.add(fields[2]);
}
}
buff.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Returns the list of ortholog proteins from the reference genome
*
* @return orthologListRef : list of ortholog proteins from the reference genome
*
**/
public ArrayList<String> getOrthtologListRef() {
return orthologListRef;
}
/**
* Returns the list of ortholog proteins from the subject genome
*
* @return orthologListQuery : list of ortholog proteins from the subjecte genome
*
**/
public ArrayList<String> getOrthtologListQuery() {
return orthologListQuery;
}
}