text: var pt=React.PropTypes;var RegionSelect=React.createClass({displayName:"RegionSelect",mixins:[PathUpdate,ImmutableUpdate],propTypes:{regionSelect:pt.object.isRequired,db:pt.string},menuOptions:Immutable.fromJS([{label:"position or search term",value:"position"},{label:"genome",value:"genome"},{label:"defined regions",value:"userRegions"}]),menuOptionsNoGenome:Immutable.fromJS([{label:"position or search term",value:"position"},{label:"genome",value:"genome",disabled:true},{label:"defined regions",value:"userRegions"}]),changeRegions:function(){this.props.update(this.props.path.concat("changeRegions"))},clearRegions:function(){this.props.update(this.props.path.concat("clearRegions"))},render:function(){var props=this.props;var regionSelect=props.regionSelect;var userRegions=regionSelect.get("userRegions");var selected=regionSelect.get("hgi_range");var disableGenome=regionSelect.get("disableGenome");var menuOptions=disableGenome?this.menuOptionsNoGenome:this.menuOptions;var modeControls=null;if(selected==="userRegions"){modeControls=[React.createElement("span",{className:"smallText sectionItem"},userRegions.get("summary")),React.createElement("input",{type:"button",value:"change regions",onClick:this.changeRegions}),React.createElement("input",{type:"button",value:"clear",onClick:this.clearRegions})]}else if(selected!=="genome"){modeControls=React.createElement(PositionSearch,{positionInfo:regionSelect.get("positionInfo"),className:"sectionItem",db:props.db,path:props.path.concat("positionInfo"),update:props.update})}var spinner=null;if(regionSelect.get("loading")){spinner=React.createElement(Icon,{type:"spinner",className:"floatRight"})}return React.createElement("div",{className:"sectionRow"},React.createElement(LabeledSelect,{label:"region to annotate",className:"sectionItem",selected:selected,options:menuOptions,update:props.update,path:props.path.concat("hgi_range")}),spinner,modeControls,React.createElement(UserRegions,{settings:userRegions,update:props.update,path:props.path.concat("userRegions")}))}});var LabeledSelectRow=React.createClass({displayName:"LabeledSelectRow",mixins:[PathUpdate,ImmutableUpdate],propTypes:{descriptors:pt.object.isRequired},makeMenuFromDescriptor:function(descriptor,ix){if(!descriptor||descriptor.get("hide")){return null}else{var key="lsrMenu"+ix;return React.createElement(LabeledSelect,{label:descriptor.get("label"),selected:descriptor.get("selected"),options:descriptor.get("valLabels"),key:key,className:"sectionItem",update:this.props.update,path:this.props.path.concat(ix)})}},render:function(){var descriptors=this.props.descriptors;return React.createElement("div",{className:"sectionRow sectionItem"},descriptors.map(this.makeMenuFromDescriptor).toJS())}});function makeSchemaLink(schemaUrl){if(schemaUrl){return React.createElement("span",{className:"smallText sectionItem"},React.createElement("a",{href:schemaUrl,target:"ucscSchema",title:"Open table schema in new window"},"View table schema"))}else{return null}}var AddDataSource=React.createClass({displayName:"AddDataSource",mixins:[PathUpdate,ImmutableUpdate],propTypes:{addDsInfo:pt.object.isRequired},onAdd:function(){this.props.update(this.props.path.concat("addDataSource"))},onTrackHubs:function(){this.props.update(this.props.path.concat("trackHubs"))},onCustomTracks:function(){this.props.update(this.props.path.concat("customTracks"))},render:function(){var path=this.props.path||[];var addDsInfo=this.props.addDsInfo;if(!(addDsInfo&&addDsInfo.size)){return React.createElement(Icon,{type:"spinner"})}var schemaLink=makeSchemaLink(addDsInfo.get("schemaUrl"));return React.createElement("div",null,React.createElement("div",{className:"boldText sectionRow"},"Add Data Source"),React.createElement(LabeledSelectRow,{descriptors:addDsInfo.get("menus"),path:path.concat("addDsMenuSelect"),update:this.props.update}),schemaLink,React.createElement("input",{type:"button",value:"Add",disabled:addDsInfo.get("disabled"),onClick:this.onAdd}),React.createElement("br",null),React.createElement("div",{className:"sectionRow"},"get more data:",React.createElement("br",null),React.createElement("input",{type:"button",value:"track hubs",onClick:this.onTrackHubs}),React.createElement("input",{type:"button",value:"custom tracks",onClick:this.onCustomTracks})))}});var FieldSelect=React.createClass({displayName:"FieldSelect",mixins:[PathUpdate,ImmutableUpdate],propTypes:{fieldSelect:pt.object},onAddRelated:function(track){this.props.update(this.props.path.concat("addRelated",track))},onDone:function(){this.props.update(this.props.path.concat("remove"))},renderTableInfo:function(track,table,tableInfo){var update=this.props.update;var removePath=this.props.path.concat("removeRelated",track,table);var setClearPath=this.props.path.concat("setAll",track,table);var maybeRemoveIcon=track!==table?React.createElement(Icon,{type:"x",update:update,path:removePath}):null;var fields=tableInfo.get("fields");var bodyRows;if(!fields){bodyRows=React.createElement("tr",{key:table+".spinner"},React.createElement("td",{colSpan:3}," ",React.createElement(Icon,{type:"spinner"})," "))}else{bodyRows=fields.map(function(setting){var field=setting.get("name");var checked=setting.get("checked");var desc=setting.get("desc");var checkedPath=this.props.path.concat("checked",track,table,field);var tfPrefix=table+"."+field+".";return React.createElement("tr",{key:tfPrefix+"row"},React.createElement("td",{key:tfPrefix+"cb"},React.createElement(CheckboxLabel,{checked:checked,path:checkedPath,update:this.props.update})),React.createElement("td",{key:tfPrefix+"label"},field),React.createElement("td",{key:tfPrefix+"desc",style:{paddingLeft:"0.5em"}},desc))},this).toArray()}return[React.createElement("tr",{key:table+".title"},React.createElement("td",{colSpan:3},React.createElement("span",{key:"label",className:"boldText"},tableInfo.get("label")),React.createElement("div",{key:"spacer",style:{display:"inline-block",width:"10px"}}),maybeRemoveIcon,React.createElement(SetClearButtons,{path:setClearPath,update:update}))),bodyRows,React.createElement("tr",{key:table+".spacer"},React.createElement("td",{colSpan:3,style:{height:"10px"}}))]},renderRelatedTables:function(track,relatedTables,disableAddButton){if(relatedTables){var selected=relatedTables.get("selected");var options=relatedTables.get("options");var onAddRelated=_.bind(this.onAddRelated,this,track);return[React.createElement("tr",{key:"addRelatedSel."+track},React.createElement("td",{colSpan:3},React.createElement(LabeledSelect,{label:"Related tables",selected:selected,options:options,className:"sectionItem",path:this.props.path.concat("selectRelated",track),update:this.props.update}))),React.createElement("tr",{key:"addRelatedButton."+track},React.createElement("td",{colSpan:3},React.createElement("input",{type:"button",value:"Add table",disabled:disableAddButton,onClick:onAddRelated}))),React.createElement("tr",{key:"addRelated"+track+"Spacer"},React.createElement("td",{colSpan:3,style:{height:"10px"}}))]}},renderTrackSections:function(){var fieldSelect=this.props.fieldSelect;var i=0;return fieldSelect.map(function(info,track){var relatedTables=info.get("relatedAvailable");var tableFields=info.get("tableFields");var disableAddButton=info.get("disableAddButton");var separator=null;if(i>0){separator=[React.createElement("tr",{key:"sep"+i},React.createElement("td",{colSpan:3,style:{background:"black",height:"1px",padding:0}})),React.createElement("tr",{key:"sepSpacer"+i},React.createElement("td",{colSpan:3,style:{height:"10px"}}))]}i++;return[separator,tableFields.map(function(tableInfo,table){return this.renderTableInfo(track,table,tableInfo)},this).toArray(),this.renderRelatedTables(track,relatedTables,disableAddButton)]},this).toArray()},render:function(){if(this.props.fieldSelect){if(this.props.fieldSelect.size>0){return React.createElement(Modal,{title:"Choose Fields",path:this.props.path,update:this.props.update},React.createElement("div",{style:{height:5}}),React.createElement("table",{style:{borderCollapse:"collapse",width:"100%"}},React.createElement("tbody",null,this.renderTrackSections())),React.createElement("input",{type:"button",value:"Done",onClick:this.onDone}))}else{return React.createElement(Modal,{title:"Choose Fields",path:this.props.path,update:this.props.update},React.createElement(Icon,{type:"spinner"}))}}else{return null}}});var OutFileOptions=React.createClass({displayName:"OutFileOptions",mixins:[PathUpdate,ImmutableUpdate],propTypes:{options:pt.object,fieldSelect:pt.object,showLoadingImage:pt.bool,disableGetOutput:pt.bool,disableGetOutputMessage:pt.node},getDefaultProps:function(){return{showLoadingImage:false}},onChooseFields:function(){var path=this.props.path||[];this.props.update(path.concat("chooseFields"))},onGetOutput:function(){var path=this.props.path||[];this.props.update(path.concat("getOutput"))},render:function(){var doFile=this.props.options.get("doFile");var fileName=this.props.options.get("fileName");var doGzip=this.props.options.get("doGzip");var path=this.props.path||[];var fileInputDisplay=doFile?"inline-block":"none";if(this.props.disableGetOutput){return this.props.disableGetOutputMessage}return React.createElement("div",null,React.createElement("div",{className:"sectionRow"},React.createElement(CheckboxLabel,{checked:doFile,label:"Send output to file",className:"sectionItem",path:path.concat("doFile"),update:this.props.update}),React.createElement("div",{style:{display:fileInputDisplay}},React.createElement("span",{className:"sectionItem"},"name:"),React.createElement("span",{className:"sectionItem"},React.createElement(TextInput,{value:fileName,path:path.concat("fileName"),update:this.props.update,size:75})),React.createElement(CheckboxLabel,{checked:doGzip,label:"Compress with gzip (.gz)",className:"sectionItem",path:path.concat("doGzip"),update:this.props.update}))),React.createElement("div",{className:"sectionRow"},React.createElement("input",{type:"button",value:"Choose fields...",onClick:this.onChooseFields})),React.createElement(FieldSelect,{fieldSelect:this.props.fieldSelect,update:this.props.update,path:path.concat("fieldSelect")}),React.createElement("div",{className:"sectionRow"},React.createElement("br",null),React.createElement("input",{type:"button",value:"Get output",onClick:this.onGetOutput})),React.createElement(LoadingImage,{loading:this.props.showLoadingImage}))}});var QueryBuilder=React.createClass({displayName:"QueryBuilder",mixins:[PathUpdate,ImmutableUpdate],propTypes:{dataSources:pt.object,outFileOptions:pt.object,addDsInfo:pt.object,fieldSelect:pt.object,showLoadingImage:pt.bool},renderDataSource:function(dataSource,i){var dsKey="ds"+i;var path=this.props.path.concat("dataSources",i);var schemaLink=makeSchemaLink(dataSource.get("schemaUrl"));return React.createElement("div",{key:dsKey,className:"dataSourceSubsection"},React.createElement("div",{className:"sortHandle"},React.createElement("span",{className:"floatLeft"},React.createElement(Icon,{type:"upDown",className:"sectionItem"}),React.createElement("span",{className:"boldText sectionItem"},dataSource.get("label")),React.createElement("span",{className:"sectionItem"},schemaLink)),React.createElement(Icon,{type:"x",className:"floatRight",update:this.props.update,path:path.concat("remove")}),React.createElement("div",{className:"clear"})))},renderDataSources:function(dataSources){var reorderPath=this.props.path.concat("dataSources","reorder");if(dataSources&&dataSources.size){return React.createElement(Sortable,{sortableConfig:{handle:".sortHandle",axis:"y"},path:reorderPath,update:this.props.update,className:"subsectionBox"},dataSources.map(this.renderDataSource).toJS())}else{return React.createElement("div",{className:"subsectionBox"},React.createElement("span",{className:"disabledMessage"},"please add at least one data source"))}},render:function(){var addDsInfo=this.props.addDsInfo;var dataSources=this.props.dataSources;var outputInfo=this.props.outFileOptions||Immutable.Map();if(!(addDsInfo&&dataSources)){return React.createElement(Section,{title:"Loading..."})}else{var fieldSelect=this.props.fieldSelect;var disableGetOutput=!(dataSources&&dataSources.size);var disableGetOutputMessage=React.createElement("span",{className:"disabledMessage"},"At least one data source must be added.");return React.createElement("div",null,React.createElement(Section,{title:"Configure Data Sources"},this.renderDataSources(dataSources),React.createElement(AddDataSource,{addDsInfo:addDsInfo,path:[],update:this.props.update})),React.createElement(Section,{title:"Output Options"},React.createElement(OutFileOptions,{options:outputInfo,fieldSelect:fieldSelect,showLoadingImage:this.props.showLoadingImage,disableGetOutput:disableGetOutput,disableGetOutputMessage:disableGetOutputMessage,path:["outFileOptions"],update:this.props.update})))}}});var DbPosAndQueryBuilder=React.createClass({displayName:"DbPosAndQueryBuilder",mixins:[PathUpdate,ImmutableUpdate],propTypes:{cladeOrgDbInfo:pt.object,regionSelect:pt.object,dataSources:pt.object,outFileOptions:pt.object,addDsInfo:pt.object,fieldSelect:pt.object,showLoadingImage:pt.bool},render:function(){var path=this.props.path;var cladeOrgDbInfo=this.props.cladeOrgDbInfo;if(!cladeOrgDbInfo){return React.createElement(Section,{title:"Loading..."})}else{return React.createElement("div",null,React.createElement(Section,{title:"Select Genome Assembly and Region"},React.createElement(CladeOrgDb,{menuData:cladeOrgDbInfo,path:path.concat("cladeOrgDb"),update:this.props.update}),React.createElement(RegionSelect,{regionSelect:this.props.regionSelect,db:cladeOrgDbInfo.get("db"),path:path.concat("regionSelect"),update:this.props.update})),React.createElement(QueryBuilder,{addDsInfo:this.props.addDsInfo,dataSources:this.props.dataSources,outFileOptions:this.props.outFileOptions,fieldSelect:this.props.fieldSelect,showLoadingImage:this.props.showLoadingImage,path:path,update:this.props.update}))}}});function helpSection(){return React.createElement(Section,{title:"Using the Data Integrator"},React.createElement("p",null,"The Data Integrator finds items in different tracks that overlap by position,"+" "+"and unlike the Table Browser's intersection function, the Data"+" "+"Integrator can output all fields from all selected tracks.  Up to 5"+" "+"different tracks may be queried at a time."),React.createElement("p",null,"This section contains a brief overview of Data Integrator controls."+" "+"For more information on using the tools,"+" "+"see the ",React.createElement("a",{href:"../goldenPath/help/hgIntegratorHelp.html"},"Data"+" "+"Integrator User's Guide"),"."),React.createElement("p",null,React.createElement("b",null,"Select Genome Assembly and Region"),React.createElement("br",null),"The controls in this section are for selecting a genome assembly and region to search.",React.createElement("ul",null,React.createElement("li",null,React.createElement("b",null,"group"),":"+" "+"A species group: Mammal, Vertebrate, Insect etc."),React.createElement("li",null,React.createElement("b",null,"genome"),":"+" "+"A single species such as Human or Mouse"+" "+"(not available for certain tracks with restrictions on data sharing)."),React.createElement("li",null,React.createElement("b",null,"assembly"),":"+" "+"A version of the reference genome assembly such as GRCh37/hg19."))),React.createElement("p",null,React.createElement("b",null,"Configure Data Sources"),React.createElement("br",null),"Currently selected data sources (tracks, custom tracks, hub tracks etc) are listed"+" "+"with ",React.createElement(Icon,{type:"upDown"})," icons"+" "+"for reordering the data sources."+" "+"The first data source is special in that data from the remaining data sources appear"+" "+"only when they overlap with the first data source."+" "+'Under "',React.createElement("b",null,"Add Data Source"),'", several menus display available data sources:',React.createElement("ul",null,React.createElement("li",null,React.createElement("b",null,"track group"),":"+" "+'A category of data track, for example "Genes and Gene Prediction"'+" "+'or "Regulation".'),React.createElement("li",null,React.createElement("b",null,"track"),":"+" "+"One or more data tables containing results of an experiment"+" "+"or a group of closely related experiments."+" "+"Some tracks are not available when the region is set"+" "+"to ",React.createElement("b",null,"genome")," due to the data provider's restrictions on sharing."),React.createElement("li",null,React.createElement("b",null,"table"),":"+" "+"This appears only when the selected track has more than one data table.")),"These sections can be reordered by dragging on the section title or arrow icon on the left."+" "+"To remove a section, click"+" "+"the ",React.createElement(Icon,{type:"x"})," icon"+" "+"to the right of the title."+" "+"Click on the Add button to add a new data source."),React.createElement("p",null,React.createElement("b",null,"Output Options"),React.createElement("br",null),React.createElement("ul",null,React.createElement("li",null,React.createElement("b",null,"Send output to file"),":"+" "+"check this box to have output sent to a local file"+" "+"instead of to the web browser window.",React.createElement("br",null),"When this is checked, additional options appear:",React.createElement("ul",null,React.createElement("li",null,React.createElement("b",null,"name"),":"+" "+"the file name to which output will be saved"),React.createElement("li",null,React.createElement("b",null,"compress with gzip"),":"+" "+"check this box to have the output file compressed by gzip (.gz)."+" "+"This saves disk space and may reduce network transfer time."))),React.createElement("li",null,React.createElement("b",null,"Choose fields"),":"+" "+"click this button to pop up a dialog box with a checkbox"+" "+"for each field of each data source.  If a checkbox is checked, that field will"+" "+"appear in the output."+" "+"Some tracks also have related mysql tables that can be selected and added to output."+" "+"However, some of those tables may be unavailable when region is set"+" "+"to ",React.createElement("b",null,"genome")," due to the data provider's restrictions on sharing."))))}var AppComponent=React.createClass({displayName:"AppComponent",mixins:[ImmutableUpdate],getDefaultProps:function(){return{path:[]}},render:function(){var appState=this.props.appState;var appStateJS=appState.toJS();console.log("top-level render:",appStateJS);var path=this.props.path;return React.createElement("div",{className:"cgiContents"},React.createElement("div",{className:"cgiTitleBox"},React.createElement("span",{className:"cgiTitle"},"Data Integrator"),React.createElement("input",{type:"button",value:"Undo",onClick:this.props.undo,disabled:!appState.get("canUndo")}),React.createElement("input",{type:"button",value:"Redo",onClick:this.props.redo,disabled:!appState.get("canRedo")})),React.createElement(DbPosAndQueryBuilder,{cladeOrgDbInfo:appState.get("cladeOrgDb"),regionSelect:appState.get("regionSelect"),addDsInfo:appState.get("addDsInfo"),dataSources:appState.get("dataSources"),outFileOptions:appState.get("outFileOptions"),fieldSelect:appState.get("fieldSelect"),showLoadingImage:appState.get("showLoadingImage"),path:path,update:this.props.update}),helpSection())}});AppComponent=AppComponent;