| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.ws.dbsources; |
| 22 |
|
|
| 23 |
|
import java.util.Locale; |
| 24 |
|
|
| 25 |
|
import jalview.bin.Console; |
| 26 |
|
import jalview.datamodel.AlignmentI; |
| 27 |
|
import jalview.datamodel.DBRefEntry; |
| 28 |
|
import jalview.io.DataSourceType; |
| 29 |
|
import jalview.io.FileFormat; |
| 30 |
|
import jalview.io.FormatAdapter; |
| 31 |
|
import jalview.ws.seqfetcher.DbSourceProxyImpl; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@author |
| 37 |
|
|
| 38 |
|
|
| |
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.5 |
|
| 39 |
|
public abstract class Xfam extends DbSourceProxyImpl |
| 40 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 41 |
0 |
public Xfam()... |
| 42 |
|
{ |
| 43 |
0 |
super(); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
@return |
| 50 |
|
|
| 51 |
|
protected abstract String getURLPrefix(); |
| 52 |
|
|
| 53 |
|
@Override |
| 54 |
|
public abstract String getDbVersion(); |
| 55 |
|
|
| 56 |
|
abstract String getXfamSource(); |
| 57 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 58 |
0 |
@Override... |
| 59 |
|
public AlignmentI getSequenceRecords(String queries) throws Exception |
| 60 |
|
{ |
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
0 |
startQuery(); |
| 65 |
|
|
| 66 |
0 |
String xfamUrl = getURL(queries); |
| 67 |
|
|
| 68 |
0 |
Console.debug("XFAM URL for retrieval is: " + xfamUrl); |
| 69 |
|
|
| 70 |
0 |
AlignmentI rcds = new FormatAdapter().readFile(xfamUrl, |
| 71 |
|
DataSourceType.URL, FileFormat.Stockholm); |
| 72 |
|
|
| 73 |
0 |
for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++) |
| 74 |
|
{ |
| 75 |
0 |
rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getXfamSource(), |
| 76 |
|
|
| 77 |
|
getDbVersion(), queries.trim().toUpperCase(Locale.ROOT))); |
| 78 |
0 |
if (!getDbSource().equals(getXfamSource())) |
| 79 |
|
{ |
| 80 |
0 |
rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getDbSource(), |
| 81 |
|
getDbVersion(), queries.trim().toUpperCase(Locale.ROOT))); |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
0 |
stopQuery(); |
| 85 |
0 |
return rcds; |
| 86 |
|
} |
| 87 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
0 |
String getURL(String queries)... |
| 89 |
|
{ |
| 90 |
0 |
return getURLPrefix() + "/family/" |
| 91 |
|
+ queries.trim().toUpperCase(Locale.ROOT) + getURLSuffix(); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 97 |
0 |
@Override... |
| 98 |
|
public boolean isAlignmentSource() |
| 99 |
|
{ |
| 100 |
0 |
return true; |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
|
|
| 106 |
|
@return |
| 107 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 108 |
0 |
public String getURLSuffix()... |
| 109 |
|
{ |
| 110 |
0 |
return ""; |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
} |