scripts/release/rfamseq_generator.py
def merge_files_from_accession_list(project_dir, acc_list_file, dest_dir, file_type, filename='rfamseq'):
    """
    Simple script to merge all genomes to a single rfamseq file

    project_dir: The path to a genome download project directory
    dest_dir: The directory where to create the new rfamseq file
    filename: A filename for the rfamseq file. Defaults to rfamseq

    return: Void
    """
    
    if file_type.lower() == 'fasta':
	file_type = 'fa'
    elif file_type.lower() == 'tblout':
	file_type = 'tbl'

    err_cases_fp = os.path.join(dest_dir, filename+'_err_cases.txt')

    rfamseq_fp = open(os.path.join(dest_dir, filename + "." + file_type), 'w')

    #subdirs = [x for x in os.listdir(project_dir)
    #           if os.path.isdir(os.path.join(project_dir, x))]

    fp_in = open(acc_list_file, 'r')
    upids = [x.strip() for x in fp_in]
    fp_in.close()

    #for subdir in subdirs:
    #    subdir_loc = os.path.join(project_dir, subdir)
    #    updirs = os.listdir(subdir_loc)

    for upid in upids:
	suffix = upid[-3:]
	subdir_loc = os.path.join(project_dir, suffix)
	
	if os.path.exists(subdir_loc):
		updir_loc = os.path.join(subdir_loc, upid)

		if os.path.exists(updir_loc):
			up_fasta = os.path.join(updir_loc, upid + "." + file_type)

            		if os.path.exists(up_fasta):
                		fasta_fp = open(up_fasta, 'r')
                		for seq_line in fasta_fp:
                    		#if seq_line[0] == '>':
                    			rfamseq_fp.write(seq_line)
                    		#else:
                    		#    if seq_validator(seq_line):
                    		#        rfamseq_fp.write(seq_line)
                    		#    else:
                    		#        print upid + '\t' + seq_line

                		fasta_fp.close()
    rfamseq_fp.close()

    Simple script to merge all genomes to a single rfamseq file

    project_dir: The path to a genome download project directory
    dest_dir: The directory where to create the new rfamseq file
    filename: A filename for the rfamseq file. Defaults to rfamseq

    return: Void
    
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file. Defaults to rfamseq

Void
Simple script to merge all genomes to a single rfamseq file project_dir : The path to a genome download project directory dest_dir : The directory where to create the new rfamseq file filename : A filename for the rfamseq file . Defaults to rfamseq Void
def merge_files_from_accession_list(project_dir, acc_list_file, dest_dir, file_type, filename='rfamseq'):
    if file_type.lower() == 'fasta':
	file_type = 'fa'
    elif file_type.lower() == 'tblout':
	file_type = 'tbl'
    err_cases_fp = os.path.join(dest_dir, filename+'_err_cases.txt')
    rfamseq_fp = open(os.path.join(dest_dir, filename + "." + file_type), 'w')
    fp_in = open(acc_list_file, 'r')
    upids = [x.strip() for x in fp_in]
    fp_in.close()
    for upid in upids:
	suffix = upid[-3:]
	subdir_loc = os.path.join(project_dir, suffix)
	if os.path.exists(subdir_loc):
		updir_loc = os.path.join(subdir_loc, upid)
		if os.path.exists(updir_loc):
			up_fasta = os.path.join(updir_loc, upid + "." + file_type)
            		if os.path.exists(up_fasta):
                		fasta_fp = open(up_fasta, 'r')
                		for seq_line in fasta_fp:
                    			rfamseq_fp.write(seq_line)
                		fasta_fp.close()
    rfamseq_fp.close()
def merge_files_from_accession_list ( project_dir , acc_list_file , dest_dir , file_type , filename = 'rfamseq' ) : if file_type . lower ( ) == 'fasta' : file_type = 'fa' elif file_type . lower ( ) == 'tblout' : file_type = 'tbl' err_cases_fp = os . path . join ( dest_dir , filename + '_err_cases.txt' ) rfamseq_fp = open ( os . path . join ( dest_dir , filename + "." + file_type ) , 'w' ) fp_in = open ( acc_list_file , 'r' ) upids = [ x . strip ( ) for x in fp_in ] fp_in . close ( ) for upid in upids : suffix = upid [ - 3 : ] subdir_loc = os . path . join ( project_dir , suffix ) if os . path . exists ( subdir_loc ) : updir_loc = os . path . join ( subdir_loc , upid ) if os . path . exists ( updir_loc ) : up_fasta = os . path . join ( updir_loc , upid + "." + file_type ) if os . path . exists ( up_fasta ) : fasta_fp = open ( up_fasta , 'r' ) for seq_line in fasta_fp : rfamseq_fp . write ( seq_line ) fasta_fp . close ( ) rfamseq_fp . close ( )
Simple script to merge all genomes to a single rfamseq file
project_dir: The path to a genome download project directory
dest_dir: The directory where to create the new rfamseq file
filename: A filename for the rfamseq file.
Simple script to merge all genomes to a single rfamseq file project_dir : The path to a genome download project directory dest_dir : The directory where to create the new rfamseq file filename : A filename for the rfamseq file .
"""
    Simple script to merge all genomes to a single rfamseq file

    project_dir: The path to a genome download project directory
    dest_dir: The directory where to create the new rfamseq file
    filename: A filename for the rfamseq file. Defaults to rfamseq

    return: Void
    """ #subdirs = [x for x in os.listdir(project_dir) #           if os.path.isdir(os.path.join(project_dir, x))] #for subdir in subdirs: #    subdir_loc = os.path.join(project_dir, subdir) #    updirs = os.listdir(subdir_loc) #if seq_line[0] == '>': #else: #    if seq_validator(seq_line): #        rfamseq_fp.write(seq_line) #    else: #        print upid + '\t' + seq_line
project_dir
acc_list_file
dest_dir
file_type
filename