Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Genomics/cset.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
34 lines (26 sloc)
584 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L=[] | |
S=[] | |
with open("rosalind_cset.txt","rU") as f: | |
for line in f: | |
S.append(line.strip()) | |
L.append(int(line.strip(),2)) | |
l=len(S[0]) | |
def flip(x): | |
return (~x)+(1<<(l)) | |
def check(x,y): | |
if x&flip(y)!=0 and x&y!=0 and flip(x)&y!=0 and flip(x)&flip(y)!=0: | |
return False | |
else: | |
return True | |
jsave=0 | |
for i,x in enumerate(L): | |
j=0 | |
for k,y in enumerate(L): | |
if not check(x,y): | |
j+=1 | |
if j>jsave: | |
bad=i | |
jsave=j | |
for i,x in enumerate(S): | |
if i!=bad: | |
print x | |