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

ExpansionHunter extract sex from a ped file. #281

Merged
merged 14 commits into from
Jan 11, 2022

Conversation

VJalili
Copy link
Member

@VJalili VJalili commented Jan 10, 2022

EH processes male and female samples differently; this PR adds a functionality where sample sex is extracted from a provided PED file.

@VJalili VJalili requested a review from mwalker174 January 10, 2022 21:11
wdl/ExpansionHunter.wdl Outdated Show resolved Hide resolved
sex=""
if [ ! -z "~{ped_filename}" -a "~{ped_filename}" != " " ]; then
if [ -e "~{ped_filename}" ]; then
sex=$(awk -F '\t' '{if ($2 == "~{individual_id}") {if ($5 == "1") {print "--sex male"; exit 0} else if ($5 == "2") {print "--sex female"; exit 0} else {exit 1}}}' < ~{ped_filename} )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually try to emit a helpful error message if the sex is undefined. I think it would be best to define sex="NA" if the ped file is provided. Then use print "NA"; exit 0 instead of exit 1 in the last if clause. Then check the value of sex below - if it's NA then warn that either the sample id was not found or the sex is undefined and fail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if the updated condition would be equally good.

wdl/ExpansionHunter.wdl Outdated Show resolved Hide resolved
wdl/ExpansionHunterScatter.wdl Outdated Show resolved Hide resolved
wdl/ExpansionHunter.wdl Outdated Show resolved Hide resolved
wdl/ExpansionHunter.wdl Outdated Show resolved Hide resolved
wdl/ExpansionHunterScatter.wdl Outdated Show resolved Hide resolved
Copy link
Collaborator

@mwalker174 mwalker174 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One minor suggestion.

wdl/ExpansionHunter.wdl Outdated Show resolved Hide resolved
wdl/ExpansionHunterScatter.wdl Outdated Show resolved Hide resolved
@VJalili VJalili merged commit 479d2ac into broadinstitute:master Jan 11, 2022
@VJalili VJalili deleted the eh_gender branch January 11, 2022 17:17
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

Successfully merging this pull request may close these issues.

2 participants