This is a test version of Biostars. For the public version, visit https://www.biostars.org.
I want to print only those lines which contain non repetitive amino acid sequences

I have a file containing amino acid sequences, i.e.

AAPW
DAPA
ATPG
KLIP

I want to print only those lines which contains non-repetitive amino acids as:

ATPG
KLIP

Since, AAPW and DAPA contain alanine twice so that not printed. While ATPG and KLIP printed as these lines contains non repetitive amino acids. There are 20 different types of amino acids, given as one letter code; A C D E F G H I K L M N P Q R S T V W Y

linux python awk sed

The title is misleading, as there is nothing repetitive in DAPA. You basically want the lines that have 4 unique letters. That should give you some hint as to how to solve the problem. But you need to show some effort. What you laid out so far sounds like you ordered a free meal and now you expect someone to serve it to you.

I solved this in ~4 lines of python, and 2 of those were just reading the file.

Here's a massive hint:

if len(set(line)) == len(line):
    print(line)

0 answers

No answers yet.

Log in to answer this question.