Skip to content

Commit

Permalink
Update PosgreSQL urls.
Browse files Browse the repository at this point in the history
  • Loading branch information
tayaza committed Feb 17, 2022
1 parent 1a1d8eb commit 1b8f3ad
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
5 changes: 4 additions & 1 deletion codes3d/codes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,17 @@ def map_non_spatial_eqtls(
'pval', 'b', 'b_se',
'snp_chrom', 'snp_locus', 'maf',
'gene_chrom', 'gene_start', 'gene_end']
eqtl_df = eqtl_df[cols].drop_duplicates()
eqtl_df = eqtl_df[cols].dropna().drop_duplicates()
eqtl_project = tissues['project'].iloc[0]
if not args.no_afc:
afc_start_time = time.time()
eqtl_df['sid'] = eqtl_df['variant_id']
eqtl_df['sid_chr'] = eqtl_df['snp_chrom']
eqtl_df['sid_pos'] = eqtl_df['snp_locus']
eqtl_df['pid'] = eqtl_df['gencode_id']
fp = os.path.join(args.output_dir, 'eqtls.txt')
eqtl_df.to_csv(fp, sep='\t', index=False)
print(eqtl_df)
eqtl_df = calc_afc(
eqtl_df,
genotypes_fp,
Expand Down
23 changes: 11 additions & 12 deletions data_preparation/digest_genome.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def build_fragment_index(fragment_fp, output_db):
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description=(
'Digest a genome with a restriction enzyme. ',
'Creates a BED file where the fourth column denotes the restriction',
' fragment number of the fragment specified'))
"""Digest a genome with a restriction enzyme, and create
a BED file where the fourth column denotes the restriction
fragment number of the fragment specified"""))
parser.add_argument(
"-g", "--genome",
help="Genome in genbank or fasta format.")
Expand All @@ -117,21 +117,20 @@ def build_fragment_index(fragment_fp, output_db):
help="Is the genome linear? (default: False)")
parser.add_argument(
"-e", "--enzyme", nargs='+',
help=("The restriction enzyme with which to fragment the genome, ",
"for example, `-e MspI`"))
help="""The restriction enzyme with which to digest the fragment
for example, `-e MspI`""")
parser.add_argument(
"-o", "--output_dir",
help=("Output directory for fragment BED and database files. ",
"(default: the directory of input genome.)"))
help="""Output directory for fragment BED and database
(default: the directory of input genome.""")
parser.add_argument(
"-b", "--do_not_index", action="store_true",
help=("Suppress building of fragment index from resultant ",
"fragmented genome."))
help="""Suppress building of fragment index from the fragmented genome.""")
parser.add_argument(
"-d", "--output_db",
help=("Output file path for fragment BED file and database ",
"(default: the name of the input file, with the extension ",
"\".db\"/\".bed\", respectively.)"))
help="""Output file path for fragment BED file and database
(default: the name of the input file, with the extension,
"\".db\"/\".bed\", respectively.)""")
parser.add_argument(
"-z", "--list_enzymes",
help="List the available enzymes for digestion.", action="store_true")
Expand Down
4 changes: 2 additions & 2 deletions data_preparation/init_eqtl_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
Create PostgreSQL table of list of eQTL projects.
Requires a meta_eqtls.txt
"""
eqtl_fp = os.path.join(os.path.dirname(__file__), '../lib/meta_eqtls.txt')
eqtl_fp = os.path.join(os.path.dirname(__file__), '../lib/meta_info/meta_eqtls.txt')
eqtls = pd.read_csv(eqtl_fp, sep='\t')
db = create_engine(
'postgres://codes3d:[email protected]/codes3d_commons', echo=False)
'postgresql://codes3d:[email protected]/codes3d_commons', echo=False)
eqtls.to_sql('meta_eqtls', con=db, if_exists='replace', index=False)
16 changes: 8 additions & 8 deletions data_preparation/init_gene_variant_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@ def build_gene_table(
parser = argparse.ArgumentParser(
description='Build database tables gene and variant fragments')
parser.add_argument(
'-v', '--variants',
"-v", "--variants",
help='The filepath to the variant lookup file')
parser.add_argument(
'-g', '--genes',
help=('The filepath to a sorted gene reference file containing ',
'id, chrom, start, end, name, and gencode_id columns.',
'Note that the id indicates the sorting (chrom, start) ',
'order of the file starting at 1.'))
"-g", "--genes",
help="""The filepath to a sorted gene reference file containing
id, chrom, start, end, name, and gencode_id columns.
Note that the id indicates the sorting (chrom, start)
order of the file starting at 1.""")
parser.add_argument(
"-t", "--table",
help='Name of table e.g. variant_lookup_mboi.')
help="Name of table e.g. variant_lookup_mboi.")
parser.add_argument(
"-u", "--db-url", required=True,
help='URL of database e.g posgresql://user:password@hostname/database')
help="URL of database e.g posgresql://user:password@hostname/database")
parser.add_argument(
"-c", "--config",
default=os.path.join(os.path.dirname(__file__),
Expand Down
2 changes: 1 addition & 1 deletion data_preparation/init_hic_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
).drop_duplicates()

db = create_engine(
'postgres://codes3d:[email protected]/codes3d_commons', echo=False)
'postgresql://codes3d:[email protected]/codes3d_commons', echo=False)
libraries.drop_duplicates().to_sql('meta_hic', con=db, if_exists='replace')
2 changes: 0 additions & 2 deletions docs/.env.codes3d

This file was deleted.

6 changes: 3 additions & 3 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ dependencies:
- numpy=1.19.1
- pandas=1.0.5
- pandas-plink #=2.0.4
- psycopg2 #=2.8.5
- psycopg2 =2.8.5
- pybedtools #=0.8.1
- requests #=2.24.0
- scikits-bootstrap #=1.0.1
- SQLAlchemy #=1.3.18
- SQLAlchemy-Utils #=0.36.8
- SQLAlchemy =1.3.18
- SQLAlchemy-Utils =0.36.8
- statsmodels #=0.11.1
- pytorch #=1.9.0
- tqdm #=4.48.0
Expand Down

0 comments on commit 1b8f3ad

Please sign in to comment.