<p>I am learning about vcf file formatting and have a multi-sample (&gt;300) vcf file and aim to <strong>group</strong> (take) <strong>samples with shared mutations</strong>.</p>
<p>Can someone suggest a tool/command/script solve this problem?</p>

CC BY-SA 4.0
2019-01-17T04:45:31.610Z
FYI: Cross posted on biostars (https://www.biostars.org/p/358896/)
finswimmer
CC BY-SA 4.0
2019-01-17T04:52:37.787Z
@finswimmer Cross posting on biostars is alright.
SmallChess
CC BY-SA 4.0
2019-01-17T04:57:10.820Z
@SmallChess I'm not against cross posting, but one should mention it, where they ask the question as well. Doing this every one can see if there is already a solution.
finswimmer
CC BY-SA 4.0
2019-01-17T05:19:10.907Z
As I asked I am learning and asked for help :)
user3698773
CC BY-SA 4.0
2020-07-16T16:53:47.440Z
@finswimmer posted this response on Biostars `$ bcftools query -i 'GT="0/1"' -f '%CHROM\t%POS\t0/1\t%REF\t%ALT\t[%SAMPLE,]\n' input.vcf|sed 's/,$//'|awk -v OFS="\t" '{counts = split($6, samples, ","); print $1, $2, $3, counts, $4, $5, $6}' > stats_01.csv`
M__
CC BY-SA 4.0
2020-07-17T12:23:54.210Z
I think the question needs to be much more specific for that answer to be useful for anyone else. What does 'shared mutation mean'? What does 'group' them mean? I think a small sample of the input and desired output is needed.
user438383
<r><shell>
group samples based on shared mutations in a single multi samples vcf file
# group samples based on shared mutations in a single multi samples vcf file

(Asked by: username_0 on 2019-01-17)

I am learning about vcf file formatting and have a multi-sample (>300) vcf file and aim to **group** (take) **samples with shared mutations**.

Can someone suggest a tool/command/script solve this problem?

**Tags:** r, shell
> **Comments:**
> **username_1**: FYI: Cross posted on biostars (https://www.biostars.org/p/358896/)  
> **username_2**: @finswimmer Cross posting on biostars is alright.  
> **username_1**: @SmallChess I'm not against cross posting, but one should mention it, where they ask the question as well. Doing this every one can see if there is already a solution.  
> **username_0**: As I asked I am learning and asked for help :)  
> **username_3**: @finswimmer posted this response on Biostars `$ bcftools query -i 'GT="0/1"' -f '%CHROM\t%POS\t0/1\t%REF\t%ALT\t[%SAMPLE,]\n' input.vcf|sed 's/,$//'|awk -v OFS="\t" '{counts = split($6, samples, ","); print $1, $2, $3, counts, $4, $5, $6}' > stats_01.csv`  
> **username_4**: I think the question needs to be much more specific for that answer to be useful for anyone else. What does 'shared mutation mean'? What does 'group' them mean? I think a small sample of the input and desired output is needed.  

---

## 0 answers

