Example #1
0
def main():
    print('##############################################################')
    print(
        'This script must be in a directory with the folder called "Alignment" and the fastas you want to concatenate.'
    )
    print('The fastas must have the extension ".fasta" or it wont work.')
    print(
        'The output files are the concatenated seqs as a fasta and as a phylip for raxml-ing and a logfile.'
    )
    print(
        'The log file tells the length of the added sequence and the order in which they are added, so you can figure out your breakpoints. '
    )
    print('##############################################################')

    path2alignments = (input("path to the purged alignments: ")).strip() + "/"
    outfile = open('concat_alignment.fasta', 'w')
    newAlignment = Alignment('')
    #	newAlignment = ''

    for f in os.listdir(path2alignments):
        #		if re.search('.fas',f):
        if f.endswith('.fas'):
            tempAlignment = concat(newAlignment, path2alignments + f, 'LG')
            newAlignment = tempAlignment

    newAlignment.write('concat')
    time.sleep(20)
    makephy('concat_alignment.fasta')