Skip to content

Commit c89bb50

Browse files
committed
Add /cesymm/:id/fasta route
1 parent f37143f commit c89bb50

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

src/main/java/org/biojava/http/BioJavaRoutes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ public class BioJavaRoutes {
3434
public static String CESYMM_PDB = "/cesymm/:id/pdb";
3535
public static String CESYMM_AXES = "/cesymm/:id/axes";
3636
public static String CESYMM_TSV = "/cesymm/:id/tsv";
37+
public static String CESYMM_FASTA = "/cesymm/:id/fasta";
3738
}

src/main/java/org/biojava/http/ServerMain.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424

2525
package org.biojava.http;
2626

27-
import static spark.Spark.*;
27+
import static spark.Spark.get;
28+
import static spark.Spark.port;
29+
import static spark.Spark.staticFileLocation;
2830

31+
import org.biojava.http.compute.CeSymmFastaTransformer;
2932
import org.biojava.http.compute.CeSymmPDBTransformer;
3033
import org.biojava.http.compute.CeSymmTSVTransformer;
3134
import org.biojava.http.compute.JsonTransformer;
@@ -69,5 +72,6 @@ public static void main(String[] args) {
6972
};
7073
},new CeSymmPDBTransformer());
7174
get(BioJavaRoutes.CESYMM_TSV, new CeSymmResultRoute(),new CeSymmTSVTransformer());
75+
get(BioJavaRoutes.CESYMM_FASTA, new CeSymmResultRoute(),new CeSymmFastaTransformer());
7276
}
7377
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* BioJava development code
3+
*
4+
* This code may be freely distributed and modified under the
5+
* terms of the GNU Lesser General Public Licence. This should
6+
* be distributed with the code. If you do not have a copy,
7+
* see:
8+
*
9+
* http://www.gnu.org/copyleft/lesser.html
10+
*
11+
* Copyright for this code is held jointly by the individual
12+
* authors. These should be listed in @author doc comments.
13+
*
14+
* For more information on the BioJava project and its aims,
15+
* or to join the biojava-l mailing list, visit the home page
16+
* at:
17+
*
18+
* http://www.biojava.org/
19+
*
20+
* Created on Jul 20, 2016
21+
* Author: blivens
22+
*
23+
*/
24+
25+
package org.biojava.http.compute;
26+
27+
import org.biojava.nbio.structure.align.multiple.MultipleAlignment;
28+
import org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentWriter;
29+
import org.biojava.nbio.structure.symmetry.internal.CeSymmResult;
30+
31+
import spark.ResponseTransformer;
32+
33+
public class CeSymmFastaTransformer implements ResponseTransformer {
34+
@Override
35+
public String render(Object resultObj) throws Exception {
36+
CeSymmResult result = (CeSymmResult) resultObj;
37+
MultipleAlignment alignment = result.getMultipleAlignment();
38+
if (alignment != null)
39+
return MultipleAlignmentWriter.toFASTA(alignment);
40+
else {
41+
// No alignment; just write header
42+
return "";
43+
}
44+
}
45+
46+
}

src/main/resources/static/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ <h3>CE-Symm</h3>
144144
</tr>
145145
</table>
146146
All aligned residues in the alignment, in tsv format.
147+
<table class="route">
148+
<tr>
149+
<td><pre>/cesymm/:id/fasta</pre></td>
150+
<td>Example: <a href="/cesymm/1itb.A/fasta">/cesymm/1itb.A/fasta</a></td>
151+
</tr>
152+
</table>
153+
FASTA format multiple alignment of all repeats. Upper-case letters are aligned.
154+
Lower case letters and hyphens are gaps.
147155
</p>
148156
</div>
149157
</body>

0 commit comments

Comments
 (0)