Example #1
0
PARSER = argparse.ArgumentParser(description='Finds target sequences from a\
           target (-t) fasta file in a source fasta file (-s)')
PARSER.add_argument('-t', type=str, help='target fastafile', required=True)
PARSER.add_argument('-s', type=str, help='source fastafile', required=True)
PARSER.add_argument('-l',
                    type=str,
                    help='the length of the extracted seq',
                    default=150)
ARGS = PARSER.parse_args()
FA_S = FastaList(ARGS.s)
FA_T = FastaList(ARGS.t)
FA_CS = FastaList('aivcs.fa')
aivcs = []
for seq in FA_CS.seq_list:
    aivcs.append(seq.split('\n')[1].strip())
ALL_S = FA_S.seq_list + FA_S.rev_comp()
FA_OUT = open('sources.fa', 'w')
count = len(FA_T.seq_list) // 100
percent = 0
incr1 = 0
incr2 = 0
seq_found = 0
for fasta_t in FA_T.seq_list:
    incr1 += 1
    if incr1 > incr2:
        incr2 += count
        print('Calculating, %d %% completed' % min(percent, 100),
              end='\r',
              flush=True)
        percent += 1
    fasta_t_seq = fasta_t.split('\n')[1]
Example #2
0
#!/usr/bin/python3
"""Something"""


import argparse
from fasta import FastaList

PARSER = argparse.ArgumentParser(description='Reverse complement a DNA strand')
PARSER.add_argument('-s', type=str, help='oligonucleotide', required=True)
ARGS = PARSER.parse_args()
STRAND = FastaList(ARGS.s)
print(STRAND.rev_comp(STRAND.seq_list))