Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
bird_pipeline_registry
microSysMics
Commits
fb4de32c
Commit
fb4de32c
authored
Feb 16, 2021
by
Erwan DELAGE
Browse files
Correct bugs in export diversity
parent
d36aa5c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/export_diversity.py
View file @
fb4de32c
...
...
@@ -10,7 +10,7 @@ import sys
import
shutil
# The input directory is the output of the Qiime2 diversity analysis
INDIR
=
sys
.
argv
[
1
]
INDIR
=
sys
.
argv
[
1
]
if
sys
.
argv
[
1
].
endswith
(
"/"
)
else
sys
.
argv
[
1
]
+
"/"
OUTDIR
=
INDIR
+
"/tables/"
##################
...
...
@@ -26,7 +26,7 @@ for beta_diversity_metric in beta_diversity_metrics:
artifact
.
export_data
(
OUTDIR
+
beta_diversity_metric
.
split
(
"_distance_matrix"
)[
0
])
# Move files to the output directory
for
sub_dir
in
os
.
listdir
(
OUTDIR
):
for
sub_dir
in
[
sub_dir
for
sub_dir
in
os
.
listdir
(
OUTDIR
)
if
os
.
path
.
isdir
(
sub_dir
)]
:
os
.
rename
(
OUTDIR
+
sub_dir
+
"/distance-matrix.tsv"
,
OUTDIR
+
sub_dir
+
".tsv"
)
os
.
rmdir
(
OUTDIR
+
sub_dir
)
...
...
@@ -68,4 +68,4 @@ artifact.export_data(OUTDIR)
os
.
rename
(
OUTDIR
+
"feature-table.biom"
,
OUTDIR
+
"rarefied_table.biom"
)
# Convert BIOM to TSV
os
.
system
(
"biom convert -i "
+
OUTDIR
+
"rarefied_table.biom -o "
+
OUTDIR
+
"rarefied_table.tsv --to-tsv"
)
os
.
system
(
"biom convert -i "
+
OUTDIR
+
"rarefied_table.biom -o "
+
OUTDIR
+
"rarefied_table.tsv --to-tsv"
)
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