Пример #1
0
def load_individuals_into_database():
    """launch the various scripts to insert data into the HGDP database."""
    
    from schema.connection import session, metadata
    from schema.connection import Individual, Population, SNP, RefSeqGene
#    session.flush()
    print "now we are connected to the database:", metadata
    metadata.bind.echo = True
    
    samples_file = file('../../data/Annotations/samples_subset.csv', 'r')
    
    session.flush()
    
    parsers.samples_parser(samples_file)
    session.commit()
    print 'upload of tables finished'
def update_individuals(genotypesfile, ):
    """
    upload individuals from the rosenberg files.
    """
    from schema.connection import session, metadata # is session necessary?
    logging.basicConfig(level=logging.DEBUG)
    print metadata
#    metadata.bind = 'sqlite:///:memory:'
    metadata.bind.echo = True
    
    parsers.individuals_genotypesindex_parser(open(genotypesfile, 'r'))
    session.commit()

#    rosenberg_file = open(rosenberg_path, 'r')
#    parsers.rosenberg_parser(rosenberg_file)

    print 'fixed individuals.genotypes_index to database %s completed' % metadata
Пример #3
0
def upload_genotypes(genotypes_by_chr_dir, ):
    """
    upload individuals from the rosenberg files.
    """
    from schema.connection import session, metadata # is session necessary?
    logging.basicConfig(level=logging.DEBUG)
    print metadata
#    metadata.bind = 'sqlite:///:memory:'
    metadata.bind.echo = True
    
    genotypes_by_chr_dir = '/home/gioby/Data/HGDP/Genotypes_by_chr'
    for filename in glob.glob(genotypes_by_chr_dir + '/*.geno'):
        print filename
        parsers.genotypes_parser(open(filename, 'r'))
        session.commit()

#    rosenberg_file = open(rosenberg_path, 'r')
#    parsers.rosenberg_parser(rosenberg_file)

    print 'upload of Genotypes to database %s completed' % metadata