Skip to content

Commit

Permalink
Merge pull request #36 from stevenweaver/master
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
stevenweaver authored Dec 11, 2017
2 parents 81c4227 + a31649b commit 8dc3328
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ Use a phylogenetic test of conditional independence on each triangle in the
network to remove spurious _transitive_ connections which make
A->B->C chains look like A-B-C triangles.

| Option | Description |
| --------- | -------------- |
| remove | reports supurious _transitive_ connections |
| report | removes supurious _transitive_ connections |


## -s --strip_drams

Masks known DRAMs (Drug Resistance-Associated Mutation) positions from provided sequences.
Expand All @@ -136,6 +142,9 @@ Masks known DRAMs (Drug Resistance-Associated Mutation) positions from provided
Compare uploaded sequences to all public sequences.
Retrieved periodically from the [Los Alamos HIV Sequence Database](http://hiv.lanl.gov)

## -o --output
Specify output filename. If no output filename is provided, then the output filename will be <input_filename>.results.json


# Viewing JSON files
You can either use the command `hivtrace_viz <path_to_json_file>` or visit `https://veg.github.io/hivtrace-viz/` and click Load File.
Expand Down
45 changes: 34 additions & 11 deletions hivtrace/hivtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,25 +272,39 @@ def hivtrace(id, input, reference, ambiguities, threshold, min_overlap,
results_json = {}

# Declare reference file
resource_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rsrc')
resource_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rsrc')


#These should be defined in the user's environment
# These should be defined in the user's environment
env_dir = os.path.dirname(sys.executable)
PYTHON=sys.executable
BEALIGN=os.path.join(env_dir, 'bealign')
BAM2MSA=os.path.join(env_dir, 'bam2msa')
TN93DIST='tn93'
HIVNETWORKCSV=os.path.join(env_dir, 'hivnetworkcsv')
PYTHON = sys.executable

# Try python's system executable first, then the user's path.

if(os.path.isfile(os.path.join(env_dir, 'bealign'))):
BEALIGN = os.path.join(env_dir, 'bealign')
else:
BEALIGN = 'bealign'

if(os.path.isfile(os.path.join(env_dir, 'bam2msa'))):
BAM2MSA = os.path.join(env_dir, 'bam2msa')
else:
BAM2MSA = 'bam2msa'

if(os.path.isfile(os.path.join(env_dir, 'hivnetworkcsv'))):
HIVNETWORKCSV = os.path.join(env_dir, 'hivnetworkcsv')
else:
HIVNETWORKCSV = 'hivnetworkcsv'

TN93DIST = 'tn93'

# This will have to be another parameter
LANL_FASTA = os.path.join(resource_dir, 'LANL.FASTA')
LANL_TN93OUTPUT_CSV = os.path.join(resource_dir, 'LANL.TN93OUTPUT.csv')
DEFAULT_DELIMITER='|'
DEFAULT_DELIMITER = '|'

# Check if LANL files exists. If not, then check if zip file exists,
# otherwise throw error
try :
try:
if not os.path.isfile(LANL_FASTA):
lanl_zip = os.path.join(resource_dir, 'LANL.FASTA.gz')
gunzip_file(lanl_zip, LANL_FASTA)
Expand Down Expand Up @@ -622,6 +636,7 @@ def main():
parser.add_argument('--skip-alignment', help='Skip alignment', action='store_true')
parser.add_argument('--attributes-file', help='Annotate with attributes')
parser.add_argument('--log', help='Write logs to specified directory')
parser.add_argument('-o', '--output', help='Specify output filename')


args = parser.parse_args()
Expand All @@ -634,6 +649,7 @@ def main():
logging.basicConfig (filename = log_fn, level=logging.DEBUG)

FN=args.input
OUTPUT_FN = args.input + '.results.json'
ID=os.path.basename(FN)
REFERENCE = args.reference
AMBIGUITY_HANDLING=args.ambiguities.lower()
Expand All @@ -644,11 +660,18 @@ def main():
STRIP_DRAMS = args.strip_drams
ATTRIBUTES_FILE = args.attributes_file

if args.output:
OUTPUT_FN = args.output


if STRIP_DRAMS != 'wheeler' and STRIP_DRAMS != 'lewis':
STRIP_DRAMS = False

results = hivtrace(ID, FN, REFERENCE, AMBIGUITY_HANDLING, DISTANCE_THRESHOLD, MIN_OVERLAP, COMPARE_TO_LANL, FRACTION, strip_drams_flag =STRIP_DRAMS, filter_edges = args.filter, handle_contaminants = args.curate, skip_alignment=args.skip_alignment, attributes_file=ATTRIBUTES_FILE)
print(json.dumps(results))

# Write to output filename if specified
with open(OUTPUT_FN, 'w') as outfile:
json.dump(results, outfile)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setup_package():

setup(
name='hivtrace',
version='0.3.4',
version='0.4.0',
description='HIV-TRACE',
author='Joel Wertheim, Sergei Pond, and Steven Weaver',
author_email='sweaver@temple.edu',
Expand Down

0 comments on commit 8dc3328

Please sign in to comment.