Investigating frequency of multiple SNPs within a txt file
2
0
Entering edit mode
7.2 years ago
reza.jabal ▴ 530

Here I've got a text file containing a list of SNPs called at a particular locus from a set of ~1000 .var files. I'd like to investigate the frequency of each SNP within the file, but have zero knowledge of shell programming or python. I was wondering if someone can help me with this!

SNP Python Shell • 1.2k views
ADD COMMENT
2
Entering edit mode

Short answer? Get a bioinformatician near you to help you out and observe them, especially the questions they ask. When you're just starting, you're better off with in-person help.

ADD REPLY
0
Entering edit mode

Ram,

Thank you for your reply. I'm just seeking a shell script (or sth similar in python) that I can mess with it to get the job done!

Sth to start with!

ADD REPLY
0
Entering edit mode

I appreciate that - that is a good approach. This will take some time, but I can help you with this. I'll add the rest of my reply to an answer and update it as you progress.

ADD REPLY
1
Entering edit mode
7.2 years ago
Ram 36k

First off, I personally prefer shell scripts unless the situation gets complicated. File IO is super easy when you're working on the shell. Can you show me what a .var file looks like? I am not sure which tools generate .var files and I do not wish to assume anything. Just give me the output to this:

head -n 25 <sample.var>

where <sample.var> is any random .var file.

ADD COMMENT
0
Entering edit mode

This is where I got so far:

awk '{print $(my target column)}' var.txt | uniq -c

This lists all the variants and their respective frequency per line, but I want their overall frequency.

ADD REPLY
0
Entering edit mode
7.2 years ago
reza.jabal ▴ 530

Ended up with this:

awk -F '\t' '{print$18}' output.txt|sort|uniq -c|sort -nr

Thank you for the moral support Ram and suggesting the shell script

ADD COMMENT
0
Entering edit mode

Glad it helped and you got it working. Enjoy the world of shell scripting!

ADD REPLY

Login before adding your answer.

Traffic: 1519 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6