Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,712
Issues
1,712
List
Boards
Labels
Service Desk
Milestones
Merge Requests
87
Merge Requests
87
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
bb72c63b
Commit
bb72c63b
authored
Jul 15, 2019
by
Mikaël Salson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
browser/js: Uniformize the way we deal with sites limiting the number of input sequences
parent
5237cf98
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
8 deletions
+30
-8
browser/js/crossDomain.js
browser/js/crossDomain.js
+6
-3
browser/js/segmenter.js
browser/js/segmenter.js
+0
-4
browser/js/tools.js
browser/js/tools.js
+16
-1
browser/test/QUnit/testFiles/tools_test.js
browser/test/QUnit/testFiles/tools_test.js
+8
-0
No files found.
browser/js/crossDomain.js
View file @
bb72c63b
...
...
@@ -136,9 +136,7 @@ function imgtPostForSegmenter(species, data, system, segmenter, override_imgt_op
//process to first 10 sequences then alert user about the remaining part
if
(
nb
>
10
)
{
pos
=
nth_ocurrence
(
data
,
'
>
'
,
11
);
var
newdata
=
data
.
substr
(
pos
);
data
=
data
.
substr
(
0
,
pos
-
1
);
data
=
getNFirstSequences
(
data
,
10
);
var
msg
=
"
The first 10 sequences were sent to IMGT/V-QUEST.
"
console
.
log
({
...
...
@@ -395,6 +393,11 @@ blastInput.NCBIBLAST_BLASTN__dust = 1;
blastInput
.
NCBIBLAST_BLASTN__repeat_mask
=
1
;
function
blastPost
(
species
,
data
,
system
)
{
if
(
self
.
m
.
getSelected
().
length
>
30
)
{
data
=
getNFirstSequences
(
data
,
30
);
console
.
log
({
"
type
"
:
"
flash
"
,
"
msg
"
:
"
A maximum of 30 clones are allowed by Blast. Only the first 30 sequences will be sent
"
,
"
priority
"
:
1
});
}
blastInput
.
query_sequence
=
data
;
...
...
browser/js/segmenter.js
View file @
bb72c63b
...
...
@@ -248,11 +248,7 @@ Segment.prototype = {
span
.
setAttribute
(
'
title
'
,
'
Send sequences to Ensembl Blast and see the results in a new tab
'
)
span
.
className
=
"
button
"
;
span
.
onclick
=
function
()
{
if
(
self
.
m
.
getSelected
().
length
>
30
)
{
console
.
log
({
"
type
"
:
"
flash
"
,
"
msg
"
:
"
A maximum of 30 clones are allowed by Blast
"
,
"
priority
"
:
1
});
}
else
{
self
.
sendTo
(
'
blast
'
);
}
};
span
.
appendChild
(
document
.
createTextNode
(
"
❯ to Blast
"
));
div_menu
.
appendChild
(
span
);
...
...
browser/js/tools.js
View file @
bb72c63b
...
...
@@ -712,4 +712,19 @@ function openAndFillNewTab (content){
html
:
content
}).
appendTo
(
w
.
document
.
body
);
return
}
\ No newline at end of file
}
/**
* @param {data} a string containing a multi-FASTA
* @param {n} the number of sequences to keep
* @return return a string containing at most {n} FASTA sequences.
* if {n} is negative or null return {data} itself
*/
function
getNFirstSequences
(
data
,
n
)
{
var
pos
=
nth_ocurrence
(
data
,
'
>
'
,
n
+
1
);
if
(
pos
)
{
return
data
.
substr
(
0
,
pos
);
}
else
{
return
data
;
}
}
browser/test/QUnit/testFiles/tools_test.js
View file @
bb72c63b
...
...
@@ -416,3 +416,11 @@ QUnit.test("Sort list locus", function(assert) {
assert
.
deepEqual
(
list_test_2
,
wait_test_2
,
"
list2 is correctly sorted
"
)
}
);
QUnit
.
test
(
"
Get n first sequences
"
,
function
(
assert
)
{
seqs
=
"
>seq1
\n
AT
\n
>seq2
\n
TC
\n
>seq3
\n
CC
\n
"
;
assert
.
equal
(
getNFirstSequences
(
seqs
,
1
),
"
>seq1
\n
AT
\n
"
);
assert
.
equal
(
getNFirstSequences
(
seqs
,
0
),
seqs
);
assert
.
equal
(
getNFirstSequences
(
seqs
,
-
1
),
seqs
);
assert
.
equal
(
getNFirstSequences
(
seqs
,
2
),
"
>seq1
\n
AT
\n
>seq2
\n
TC
\n
"
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment