Skip to content

Commit 0c11e63

Browse files
committed
Show Rfam alignment
1 parent 2473061 commit 0c11e63

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

src/actions/actionTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export const FETCH_RESULTS = 'FETCH_RESULTS';
33
export const FETCH_INFERNAL_RESULTS = 'FETCH_INFERNAL_RESULTS';
44
export const FAILED_FETCH_RESULTS = 'FAILED_FETCH_RESULTS';
55

6+
export const TOGGLE_INFERNAL_ALIGNMENTS_COLLAPSED = 'TOGGLE_INFERNAL_ALIGNMENTS_COLLAPSED';
67
export const TOGGLE_ALIGNMENTS_COLLAPSED = 'TOGGLE_ALIGNMENTS_COLLAPSED';
78
export const TOGGLE_DETAILS_COLLAPSED = 'TOGGLE_DETAILS_COLLAPSED';
89
export const TOGGLE_FACET = 'TOGGLE_FACET';

src/actions/actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ let buildQuery = function (selectedFacets) {
2828
return outputText;
2929
};
3030

31+
export function toggleInfernalAlignmentsCollapsed() {
32+
return {type: types.TOGGLE_INFERNAL_ALIGNMENTS_COLLAPSED };
33+
}
3134

3235
export function toggleAlignmentsCollapsed() {
3336
return {type: types.TOGGLE_ALIGNMENTS_COLLAPSED };

src/containers/SequenceSearch/components/Results/index.jsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,32 @@ class Results extends React.Component {
129129
<th>Bit score</th>
130130
<th>E-value</th>
131131
<th>Strand</th>
132+
<th>Alignment</th>
132133
</tr>
133134
</thead>
134-
<tbody>
135135
{this.props.infernalEntries.map((entry, index) => (
136-
<tr key={`${index}`}>
136+
<tbody key={`${index}`}>
137+
<tr>
137138
<td><a href={`https://rfam.org/family/${entry.target_name}`} target="_blank">{entry.description}</a></td>
138139
<td><a href={`https://rfam.org/family/${entry.accession_rfam}`} target="_blank">{entry.accession_rfam}</a></td>
139140
<td>{entry.seq_from}</td>
140141
<td>{entry.seq_to}</td>
141142
<td>{entry.score}</td>
142143
<td>{entry.e_value}</td>
143144
<td>{entry.strand}</td>
145+
<td>
146+
<a onClick={ this.props.onToggleInfernalAlignmentsCollapsed }>
147+
{ this.props.infernalAlignmentsCollapsed ? <span>&#x25B6; Show</span> : <span>&#x25BC; Hide</span> }
148+
</a>
149+
</td>
150+
</tr>
151+
<tr>
152+
<td colSpan={8} className={`callout alignment`} style={{borderTop: "none"}}>
153+
{this.props.infernalAlignmentsCollapsed ? '' : entry.alignment }
154+
</td>
144155
</tr>
145-
))}
146156
</tbody>
157+
))}
147158
</table>
148159
] : <p>The query sequence did not match any <img src={'https://rnacentral.org/static/img/expert-db-logos/rfam.png'} alt="Rfam logo" style={{width: "6%", verticalAlign: "sub"}}/> families.</p>}
149160
</div>
@@ -210,6 +221,7 @@ function mapStateToProps(state) {
210221
jobId: state.jobId,
211222
jobList: state.jobList,
212223
infernalEntries: state.infernalEntries,
224+
infernalAlignmentsCollapsed: state.infernalAlignmentsCollapsed,
213225
exactMatch: state.exactMatch,
214226
rnacentral: state.rnacentral,
215227
};
@@ -218,6 +230,7 @@ function mapStateToProps(state) {
218230
function mapDispatchToProps(dispatch) {
219231
return {
220232
onLoadMore: (event) => dispatch(actionCreators.onLoadMore(event)),
233+
onToggleInfernalAlignmentsCollapsed: (event) => dispatch(actionCreators.toggleInfernalAlignmentsCollapsed(event)),
221234
}
222235
}
223236

src/reducers/rootReducer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ const rootReducer = function (state = initialState, action) {
119119
alignmentsCollapsed: !state.alignmentsCollapsed
120120
});
121121

122+
case actions.TOGGLE_INFERNAL_ALIGNMENTS_COLLAPSED:
123+
return Object.assign({}, state, {
124+
infernalAlignmentsCollapsed: !state.infernalAlignmentsCollapsed
125+
});
126+
122127
case actions.TOGGLE_DETAILS_COLLAPSED:
123128
return Object.assign({}, state, {
124129
detailsCollapsed: !state.detailsCollapsed

src/store/initialState.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ let initialState = {
3232
// cmscan search
3333
infernalStatus: statusChoices.notSubmitted,
3434
infernalEntries: [],
35+
infernalAlignmentsCollapsed: true,
3536
};
3637

3738
export default initialState;

0 commit comments

Comments
 (0)