diff --git a/webapp/client/src/pipelines/MetaT/Workflow/Results/Metatranscriptome.js b/webapp/client/src/pipelines/MetaT/Workflow/Results/Metatranscriptome.js index ad9ce9f8..2d6a1850 100644 --- a/webapp/client/src/pipelines/MetaT/Workflow/Results/Metatranscriptome.js +++ b/webapp/client/src/pipelines/MetaT/Workflow/Results/Metatranscriptome.js @@ -17,7 +17,7 @@ function Metatranscriptome(props) { } {props.result['readMapping-features'] && - + } ); diff --git a/webapp/client/src/pipelines/MetaT/Workflow/Results/ReadMapping.js b/webapp/client/src/pipelines/MetaT/Workflow/Results/ReadMapping.js index 439bf9b4..7d847bf0 100644 --- a/webapp/client/src/pipelines/MetaT/Workflow/Results/ReadMapping.js +++ b/webapp/client/src/pipelines/MetaT/Workflow/Results/ReadMapping.js @@ -35,6 +35,10 @@ function ReadMapping(props) {

[ Export the result as TSV ]



+ Top 100 features +

+ +

: <> diff --git a/webapp/server/util/workflow.js b/webapp/server/util/workflow.js index b2d11b1d..0fab12a0 100644 --- a/webapp/server/util/workflow.js +++ b/webapp/server/util/workflow.js @@ -189,26 +189,18 @@ const generateWorkflowResult = function (proj) { } else if (workflowConf.workflow.name === 'Metatranscriptome') { const dirs = fs.readdirSync(outdir); dirs.forEach(function (dir) { - if (dir === 'qa') { - const files = fs.readdirSync(outdir + "/qa"); + if (dir === 'qa' || dir === 'readsQC') { + const files = fs.readdirSync(outdir + "/" + dir); files.forEach(function (file) { if (file.endsWith("_stats.json")) { - result['readsQC-stats'] = JSON.parse(fs.readFileSync(outdir + "/qa/" + file)); - } - }); - } - if (dir === 'readsQC') { - const files = fs.readdirSync(outdir + "/readsQC"); - files.forEach(function (file) { - if (file.endsWith("_stats.json")) { - result['readsQC-stats'] = JSON.parse(fs.readFileSync(outdir + "/readsQC/" + file)); + result['readsQC-stats'] = JSON.parse(fs.readFileSync(outdir + "/" + dir + "/" + file)); } }); } else if (dir === 'assembly') { const files = fs.readdirSync(outdir + "/assembly"); files.forEach(function (file) { - if (file.endsWith("_stats.json")) { + if (file.endsWith("stats.json")) { result['assembly-stats'] = JSON.parse(fs.readFileSync(outdir + "/assembly/" + file)); } }); @@ -221,32 +213,27 @@ const generateWorkflowResult = function (proj) { } }); } - else if (dir === 'metat_output') { - const files = fs.readdirSync(outdir + "/metat_output"); + else if (dir === 'metat_output' || dir === 'readMapping') { + const files = fs.readdirSync(outdir + "/" + dir); files.forEach(function (file) { - if (file.endsWith("_sorted_features.tsv")) { - var rows = parseInt(execSync("wc -l < " + outdir + "/metat_output/" + file).toString().trim()); - if (rows > config.IO.MAX_DATATABLE_ROWS) { - result['readMapping-features-too-large'] = true; - result['readMapping-features'] = "output/Metatranscriptomics/metat_output/" + file; - } else { - result['readMapping-features-too-large'] = false; - result['readMapping-features'] = Papa.parse(fs.readFileSync(outdir + "/metat_output/" + file).toString(), { delimiter: '\t', header: true, skipEmptyLines: true }).data; + if (file.endsWith("sorted_features.tsv")) { + const jsonFile = file.replace('.tsv', '.json'); + let topFeatures = "top100_features.json"; + if (!fs.existsSync(outdir + "/" + dir + "/" + topFeatures)) { + topFeatures = file.replace('_sorted_features.tsv', '_top100_features.json'); } - } - }); - } - else if (dir === 'readMapping') { - const files = fs.readdirSync(outdir + "/readMapping"); - files.forEach(function (file) { - if (file.endsWith("_sorted_features.tsv")) { - var rows = parseInt(execSync("wc -l < " + outdir + "/readMapping/" + file).toString().trim()); + var rows = parseInt(execSync("wc -l < " + outdir + "/" + dir + "/" + file).toString().trim()); if (rows > config.IO.MAX_DATATABLE_ROWS) { result['readMapping-features-too-large'] = true; - result['readMapping-features'] = "output/Metatranscriptomics/readMapping/" + file; + result['readMapping-features'] = "output/Metatranscriptomics/" + dir + "/" + file; + result['readMapping-top_features'] = JSON.parse(fs.readFileSync(outdir + "/" + dir + "/" + topFeatures)); } else { result['readMapping-features-too-large'] = false; - result['readMapping-features'] = Papa.parse(fs.readFileSync(outdir + "/readMapping/" + file).toString(), { delimiter: '\t', header: true, skipEmptyLines: true }).data; + if (fs.existsSync(outdir + "/" + dir + "/" + jsonFile)) { + result['readMapping-features'] = JSON.parse(fs.readFileSync(outdir + "/" + dir + "/" + jsonFile)); + } else { + result['readMapping-features'] = Papa.parse(fs.readFileSync(outdir + "/" + dir + "/" + file).toString(), { delimiter: '\t', header: true, skipEmptyLines: true }).data; + } } } });