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

When checking the accessioning QC we do not need to count star * allele #229

Merged
merged 6 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions eva_submission/nextflow/accession_and_load.nf
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,27 @@ process accession_vcf {


"""
(java -Xmx${task.memory.toGiga()-1}G -jar $params.jar.accession_pipeline --spring.config.location=file:$params.accession_job_props $pipeline_parameters) || \
(java -Xmx${task.memory.toGiga()-1}G -jar $params.jar.accession_pipeline --spring.config.location=file:$params.accession_job_props $pipeline_parameters) || java_exit_code=\$?
# need this line to ensure we do not get unbound variable when the java process is successful
if [ \${java_exit_code:-"Not set"} == "Not set" ]; then java_exit_code=0; fi
# If accessioning fails due to missing variants, but the only missing variants are structural variants,
# then we should treat this as a success from the perspective of the automation.
# TODO revert once accessioning pipeline properly registers structural variants
# First grep finds the "Structural variant" reported by the accessioning process, remove the duplicates and count
# Second grep count the reported number of missing variants in the Accessioning report
[[ \$(grep 'Skipped processing structural variant' ${params.logs_dir}/${log_filename}.log | cut -d ' ' -f 10- | sort -u| wc -l) \
== \$(grep -oP '\\d+(?= unaccessioned variants need to be checked)' ${params.logs_dir}/${log_filename}.log) ]]

grep -oP '\\d+(?= unaccessioned variants need to be checked)' ${params.logs_dir}/${log_filename}.log || grep_exit_code=\$?
if [ \${grep_exit_code:-"Not set"} == "Not set" ]; then grep_exit_code=0; fi

# First grep finds the "Structural variant" reported by the accessioning process, remove the duplicates, remove the * alleles and count
SV_IN_ACCESSION=\$(grep 'Skipped processing structural variant' ${params.logs_dir}/${log_filename}.log | grep -v "alternate='*'" | cut -d ' ' -f 10- | sort -u | wc -l)
# Second grep count the number of missing variants in the Accessioning report after removing the * alleles
SV_IN_QC_REPORT=\$(grep ' variants that were not found in the accession report' ${params.logs_dir}/${log_filename}.log | sed 's/, AbstractVariant/\\n AbstractVariant/g' | grep -v "alternate='*'" | wc -l)

echo "java_exit_code \$java_exit_code"
echo "grep_exit_code \$grep_exit_code"
echo "SV_IN_ACCESSION \$SV_IN_ACCESSION"
echo "SV_IN_QC_REPORT \$SV_IN_QC_REPORT"
# If the java is successful OR QC reports missing variants (only valid reason for failure) and QC has the same number of skipped variant as the accession
[[ \$java_exit_code == 0 ]] || ([[ \$grep_exit_code == 0 ]] && [[ \$SV_IN_ACCESSION == \$SV_IN_QC_REPORT ]])
echo "done" > ${accessioned_filename}.tmp
"""
}
Expand Down
Loading