Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make polishing stats machine-readable #148

Open
kim-fehl opened this issue May 6, 2022 · 0 comments
Open

Make polishing stats machine-readable #148

kim-fehl opened this issue May 6, 2022 · 0 comments

Comments

@kim-fehl
Copy link

kim-fehl commented May 6, 2022

I polish several similar assemblies and would like to easily aggregate stats for their polishing. As for now, there are human-readable stats in a well-described log file, however, its parsing is complicated. Is it possible to produce machine-readable tsv or json file (which could be parsed by a future version of MultiQC...)

Here is the code I use now for the perfect case when each assembly has the only contig (in a Snakemake's shell flavor):

(
    printf "SampleID\tPercConfirmedBases\tCoverage\tCorrectedSNPs\tCorrectedAmbiguousBases"
    printf "\tCorrectedSmallInsertions\tCorrectedSmallDeletions\tFixedLocalBreaks\tFixedGaps\n"
    paste  <( echo {SAMPLES_STR} | tr ' ' '\n' ) \
           <( parallel -k "grep -oP 'Confirmed.*\(\K([0-9.]+)' {{}}" ::: {input} ) \
           <( parallel -k "grep -oP 'Mean total coverage: \K([0-9.]+)' {{}} | sed 's/$/x/g'" ::: {input} ) \
           <( parallel -k "grep -oP '([0-9]+)(?= snps)' {{}}" ::: {input} ) \
           <( parallel -k "grep -oP '([0-9]+)(?= ambiguous bases)' {{}}" ::: {input} ) \
           <( parallel -k "grep -oP '([0-9]+)(?= small insertions)' {{}}" ::: {input} ) \
           <( parallel -k "grep -oP '([0-9]+)(?= small deletions)' {{}}" ::: {input} ) \
           <( parallel -k "grep '^fix break' {{}} | wc -l" ::: {input} ) \
           <( parallel -k "grep '^fix gap' {{}} | wc -l" ::: {input} )
) > {output}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant