scripts/preprocessing/relabel_seed.py
def write_fasta_seed_file(sequence_collection, filename="sequences", dest_dir=None):
    """
    Writes a fasta file in destination directory based on a
    dictionary of sequence_accession : sequence pairs to be
    used to generate a fasta file

    sequence_collection: A python dictionary with the candidate
    sequences
    filename: A string specifying the sequence file name
    dest_dir: Destination directory where to generate output

    return: Returns fasta file if it exists, None otherwise
    """

    if dest_dir is None:
        sys.exit("\nNo destination directory was provided for fasta generation!\n")

    fasta_file = os.path.join(dest_dir, filename + '.fa')

    fasta_fp = open(fasta_file, 'w')

    for seq_acc in sequence_collection.keys():
        start = 1
        end = len(sequence_collection[seq_acc])
        # write fasta header
        fasta_fp.write(">%s\n" % (seq_acc + '/' + str(start) + '-' + str(end)))
        # write sequence
        fasta_fp.write("%s\n" % sequence_collection[seq_acc])

    fasta_fp.close()

    if os.path.exists(fasta_file):
        return fasta_file

    return None

    Writes a fasta file in destination directory based on a
    dictionary of sequence_accession : sequence pairs to be
    used to generate a fasta file

    sequence_collection: A python dictionary with the candidate
    sequences
    filename: A string specifying the sequence file name
    dest_dir: Destination directory where to generate output

    return: Returns fasta file if it exists, None otherwise
    
Writes a fasta file in destination directory based on a
dictionary of sequence_accession : sequence pairs to be
used to generate a fasta file

A python dictionary with the candidate
sequences
filename: A string specifying the sequence file name
dest_dir: Destination directory where to generate output

Returns fasta file if it exists, None otherwise
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file A python dictionary with the candidate sequences filename : A string specifying the sequence file name dest_dir : Destination directory where to generate output Returns fasta file if it exists None otherwise
def write_fasta_seed_file(sequence_collection, filename="sequences", dest_dir=None):
    if dest_dir is None:
        sys.exit("\nNo destination directory was provided for fasta generation!\n")
    fasta_file = os.path.join(dest_dir, filename + '.fa')
    fasta_fp = open(fasta_file, 'w')
    for seq_acc in sequence_collection.keys():
        start = 1
        end = len(sequence_collection[seq_acc])
        fasta_fp.write(">%s\n" % (seq_acc + '/' + str(start) + '-' + str(end)))
        fasta_fp.write("%s\n" % sequence_collection[seq_acc])
    fasta_fp.close()
    if os.path.exists(fasta_file):
        return fasta_file
    return None
def write_fasta_seed_file ( sequence_collection , filename = "sequences" , dest_dir = None ) : if dest_dir is None : sys . exit ( "\nNo destination directory was provided for fasta generation!\n" ) fasta_file = os . path . join ( dest_dir , filename + '.fa' ) fasta_fp = open ( fasta_file , 'w' ) for seq_acc in sequence_collection . keys ( ) : start = 1 end = len ( sequence_collection [ seq_acc ] ) fasta_fp . write ( ">%s\n" % ( seq_acc + '/' + str ( start ) + '-' + str ( end ) ) ) fasta_fp . write ( "%s\n" % sequence_collection [ seq_acc ] ) fasta_fp . close ( ) if os . path . exists ( fasta_file ) : return fasta_file return None
Writes a fasta file in destination directory based on a
dictionary of sequence_accession : sequence pairs to be
used to generate a fasta file
Writes a fasta file in destination directory based on a dictionary of sequence_accession : sequence pairs to be used to generate a fasta file
"""
    Writes a fasta file in destination directory based on a
    dictionary of sequence_accession : sequence pairs to be
    used to generate a fasta file

    sequence_collection: A python dictionary with the candidate
    sequences
    filename: A string specifying the sequence file name
    dest_dir: Destination directory where to generate output

    return: Returns fasta file if it exists, None otherwise
    """ # write fasta header # write sequence
sequence_collection
filename
dest_dir