Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LightMotif
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Larralde
LightMotif
Commits
d01753ca
Commit
d01753ca
authored
1 year ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Add dedicated result for scores and fix indexing in `__m256` pipeline
parent
54b18e19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lib.rs
+1
-0
1 addition, 0 deletions
src/lib.rs
src/pli.rs
+18
-10
18 additions, 10 deletions
src/pli.rs
src/pwm.rs
+6
-0
6 additions, 0 deletions
src/pwm.rs
with
25 additions
and
10 deletions
src/lib.rs
+
1
−
0
View file @
d01753ca
...
...
@@ -20,5 +20,6 @@ pub use pwm::Background;
pub
use
pwm
::
CountMatrix
;
pub
use
pwm
::
ProbabilityMatrix
;
pub
use
pwm
::
WeightMatrix
;
pub
use
pwm
::
StripedScores
;
pub
use
seq
::
EncodedSequence
;
pub
use
seq
::
StripedSequence
;
This diff is collapsed.
Click to expand it.
src/pli.rs
+
18
−
10
View file @
d01753ca
...
...
@@ -6,6 +6,7 @@ use super::abc::Alphabet;
use
super
::
abc
::
DnaAlphabet
;
use
super
::
abc
::
Symbol
;
use
super
::
dense
::
DenseMatrix
;
use
super
::
pwm
::
StripedScores
;
use
super
::
pwm
::
WeightMatrix
;
use
super
::
seq
::
EncodedSequence
;
use
super
::
seq
::
StripedSequence
;
...
...
@@ -38,7 +39,7 @@ impl Pipeline<DnaAlphabet, f32> {
&
self
,
seq
:
&
StripedSequence
<
DnaAlphabet
,
C
>
,
pwm
:
&
WeightMatrix
<
DnaAlphabet
,
{
DnaAlphabet
::
K
}
>
,
)
->
DenseMatrix
<
f32
,
C
>
{
)
->
StripedScores
<
C
>
{
let
mut
result
=
DenseMatrix
::
<
f32
,
C
>
::
new
(
seq
.data
.rows
());
for
i
in
0
..
seq
.length
-
pwm
.data
.rows
()
+
1
{
let
mut
score
=
0.0
;
...
...
@@ -52,7 +53,10 @@ impl Pipeline<DnaAlphabet, f32> {
let
row
=
i
%
result
.rows
();
result
[
row
][
col
]
=
score
;
}
result
StripedScores
{
length
:
seq
.length
,
data
:
result
,
}
}
}
...
...
@@ -62,12 +66,12 @@ impl Pipeline<DnaAlphabet, __m256> {
&
self
,
seq
:
&
StripedSequence
<
DnaAlphabet
,
{
std
::
mem
::
size_of
::
<
__m256i
>
()
}
>
,
pwm
:
&
WeightMatrix
<
DnaAlphabet
,
{
DnaAlphabet
::
K
}
>
,
)
->
DenseMatrix
<
f32
,
32
>
{
)
->
StripedScores
<
{
std
::
mem
::
size_of
::
<
__m256i
>
()
}
>
{
const
S
:
i32
=
std
::
mem
::
size_of
::
<
f32
>
()
as
i32
;
const
C
:
usize
=
std
::
mem
::
size_of
::
<
__m256i
>
();
const
K
:
usize
=
DnaAlphabet
::
K
;
let
mut
result
=
DenseMatrix
::
new
(
seq
.
data
.rows
()
);
let
mut
result
=
DenseMatrix
::
new
(
(
seq
.
length
+
C
)
/
C
);
unsafe
{
// get raw pointers to data
let
sdata
=
seq
.data
[
0
]
.as_ptr
();
...
...
@@ -136,13 +140,17 @@ impl Pipeline<DnaAlphabet, __m256> {
s4
=
_mm256_add_ps
(
s4
,
p4
);
}
let
row
=
rdata
.add
(
i
);
_mm256_store
u
_ps
(
row
,
s1
);
_mm256_store
u
_ps
(
row
.add
(
0x
4
),
s2
);
_mm256_store
u
_ps
(
row
.add
(
0x
8
),
s3
);
_mm256_store
u
_ps
(
row
.add
(
0x
c
),
s4
);
let
row
=
rdata
.add
(
i
*
32
);
_mm256_store_ps
(
row
.add
(
0x00
)
,
s1
);
_mm256_store_ps
(
row
.add
(
0x
08
),
s2
);
_mm256_store_ps
(
row
.add
(
0x
10
),
s3
);
_mm256_store_ps
(
row
.add
(
0x
18
),
s4
);
}
}
result
StripedScores
{
length
:
seq
.length
,
data
:
result
,
}
}
}
This diff is collapsed.
Click to expand it.
src/pwm.rs
+
6
−
0
View file @
d01753ca
...
...
@@ -160,3 +160,9 @@ pub struct WeightMatrix<A: Alphabet, const K: usize> {
pub
data
:
DenseMatrix
<
f32
,
K
>
,
pub
name
:
String
,
}
#[derive(Clone,
Debug)]
pub
struct
StripedScores
<
const
C
:
usize
=
32
>
{
pub
length
:
usize
,
pub
data
:
DenseMatrix
<
f32
,
C
>
,
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment