Skip to content

Commit d344154

Browse files
committed
Use sequence id instead of accession for sequence retrieval
With V4 databases it was possible to use accession for retrieving sequences. So we used accession. Thus freeing us from the need to encode sequence ids which may contain the pipe special character. However, with V5 databases, the entire sequence id must be used. This is problematic if databases use sequence id of the format 'gnl|foo|bar' (#475), and potentially for other id formats too. Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
1 parent 4e01bb4 commit d344154

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

lib/sequenceserver/sequence.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def initialize(*args)
4242
# If hit comes from a non -parse_seqids
4343
# database, obtain seqid and title from
4444
# defline.
45-
if args[1] =~ /^gnl\|/
45+
if args[1] =~ /^gnl\|BL_ORD_ID\|\d+/
4646
defline = args[3].split
4747
args[1] = defline.shift
4848
args[3] = defline.join(' ')

public/js/hit.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export default React.createClass({
1616
return this.props.hit.accession;
1717
},
1818

19+
/**
20+
* Returns id of the hit sequence.
21+
*/
22+
sequenceID: function () {
23+
return this.props.hit.id;
24+
},
25+
1926
/**
2027
* Returns length of the hit sequence.
2128
*/
@@ -41,12 +48,12 @@ export default React.createClass({
4148
},
4249

4350
viewSequenceLink: function () {
44-
return encodeURI(`get_sequence/?sequence_ids=${this.accession()}&database_ids=${this.databaseIDs()}`);
51+
return encodeURI(`get_sequence/?sequence_ids=${this.sequenceID()}&database_ids=${this.databaseIDs()}`);
4552
},
4653

4754
downloadFASTA: function (event) {
48-
var accessions = [this.accession()];
49-
downloadFASTA(accessions, this.databaseIDs());
55+
var sequenceIDs = [this.sequenceID()];
56+
downloadFASTA(sequenceIDs, this.databaseIDs());
5057
},
5158

5259
// Event-handler for exporting alignments.
@@ -129,7 +136,7 @@ export default React.createClass({
129136
<div className="hit-links">
130137
<label>
131138
<input type="checkbox" id={this.domID() + '_checkbox'}
132-
value={this.accession()} onChange={function () {
139+
value={this.sequenceID()} onChange={function () {
133140
this.props.selectHit(this.domID() + '_checkbox');
134141
}.bind(this)} data-target={'#' + this.domID()}
135142
/> Select

public/js/sidebar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default React.createClass({
1616
var sequence_ids = [];
1717
this.props.data.queries.forEach(
1818
(query) => query.hits.forEach(
19-
(hit) => sequence_ids.push(hit.accession)));
19+
(hit) => sequence_ids.push(hit.id)));
2020
var database_ids = this.props.data.querydb.map((querydb) => querydb.id);
2121
downloadFASTA(sequence_ids, database_ids);
2222
return false;
@@ -66,7 +66,7 @@ export default React.createClass({
6666
console.log('check '+sequence_ids.toString());
6767
_.each(this.props.data.queries, _.bind(function (query) {
6868
_.each(query.hits, function (hit) {
69-
if (_.indexOf(sequence_ids, hit.accession) != -1) {
69+
if (_.indexOf(sequence_ids, hit.id) != -1) {
7070
_.each(hit.hsps, function (hsp) {
7171
hsp.hit_id = hit.id;
7272
hsp.query_id = query.id;

0 commit comments

Comments
 (0)