1
$\begingroup$

This is my first time on stackexchange.

I am new to bioinformatics, and I have some new SNP data from an Affymetrix Axiom array. I have the genotypes exported into a giant tab-delimited table txt file where each row is a sample, starting with the rsID and each column being a sample.

Due to a quirk of the Axiom Human Origins array, there are ~4000 SNPs that were genotyped twice for each sample. The Affymetrix genotyping console for whatever reason does not merge the genotypes for these probes, meaning these genotypes show up twice in my data. Furthermore, the array designers fear these SNPs may actually be triallelic, which means I probably don't want to have to deal with them even more (ftp://ftp.cephb.fr/hgdp_supp10/8_12_2011_Technical_Array_Design_Document.pdf).

I have this big table of genotyping data. Can someone show me a template Python (or maybe Perl) script I can used to filter out the ~8000 lines that contain one of the offending rsids? I have a basic grip of these languages, but I don't know how to do this stuff on my own. Thanks!

$\endgroup$

closed as off-topic by terdon, AliceD, jonsca, Chris, WYSIWYG May 30 '15 at 10:38

  • This question does not appear to be about biology within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ This is not really about biology but about parsing a text file. I'm voting to close as off topic here but, assuming you're using a Linux or Unix machine (which you should be doing, if you're working in bioinformatics), you can ask on Unix & Linux instead. Just make sure to include an example of your input file and your desired output. The solution is probably as simple as grep -vFf ids.txt affy.txt > newfile where ids.txt is the list of SNPs you want to ignore and affy.txt is your data. For more details, please ask on the Unix site. $\endgroup$ – terdon May 29 '15 at 21:43
  • 4
    $\begingroup$ I'm voting to close this question as off-topic because it is about parsing a text file and not about biology. $\endgroup$ – terdon May 29 '15 at 21:43
  • $\begingroup$ this needs to be on stack overflow, actually your question might be closed off as a duplicate or as too specific there, there are already many such problems which have been answered on stack. You're asking a very specific question. You should on the other hand ask something very broad like how can I filter duplicates from a file using a single column...P.S I'd use awk...:P $\endgroup$ – FoldedChromatin May 30 '15 at 14:09
  • $\begingroup$ Seems a question for SO- but there you will have to explain in more detail what you want to accomplish with a minimum reproducible example. Here, doing the same would be helpful. For example, how does the offending row looks like? Is there any particular pattern that allows you to detect it by eye? Add a minimum example that gives the community something to work with. $\endgroup$ – ddiez May 30 '15 at 14:28
0
$\begingroup$

No one is going to write a script for you. If you show that you tried, post your script, say exactly what it's doing wrong, you might get some help. Programming is about breaking problems into sub-problems. First, you need to make a list of the rsIDs you want to purge. Do you have that? You could use a script, you could also do a one-liner in Unix, something like

cut -f 1 myfile.txt | sort | uniq -c | sort -nr > rsIDcounts.txt

That will cut the first column's data out of the file, sort all those elements, then uniq -c will compress duplicate entries into one entry, and every entry will have a number saying how often that entry appeared. The last sort puts the names in order of abundance, so the duplicates will be at the top.

$\endgroup$
  • $\begingroup$ Oops I mistook this site with stackoverflow. Anyways, I found a solution elsewhere. Thanks for your time to everyone who responded. $\endgroup$ – MolecularAnthropologist May 31 '15 at 22:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.