Skip to content

Commit

Permalink
Version 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
bvilhjal committed Mar 15, 2019
1 parent 41bbee0 commit ffcf2c8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
51 changes: 33 additions & 18 deletions LDpred.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,46 @@
from ldpred import LDpred_inf
from ldpred import LD_pruning_thres
from ldpred import validate
from ldpred import reporting

import sys
import textwrap

__version__ = '1.0.4'
__version__ = '1.0.5'
__date__ = '15 March 2019'


parser = argparse.ArgumentParser(prog='LDpred',
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent("""\
\033[96mLDpred v. 1.0.2\033[0m
--------------------------------------------------------------------------------------
Thank you for using\033[1m LDpred\033[0m!
title = '\033[96mLDpred v. %s\033[0m'%__version__
title_len= len(title)-9
num_dashes = reporting.window_length-title_len-2
left_dashes = '='*int(num_dashes/2)
right_dashes = '='*int(num_dashes/2+num_dashes%2)
title_string = '\n'+left_dashes + ' '+title+' '+right_dashes +'\n'
description_string = """
Typicial workflow:
1. Use\033[1m LDpred coord\033[0m to parse summary statistics and genotypes and coordinate data.
See LDpred coord --help for further usage description and options.
1. Use\033[1m LDpred coord\033[0m to parse summary statistics and genotypes
and coordinate data. See LDpred coord --help for further usage
description and options.
2. Use\033[1m LDpred gibbs|inf|p+t\033[0m to obtain SNP weights for polygenic scoring using one or
more methods. See LDpred gibbs|inf|p+t --help for further usage description and options.
2. Use\033[1m LDpred gibbs|inf|p+t\033[0m to obtain SNP weights for polygenic
scoring using one or more methods. See LDpred gibbs|inf|p+t --help for
further usage description and options.
3. Use\033[1m LDpred score\033[0m to calculate polygenic scores using SNP weights from previous
step. See LDpred score --help for further usage description and options.
3. Use\033[1m LDpred score\033[0m to calculate polygenic scores using SNP
weights from previous step. See LDpred score --help for further usage
description and options.
2019 (c) Bjarni J Vilhjalmsson: [email protected]
"""))
Thank you for using\033[1m LDpred\033[0m!
%s
(c) Bjarni J Vilhjalmsson: [email protected]
"""%(__date__)
description_string += '='*reporting.window_length

parser = argparse.ArgumentParser(prog='LDpred',
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent(description_string))


subparsers = parser.add_subparsers(help='Select ldpred action among the following options: ', dest='ldpred_action')
parser_coord = subparsers.add_parser('coord', help='Parse and coordinate summary statistics and genotypes.')
Expand Down Expand Up @@ -246,8 +261,8 @@


def main():
print(title_string)
if len(sys.argv)==1:
print ('ERROR: No options provided.\n')
parser.print_help(sys.stderr)
sys.exit(1)
parameters = parser.parse_args()
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ LDpred is a Python based software package that adjusts GWAS summary statistics
for the effects of linkage disequilibrium (LD). The details of the method is
described in Vilhjalmsson et al. (AJHG 2015) [http://www.cell.com/ajhg/abstract/S0002-9297(15)00365-1]

* The current version is 1.0.4
* The current version is 1.0.5

## Getting Started ##
### News ###

Mar 14th, 2019: Version 1.0.4 released and is available on pip using
Mar 15th, 2019: Version 1.0.5 released and is available on pip using

`pip install ldpred`

Expand Down
19 changes: 11 additions & 8 deletions ldpred/reporting.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
"""
Bunch of functions for beautifying output.
"""
window_length = 80
name_length = 50

def print_summary(summary_dict, title, log_file=None):
print('')
title_len= len(title)
num_dashes = 80-title_len-2
num_dashes = window_length-title_len-2
left_dashes = '='*int(num_dashes/2)
right_dashes = '='*int(num_dashes/2+num_dashes%2)
val_length=window_length-name_length

print( left_dashes + ' '+title+' '+right_dashes)
for k in sorted(summary_dict.keys()):
sd = summary_dict[k]
if sd['name']=='dash':
if 'value' not in sd:
print ('-' * 80)
print ('-' * window_length)
else:
val_str= str(sd['value'])
str_len= len(val_str)
num_dashes = 80-str_len-2
num_dashes = window_length-str_len-2
left_dashes = '-'*int(num_dashes/2)
right_dashes = '-'*int(num_dashes/2+num_dashes%2)
print( left_dashes + ' '+val_str+' '+right_dashes)
else:
val_str= str(sd['value'])
if len(val_str)>29:
print ('{:<50}'.format(sd['name']))
print ('{:>80}'.format(val_str))
if len(val_str)>val_length-1:
print (('{:<%d}'%name_length).format(sd['name']))
print (('{:>%d}'%window_length).format(val_str))
else:
print ('{:<50}{:>30}'.format(sd['name'],str(sd['value'])))
print ('=' * 80)
print (('{:<%d}{:>%d}'%(name_length,val_length)).format(sd['name'],str(sd['value'])))
print ('=' * window_length)
print('')

0 comments on commit ffcf2c8

Please sign in to comment.