scripts/support/fasta2rfamseq_old.py
def main(project_dir, upid_list, upid_gca_tax_file):
    """
    Main function that does some input parsing and calls
    generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table

    project_dir: The path to a project directory where the genomes are initially
    downloaded
    upid_list: A file containing a list of upids for which to generate the .rfamseq
    files
    upid_gca_tax_file: A json file generated from the latest proteomes-all.tsv
    Uniprot file

    return:
    """
    fp = open(upid_gca_tax_file, 'r')
    upid_gca_tax_dict = json.load(fp)
    fp.close()

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

    for upid in upids:
        subdir = os.path.join(project_dir, upid[-3:])
        updir = os.path.join(subdir, upid)
        upfasta = os.path.join(updir, upid+'.fa')

        # do some sanity checks
        if os.path.exists(upfasta):
            # defining the source of the sequences according to assembly accession
            source = "UNIPROT; ENA"
            if upid in upid_gca_tax_dict:
                if upid_gca_tax_dict[upid]["GCA"] != -1:
                    if upid_gca_tax_dict[upid]["GCA"][0:3] == "GCF":
                        source = "NIH; NCBI"
                    else:
                        source = "UNIPROT; ENA"
            else:
                print "%s not found in the dictionary" % upid
                continue

            generate_rfamseq_metadata_from_fasta(upfasta, upid_gca_tax_dict[upid]["TAX"],
                                    source, filename=None, to_file=True)

    Main function that does some input parsing and calls
    generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table

    project_dir: The path to a project directory where the genomes are initially
    downloaded
    upid_list: A file containing a list of upids for which to generate the .rfamseq
    files
    upid_gca_tax_file: A json file generated from the latest proteomes-all.tsv
    Uniprot file

    return:
    
Main function that does some input parsing and calls
generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table

The path to a project directory where the genomes are initially
downloaded
upid_list: A file containing a list of upids for which to generate the .rfamseq
files
upid_gca_tax_file: A json file generated from the latest proteomes-all.tsv
Uniprot file


Main function that does some input parsing and calls generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table The path to a project directory where the genomes are initially downloaded upid_list : A file containing a list of upids for which to generate the . rfamseq files upid_gca_tax_file : A json file generated from the latest proteomes - all . tsv Uniprot file
def main(project_dir, upid_list, upid_gca_tax_file):
    fp = open(upid_gca_tax_file, 'r')
    upid_gca_tax_dict = json.load(fp)
    fp.close()
    fp = open(upid_list, 'r')
    upids = [x.strip() for x in fp]
    fp.close()
    for upid in upids:
        subdir = os.path.join(project_dir, upid[-3:])
        updir = os.path.join(subdir, upid)
        upfasta = os.path.join(updir, upid+'.fa')
        if os.path.exists(upfasta):
            source = "UNIPROT; ENA"
            if upid in upid_gca_tax_dict:
                if upid_gca_tax_dict[upid]["GCA"] != -1:
                    if upid_gca_tax_dict[upid]["GCA"][0:3] == "GCF":
                        source = "NIH; NCBI"
                    else:
                        source = "UNIPROT; ENA"
            else:
                print "%s not found in the dictionary" % upid
                continue
            generate_rfamseq_metadata_from_fasta(upfasta, upid_gca_tax_dict[upid]["TAX"],
                                    source, filename=None, to_file=True)
def main ( project_dir , upid_list , upid_gca_tax_file ) : fp = open ( upid_gca_tax_file , 'r' ) upid_gca_tax_dict = json . load ( fp ) fp . close ( ) fp = open ( upid_list , 'r' ) upids = [ x . strip ( ) for x in fp ] fp . close ( ) for upid in upids : subdir = os . path . join ( project_dir , upid [ - 3 : ] ) updir = os . path . join ( subdir , upid ) upfasta = os . path . join ( updir , upid + '.fa' ) if os . path . exists ( upfasta ) : source = "UNIPROT; ENA" if upid in upid_gca_tax_dict : if upid_gca_tax_dict [ upid ] [ "GCA" ] != - 1 : if upid_gca_tax_dict [ upid ] [ "GCA" ] [ 0 : 3 ] == "GCF" : source = "NIH; NCBI" else : source = "UNIPROT; ENA" else : print "%s not found in the dictionary" % upid continue generate_rfamseq_metadata_from_fasta ( upfasta , upid_gca_tax_dict [ upid ] [ "TAX" ] , source , filename = None , to_file = True )
Main function that does some input parsing and calls
generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table
Main function that does some input parsing and calls generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table
"""
    Main function that does some input parsing and calls
    generate_rfamseq_metadata_from_fasta to generate new entries for rfamseq table

    project_dir: The path to a project directory where the genomes are initially
    downloaded
    upid_list: A file containing a list of upids for which to generate the .rfamseq
    files
    upid_gca_tax_file: A json file generated from the latest proteomes-all.tsv
    Uniprot file

    return:
    """ # do some sanity checks # defining the source of the sequences according to assembly accession
project_dir
upid_list
upid_gca_tax_file