Commit fb4de32c authored by Erwan DELAGE's avatar Erwan DELAGE
Browse files

Correct bugs in export diversity

parent d36aa5c5
......@@ -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")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment