Skip to content

Commit

Permalink
Merge branch 'master' into Christian
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Feb 17, 2014
2 parents 734df05 + 4ff7121 commit 802773f
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ bridgedb-*.gz
# generated checkstyle warnings
/org.bridgedb/warnings.txt

# ignore temporary files
gdb.config

#DO NOT IGNORE
#src-axis #While these are autogenerated removing them will break offline builds.
6 changes: 4 additions & 2 deletions dbbuilder/src/org/bridgedb/extract/SpeciesList
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ Neisseria collection Neisseria Nx
Pyrococcus collection Pytococcus Px
Staphylococcus collection Staphylococcus Sx
Streptococcus collection Streptococcus Tx
Aspergillus niger Black mold 5061 ani An
Aspergillus niger Black Mold 5061 ani An
Clostridium thermocellum Cthe cth Ct
Gibberella zeae Fusarium gramaninearum 5518 Gz
Gibberella zeae Fusarium graminearum 5518 Gz
Solanum lycopersicum Tomato 4081 Sl
Glycine max Soybean 3847 Gm
Beta vulgaris Sugar Beet 3555 bvu Bv
Hordeum vulgare Barley 4513 hvu Hv
2 changes: 2 additions & 0 deletions org.bridgedb.bio/resources/org/bridgedb/bio/organisms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Anopheles gambiae Mosquito_Ag Ag
Arabidopsis thaliana Arabidopsis At
Aspergillus niger Black mold An
Bacillus subtilis Bsubtilis Bs
Beta vulgaris Sugar Beet Bv
Bos taurus Cow Bt
Caenorhabditis elegans Celegans Ce
Canis familiaris Dog Cf
Expand All @@ -17,6 +18,7 @@ Gallus gallus Chicken Gg
Glycine max Soybean Gm
Gibberella zeae Fusarium graminearum Gz
Homo sapiens Human Hs
Hordeum vulgare Barley Hv
Loxodonta africana Elephant La
Macaca mulatta Rhesus Monkey Ml
Monodelphis domestica Opossum Md
Expand Down
20 changes: 11 additions & 9 deletions org.bridgedb.bio/src/org/bridgedb/bio/DataSourceTxt.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,22 @@ public static void init()
throw new Error(ex);
}
}

public static String datasourcesTxt = "";

public static void loadInputStream(InputStream is) throws IOException{
new DataSourceTxt().loadAnInputStream(is);
}
public static void loadInputStream(InputStream is) throws IOException{
new DataSourceTxt().loadAnInputStream(is);
}

protected void loadAnInputStream(InputStream is) throws IOException
{
protected void loadAnInputStream(InputStream is) throws IOException {
BufferedReader reader = new BufferedReader (
new InputStreamReader (is));
String line;
while ((line = reader.readLine()) != null) {
String[] fields = line.split ("\\t");
loadLine(fields);
}
while ((line = reader.readLine()) != null) {
datasourcesTxt = datasourcesTxt + line + "\n";
String[] fields = line.split ("\\t");
loadLine(fields);
}
}

protected void loadLine(String[] fields) throws IOException
Expand Down
2 changes: 2 additions & 0 deletions org.bridgedb.bio/src/org/bridgedb/bio/Organism.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public enum Organism
ArabidopsisThaliana("Arabidopsis thaliana", "At", 3702),
Aspergillusniger("Aspergillus niger", "An", "Black mold", 5061),
BacillusSubtilis("Bacillus subtilis", "Bs", 1423),
BetaVulgaris("Beta vulgaris", "Bv", "Sugar Beet", 3555),
BosTaurus("Bos taurus", "Bt", "Cow", 9913),
CaenorhabditisElegans("Caenorhabditis elegans", "Ce", "Worm", 6239),
CanisFamiliaris("Canis familiaris", "Cf", "Dog", 9615),
Expand All @@ -58,6 +59,7 @@ public enum Organism
GlycineMax("Glycine max", "Gm", "Soybean", 3847),
GibberellaZeae("Gibberella zeae", "Gz", "Fusarium graminearum", 5518),
HomoSapiens("Homo sapiens", "Hs", "Human", 9606),
HordeumVulgare("Hordeum vulgare", "Hv", "Barley", 4513),
LoxodontaAfricana ("Loxodonta africana", "La", "Elephant", 9785),
MacacaMulatta ("Macaca mulatta", "Ml", "Rhesus Monkey", 9544),
MusMusculus("Mus musculus", "Mm", "Mouse", 10090),
Expand Down
17 changes: 17 additions & 0 deletions org.bridgedb.server/src/org/bridgedb/server/DataSources.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.bridgedb.server;

import org.bridgedb.bio.DataSourceTxt;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class DataSources extends ServerResource {

protected void doInit() {
DataSourceTxt.init();
}

@Get
public String getDataSources() {
return DataSourceTxt.datasourcesTxt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class IDMapperService extends Application {
public static final String PAR_ID = "id";
public static final String PAR_SYSTEM = "system";
public static final String PAR_QUERY = "query";
public static final String PAR_DATASOURCES = "datasources";

public static final String PAR_TARGET_SYSTEM = "dataSource";
public static final String PAR_TARGET_ATTR_NAME = "attrName";
Expand Down Expand Up @@ -220,6 +221,11 @@ public IDMapperService(File aConfigFile, boolean transitive)
public static final String URL_BACK_PAGE_TEXT = "/{" + PAR_ORGANISM + "}/backPageText/{" + PAR_SYSTEM + "}/{" +
PAR_ID + "}";

/**
* URL pattern for getting the datasources.txt file
*/
public static final String URL_DATASOURCES = "/" + PAR_DATASOURCES;

private GdbProvider gdbProvider;

public synchronized void start() throws Exception {
Expand All @@ -234,6 +240,7 @@ public Restlet createRoot() {
//router.setDefaultMatchingMode(Router.BEST);
//System.out.println("MatchingMode: "+ router.getDefaultMatchingMode() + " : "+ router.getRequiredScore());

router.attach(URL_DATASOURCES, DataSources.class);

//Register the route for the home page url pattern
String target = "http://bridgedb.org/wiki/BridgeWebservice";
Expand Down

0 comments on commit 802773f

Please sign in to comment.