import argparse
import os

parser = argparse.ArgumentParser()
parser.add_argument("-n","--name", help="name file")
parser.add_argument("-s","--min-cluster-size", type=int, help="cluster size cutoff")
args = parser.parse_args()

name = args.name.strip()
assert len(name) > 0
accnos = os.path.basename(name).rsplit(".name",1)[0]+".accnos"
with open(name,"r") as inp, open(accnos,"w") as out:
    for line in inp:
        line = line.strip()
        if line:
            rep, clust = line.split("\t")
            clust = [ y for y in ( x.strip() for x in clust.split(",") ) if y ]
            if len(clust) < args.min_cluster_size:
                ## add all sequences in the cluster to be sure
                ## clust shold include rep already but just in case
                out.write("\n".join(list(set(clust)|set([rep])))+"\n")



c7687282c3377eca19bce902ecf5d3e2a0a3fb03
<mask token>

<mask token>
parser.add_argument('-n', '--name', help='name file')
parser.add_argument('-s', '--min-cluster-size', type=int, help=
    'cluster size cutoff')
<mask token>
assert len(name) > 0
<mask token>
with open(name, 'r') as inp, open(accnos, 'w') as out:
    for line in inp:
        line = line.strip()
        if line:
            rep, clust = line.split('\t')
            clust = [y for y in (x.strip() for x in clust.split(',')) if y]
            if len(clust) < args.min_cluster_size:
                out.write('\n'.join(list(set(clust) | set([rep]))) + '\n')

<mask token>
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--name', help='name file')
parser.add_argument('-s', '--min-cluster-size', type=int, help=
    'cluster size cutoff')
args = parser.parse_args()
name = args.name.strip()
assert len(name) > 0
accnos = os.path.basename(name).rsplit('.name', 1)[0] + '.accnos'
with open(name, 'r') as inp, open(accnos, 'w') as out:
    for line in inp:
        line = line.strip()
        if line:
            rep, clust = line.split('\t')
            clust = [y for y in (x.strip() for x in clust.split(',')) if y]
            if len(clust) < args.min_cluster_size:
                out.write('\n'.join(list(set(clust) | set([rep]))) + '\n')

import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--name', help='name file')
parser.add_argument('-s', '--min-cluster-size', type=int, help=
    'cluster size cutoff')
args = parser.parse_args()
name = args.name.strip()
assert len(name) > 0
accnos = os.path.basename(name).rsplit('.name', 1)[0] + '.accnos'
with open(name, 'r') as inp, open(accnos, 'w') as out:
    for line in inp:
        line = line.strip()
        if line:
            rep, clust = line.split('\t')
            clust = [y for y in (x.strip() for x in clust.split(',')) if y]
            if len(clust) < args.min_cluster_size:
                out.write('\n'.join(list(set(clust) | set([rep]))) + '\n')

import argparse
import os

parser = argparse.ArgumentParser()
parser.add_argument("-n","--name", help="name file")
parser.add_argument("-s","--min-cluster-size", type=int, help="cluster size cutoff")
args = parser.parse_args()

name = args.name.strip()
assert len(name) > 0
accnos = os.path.basename(name).rsplit(".name",1)[0]+".accnos"
with open(name,"r") as inp, open(accnos,"w") as out:
    for line in inp:
        line = line.strip()
        if line:
            rep, clust = line.split("\t")
            clust = [ y for y in ( x.strip() for x in clust.split(",") ) if y ]
            if len(clust) < args.min_cluster_size:
                ## add all sequences in the cluster to be sure
                ## clust shold include rep already but just in case
                out.write("\n".join(list(set(clust)|set([rep])))+"\n")


