NBISweden / aMeta

Ancient microbiome snakemake workflow
MIT License
19 stars 14 forks source link

RScript fails with one sample #108

Closed cb-scott closed 1 year ago

cb-scott commented 1 year ago

Hi all, I've since fixed this by including a second sample, but as an FYI the Rscript "malt_abundance_matrix.R" fails when running the aMeta pipeline with only one sample:

Error in rule Malt_AbundanceMatrix_Sam:
    jobid: 11
    input: results/MALT_QUANTIFY_ABUNDANCE/S30455/sam_counts.txt
    output: results/MALT_ABUNDANCE_MATRIX_SAM, results/MALT_ABUNDANCE_MATRIX_SAM/malt_abundance_matrix_sam.txt
    log: logs/MALT_ABUNDANCE_MATRIX_SAM/MALT_ABUNDANCE_MATRIX_SAM.log (check log file(s) for error message)
    conda-env: /scratch/06909/cbscott/aMeta/.snakemake/conda/7ce3141b3314e1a9f5b4e35c7326cac1_
    shell:
        Rscript /scratch/06909/cbscott/aMeta/workflow/scripts/malt_abundance_matrix.R results/MALT_QUANTIFY_ABUNDANCE results/MALT_ABUNDANCE_MATRIX_SAM &> logs/MALT_ABUNDANCE_MATRIX_SAM/MALT_ABUNDANCE_MATRIX_SAM.log
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Log error message:

Error in colnames<-(*tmp*, value = "S30455") : attempt to set 'colnames' on an object with less than two dimensions Execution halted

Specifically, in the Rscript: `merged<-Reduce(cbind,df)

colnames(merged)<-gsub(".sam_counts","",files)`

will return a vector rather than a data frame and produce the error.

LeandroRitter commented 1 year ago

Many thanks for reporting @cb-scott! The issue is fixed now!