Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
phap
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
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
Nikos Pappas
phap
Commits
eced405a
Commit
eced405a
authored
4 years ago
by
Nikos Pappas
Browse files
Options
Downloads
Patches
Plain Diff
change samplesheet to tsv
parent
229e6344
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
workflow/Snakefile
+14
-9
14 additions, 9 deletions
workflow/Snakefile
with
14 additions
and
9 deletions
workflow/Snakefile
+
14
−
9
View file @
eced405a
...
@@ -2,18 +2,23 @@ from pathlib import Path
...
@@ -2,18 +2,23 @@ from pathlib import Path
configfile
:
"
config/config.yaml
"
configfile
:
"
config/config.yaml
"
# This doesn't work for now
# Need to bind mount the data directory on the containers
# with --singularity-args "-B path/to/data_dir:/data"
DATA_DIR
=
Path
(
config
.
get
(
"
vhmnet
"
).
get
(
"
data_dir
"
))
DATA_DIR
=
Path
(
config
.
get
(
"
vhmnet
"
).
get
(
"
data_dir
"
))
def
parse_samples_csv
(
samples_csv
):
def
parse_samplesheet
(
samples_tsv
):
samples
=
{}
samples_dic
=
{}
with
open
(
samples_csv
,
'
r
'
)
as
fin
:
with
open
(
samples_tsv
,
'
r
'
)
as
fin
:
next
(
fin
)
header_line
=
fin
.
readline
()
header_fields
=
[
f
.
strip
()
for
f
in
header_line
.
split
(
'
\t
'
)]
assert
header_fields
==
[
'
sample
'
,
'
fasta
'
],
"
Malformatted samplesheet
"
for
line
in
fin
:
for
line
in
fin
:
fields
=
[
f
.
strip
()
for
f
in
line
.
split
(
'
,
'
)]
fields
=
[
f
.
strip
()
for
f
in
line
.
split
(
'
\t
'
)]
samples
[
fields
[
0
]]
=
fields
[
1
]
samples
_dic
[
fields
[
0
]]
=
fields
[
1
]
return
samples
return
samples
_dic
samples_dic
=
parse_samples
_csv
(
config
.
get
(
'
samplesheet
'
,
'
samples.
c
sv
'
))
samples_dic
=
parse_samples
heet
(
config
.
get
(
'
samplesheet
'
,
'
samples.
t
sv
'
))
SAMPLES
=
list
(
samples_dic
.
keys
())
SAMPLES
=
list
(
samples_dic
.
keys
())
TOOLS
=
[
TOOLS
=
[
...
@@ -117,6 +122,7 @@ rule filter_rafah:
...
@@ -117,6 +122,7 @@ rule filter_rafah:
shell
:
shell
:
"
tail -n+2 {input.seq_info} | cut -f1,6,7 | sort -k1
"
"
tail -n+2 {input.seq_info} | cut -f1,6,7 | sort -k1
"
"
> {output.rafah_tsv}
"
"
> {output.rafah_tsv}
"
# VirHostMatcher-Net
# VirHostMatcher-Net
rule
run_vhmnet
:
rule
run_vhmnet
:
input
:
input
:
...
@@ -158,7 +164,6 @@ rule filter_vhmnet:
...
@@ -158,7 +164,6 @@ rule filter_vhmnet:
"""
"""
for f in $(find -wholename
"
{params.predictions_dir}/*.csv
"
-type f);
for f in $(find -wholename
"
{params.predictions_dir}/*.csv
"
-type f);
do
do
echo ${{f}};
contig_id=$(basename ${{f}} | sed -e
'
s/_prediction.csv//
'
)
contig_id=$(basename ${{f}} | sed -e
'
s/_prediction.csv//
'
)
host_score=$(tail -n1 ${{f}} | cut -f8,10 -d
'
,
'
| tr
'
,
'
'
\t
'
)
host_score=$(tail -n1 ${{f}} | cut -f8,10 -d
'
,
'
| tr
'
,
'
'
\t
'
)
echo -e
"
$contig_id
\t
$host_score
"
>> {output.vhmnet_tsv}.tmp;
echo -e
"
$contig_id
\t
$host_score
"
>> {output.vhmnet_tsv}.tmp;
...
...
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