Skip to content

Commit

Permalink
wired stuff through to the end
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandunn committed Mar 23, 2019
1 parent c57d374 commit 9fba40f
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 4 deletions.
23 changes: 23 additions & 0 deletions grails-app/controllers/org/bbop/apollo/IOServiceController.groovy
Expand Up @@ -26,6 +26,7 @@ class IOServiceController extends AbstractApolloController {
def featureService
def gff3HandlerService
def fastaHandlerService
def jbrowseHandlerService
def chadoHandlerService
def preferenceService
def permissionService
Expand Down Expand Up @@ -63,6 +64,8 @@ class IOServiceController extends AbstractApolloController {
, @RestApiParam(name = "output", type = "string", paramType = RestApiParamType.QUERY, description = "Output method 'file','text'")
, @RestApiParam(name = "exportAllSequences", type = "boolean", paramType = RestApiParamType.QUERY, description = "Export all reference sequences for an organism (over-rides 'sequences')")
, @RestApiParam(name = "exportGff3Fasta", type = "boolean", paramType = RestApiParamType.QUERY, description = "Export reference sequence when exporting GFF3 annotations.")
, @RestApiParam(name = "exportFullJBrowse", type = "boolean", paramType = RestApiParamType.QUERY, description = "Export Full JBrowse installation when exporting as track (default false).")
, @RestApiParam(name = "exportJBrowseSequence", type = "boolean", paramType = RestApiParamType.QUERY, description = "Export JBrowse sequence when exporting JBrowse track (default false).")
, @RestApiParam(name = "region", type = "String", paramType = RestApiParamType.QUERY, description = "Highlighted genomic region to export in form sequence:min..max e.g., chr3:1001..1034")
]
)
Expand All @@ -79,6 +82,13 @@ class IOServiceController extends AbstractApolloController {
String typeOfExport = dataObject.type
String sequenceType = dataObject.seqType
Boolean exportAllSequences = dataObject.exportAllSequences ? Boolean.valueOf(dataObject.exportAllSequences) : false
// // always export all
// if(typeOfExport == FeatureStringEnum.TYPE_JBROWSE.value){
// exportAllSequences = true
// }

Boolean exportFullJBrowse = dataObject.exportFullJBrowse ? Boolean.valueOf(dataObject.exportFullJBrowse) : false
Boolean exportJBrowseSequence = dataObject.exportJBrowseSequence ? Boolean.valueOf(dataObject.exportJBrowseSequence) : false
Boolean exportGff3Fasta = dataObject.exportGff3Fasta ? Boolean.valueOf(dataObject.exportGff3Fasta) : false
String output = dataObject.output
String adapter = dataObject.adapter
Expand Down Expand Up @@ -203,6 +213,19 @@ class IOServiceController extends AbstractApolloController {
}
return // ??
}
else if (typeOfExport == FeatureStringEnum.TYPE_JBROWSE.getValue()) {
if(exportFullJBrowse){
render jbrowseHandlerService.writeFullJBrowse(organism)
}
else
if(exportJBrowseSequence){
render jbrowseHandlerService.writeJBrowseDirectory(organism)
}
else{
render jbrowseHandlerService.writeTrackOnly(organism)
}
return // ??
}

//generating a html fragment with the link for download that can be rendered on client side
String uuidString = UUID.randomUUID().toString()
Expand Down
68 changes: 68 additions & 0 deletions grails-app/services/org/bbop/apollo/JbrowseHandlerService.groovy
@@ -0,0 +1,68 @@
package org.bbop.apollo

import grails.transaction.Transactional
import org.codehaus.groovy.grails.web.json.JSONObject

import java.security.MessageDigest
import java.sql.Timestamp

/**
*
* Chado Compliance Layers
* Level 0: Relational schema - this basically means that the schema is adhered to
* Level 1: Ontologies - this means that all features in the feature table are of a type represented in SO and
* all feature relationships in feature_relationship table must be SO relationship types
* Level 2: Graph - all features relationships between a feature of type X and Y must correspond to relationship of
* that type in SO.
*
* Relevant Chado modules:
* Chado General Module
* Chado CV Module
* Chado Organism Module
* Chado Sequence Module
* Chado Publication Module
*
*/

@Transactional
class JbrowseHandlerService {

def configWrapperService
def sequenceService
def featureRelationshipService
def transcriptService
def cdsService

/**
* Track only
* @param organism
* @return
*/
def writeTrackOnly(Organism organism) {
JSONObject returnObject = new JSONObject()
println "writing track only"
return returnObject
}

/**
* Directory only
* @param organism
* @return
*/
def writeJBrowseDirectory(Organism organism) {
JSONObject returnObject = new JSONObject()
println "writing track only"
return returnObject
}

/**
* Full JBrowse
* @param organism
* @return
*/
def writeFullJBrowse(Organism organism) {
JSONObject returnObject = new JSONObject()
return returnObject
}

}
13 changes: 13 additions & 0 deletions src/gwt/org/bbop/apollo/gwt/client/ExportPanel.java
Expand Up @@ -34,6 +34,8 @@ public class ExportPanel extends Modal {
private Boolean exportAll = false;
private OrganismInfo currentOrganismInfo;
private Boolean exportAllSequencesToChado = false;
private Boolean exportFullJBrowse = false;
private Boolean exportJBrowseSequence = false;
HTML sequenceInfoLabel = new HTML();
HTML typeLabel = new HTML();
HTML sequenceTypeLabel = new HTML();
Expand Down Expand Up @@ -181,13 +183,16 @@ public void onClick(ClickEvent clickEvent) {
jbrowseExportButton2.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
exportJBrowseSequence = true ;
exportButton.setEnabled(true);
}
});

jbrowseExportButton3.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
exportJBrowseSequence = true ;
exportFullJBrowse = true ;
exportButton.setEnabled(true);
}
});
Expand Down Expand Up @@ -333,4 +338,12 @@ public Boolean getExportAllSequencesToChado() {
public void setExportAllSequencesToChado(Boolean value) {
this.exportAllSequencesToChado = value;
}

public Boolean getExportFullJBrowse() {
return exportFullJBrowse;
}

public Boolean getExportJBrowseSequence() {
return exportJBrowseSequence;
}
}
Expand Up @@ -4,10 +4,7 @@
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.*;
import org.bbop.apollo.gwt.client.Annotator;
import org.bbop.apollo.gwt.client.ExportPanel;
import org.bbop.apollo.gwt.client.SequencePanel;
Expand Down Expand Up @@ -57,6 +54,8 @@ else if (type.equals(FeatureStringEnum.TYPE_JBROWSE.getValue())) {
jsonObject.put("seqType", new JSONString(""));
jsonObject.put("exportGff3Fasta", new JSONString(""));
jsonObject.put("chadoExportType", new JSONString(""));
jsonObject.put("exportJBrowseSequence", JSONBoolean.getInstance(exportPanel.getExportJBrowseSequence()));
jsonObject.put("exportFullJBrowse", JSONBoolean.getInstance(exportPanel.getExportFullJBrowse()));
}
else {
jsonObject.put("chadoExportType", new JSONString(""));
Expand Down

0 comments on commit 9fba40f

Please sign in to comment.