Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch srst2 versions 0.1.6 and 0.2.0 #6957

Merged
merged 15 commits into from
Dec 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions recipes/srst2/0.1.4.6/build.sh

This file was deleted.

4 changes: 4 additions & 0 deletions recipes/srst2/0.1.6/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

$PYTHON setup.py install --single-version-externally-managed --record=record.txt

Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package:
name: srst2
version: 0.1.4.6
version: 0.1.6

source:
fn: v0.1.6.tar.gz
url: https://github.com/katholt/srst2/archive/v0.1.6.tar.gz
sha256: 24cbd03933d4cc14bbfa7f8a073c9b0caafb13d55afb3bfa25f8b093fc5bc615
patches:
- use_setuptools.patch
- srst_sample_name_v0.1.6.patch

build:
number: 1
number: 0
skip: True #[not py27 or osx]

requirements:
Expand All @@ -29,8 +30,8 @@ requirements:

test:
commands:
- srst2 -h 2>&1 | grep 'SRST2 - Short Read Sequence Typer' > /dev/null
- getmlst.py -h 2>&1 | grep 'usage' > /dev/null
- srst2 -h 2>&1 | grep "SRST2 - Short Read Sequence Typer" > /dev/null
- getmlst.py -h 2>&1 | grep "usage" > /dev/null

about:
home: https://github.com/katholt/srst2
Expand Down
63 changes: 63 additions & 0 deletions recipes/srst2/0.1.6/srst_sample_name_v0.1.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/scripts/srst2.py b/scripts/srst2.py
index 67e48ae..916792e 100755
--- a/scripts/srst2.py
+++ b/scripts/srst2.py
@@ -233,7 +233,7 @@ def parse_fai(fai_file,db_type,delimiter):
return size, gene_clusters, unique_gene_symbols, unique_allele_symbols, gene_cluster_symbols


-def read_pileup_data(pileup_file, size, prob_err, consensus_file = ""):
+def read_pileup_data(pileup_file, size, prob_err, sample_name, consensus_file = ""):
with open(pileup_file) as pileup:
prob_success = 1 - prob_err # Set by user, default is prob_err = 0.01
hash_alignment = {}
@@ -372,7 +372,7 @@ def read_pileup_data(pileup_file, size, prob_err, consensus_file = ""):
elif consensus_file.split(".")[-2] == "all_consensus_alleles":
consensus_type = "consensus"
with open(consensus_file, "a") as consensus_outfile:
- consensus_outfile.write(">{0}.{1} {2}\n".format(allele, consensus_type, pileup_file.split(".")[1].split("__")[1]))
+ consensus_outfile.write(">{0}.{1} {2}\n".format(allele, consensus_type, sample_name))
outstring = consensus_seq + "\n"
consensus_outfile.write(outstring)

@@ -782,7 +782,7 @@ def create_allele_pileup(allele_name, all_pileup_file):
def parse_scores(run_type,args,scores, hash_edge_depth,
avg_depth_allele, coverage_allele, mismatch_allele, indel_allele,
missing_allele, size_allele, next_to_del_depth_allele,
- unique_cluster_symbols,unique_allele_symbols, pileup_file):
+ unique_cluster_symbols,unique_allele_symbols, pileup_file, sample_name):

# sort into hash for each gene locus
scores_by_gene = collections.defaultdict(dict) # key1 = gene, key2 = allele, value = score
@@ -868,11 +868,11 @@ def parse_scores(run_type,args,scores, hash_edge_depth,
if args.report_new_consensus or args.report_all_consensus:
new_alleles_filename = args.output + ".new_consensus_alleles.fasta"
allele_pileup_file = create_allele_pileup(results[gene][0], pileup_file)
- read_pileup_data(allele_pileup_file, size_allele, args.prob_err, consensus_file = new_alleles_filename)
+ read_pileup_data(allele_pileup_file, size_allele, args.prob_err, sample_name, consensus_file = new_alleles_filename)
if args.report_all_consensus:
new_alleles_filename = args.output + ".all_consensus_alleles.fasta"
allele_pileup_file = create_allele_pileup(results[gene][0], pileup_file)
- read_pileup_data(allele_pileup_file, size_allele, args.prob_err, consensus_file = new_alleles_filename)
+ read_pileup_data(allele_pileup_file, size_allele, args.prob_err, sample_name, consensus_file = new_alleles_filename)

return results # (allele, diffs, depth_problem, divergence)

@@ -1265,7 +1265,7 @@ def map_fileSet_to_db(args,sample_name,fastq_inputs,db_name,fasta,size,gene_name
logging.info(' Processing SAMtools pileup...')
hash_alignment, hash_max_depth, hash_edge_depth, avg_depth_allele, coverage_allele, \
mismatch_allele, indel_allele, missing_allele, size_allele, next_to_del_depth_allele= \
- read_pileup_data(pileup_file, size, args.prob_err)
+ read_pileup_data(pileup_file, size, args.prob_err, sample_name)

# Generate scores for all alleles (prints these and associated info if verbose)
# result = dict, with key=allele, value=score
@@ -1283,7 +1283,7 @@ def map_fileSet_to_db(args,sample_name,fastq_inputs,db_name,fasta,size,gene_name
allele_scores = parse_scores(run_type, args, scores, \
hash_edge_depth, avg_depth_allele, coverage_allele, mismatch_allele, \
indel_allele, missing_allele, size_allele, next_to_del_depth_allele,
- unique_gene_symbols, unique_allele_symbols, pileup_file)
+ unique_gene_symbols, unique_allele_symbols, pileup_file, sample_name)

# REPORT/RECORD RESULTS

2 changes: 1 addition & 1 deletion recipes/srst2/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

python setup.py install
$PYTHON setup.py install --single-version-externally-managed --record=record.txt
7 changes: 4 additions & 3 deletions recipes/srst2/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ source:
sha256: 352c59bdf00039dfa5610a4b88049a0eb114d7c2a305d4924b6e605cc6d15123
patches:
- use_setuptools.patch
- srst_sample_name_v0.2.0.patch

build:
number: 1
number: 2
skip: True #[not py27]

requirements:
Expand All @@ -29,8 +30,8 @@ requirements:

test:
commands:
- srst2 -h 2>&1 | grep 'SRST2 - Short Read Sequence Typer' > /dev/null
- getmlst.py -h 2>&1 | grep 'usage' > /dev/null
- srst2 -h 2>&1 | grep "SRST2 - Short Read Sequence Typer" > /dev/null
- getmlst.py -h 2>&1 | grep "usage" > /dev/null

about:
home: https://github.com/katholt/srst2
Expand Down
74 changes: 74 additions & 0 deletions recipes/srst2/srst_sample_name_v0.2.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
From d9d617a67e432cabd768bac0cb06462aa8c87ec5 Mon Sep 17 00:00:00 2001
From: Eric Enns <[email protected]>
Date: Tue, 28 Nov 2017 11:12:31 -0600
Subject: [PATCH] Remove sample name parsing which doesn't work when
directories have . in the name, instead just pass sample_name along to
functions requiring it.

---
scripts/srst2.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/srst2.py b/scripts/srst2.py
index ac174ef..5c753e1 100755
--- a/scripts/srst2.py
+++ b/scripts/srst2.py
@@ -311,7 +311,7 @@ def parse_fai(fai_file,db_type,delimiter):
return size, gene_clusters, unique_gene_symbols, unique_allele_symbols, gene_cluster_symbols


-def read_pileup_data(pileup_file, size, prob_err, consensus_file = ""):
+def read_pileup_data(pileup_file, size, prob_err, sample_name, consensus_file = ""):
with open(pileup_file) as pileup:
prob_success = 1 - prob_err # Set by user, default is prob_err = 0.01
hash_alignment = {}
@@ -450,7 +450,7 @@ def read_pileup_data(pileup_file, size, prob_err, consensus_file = ""):
elif consensus_file.split(".")[-2] == "all_consensus_alleles":
consensus_type = "consensus"
with open(consensus_file, "a") as consensus_outfile:
- consensus_outfile.write(">{0}.{1} {2}\n".format(allele, consensus_type, pileup_file.split(".")[1].split("__")[1]))
+ consensus_outfile.write(">{0}.{1} {2}\n".format(allele, consensus_type, sample_name))
outstring = consensus_seq + "\n"
consensus_outfile.write(outstring)

@@ -942,7 +942,7 @@ def dict_of_dicts_inverted_ind(dd):
def parse_scores(run_type,args,scores, hash_edge_depth,
avg_depth_allele, coverage_allele, mismatch_allele, indel_allele,
missing_allele, size_allele, next_to_del_depth_allele,
- unique_cluster_symbols,unique_allele_symbols, pileup_file):
+ unique_cluster_symbols,unique_allele_symbols, pileup_file, sample_name):

# sort into hash for each gene locus
scores_by_gene = group_allele_dict_by_gene(dict( (allele,val) for (allele,val) in scores.items() \
@@ -1018,11 +1018,11 @@ def parse_scores(run_type,args,scores, hash_edge_depth,
if args.report_new_consensus or args.report_all_consensus:
new_alleles_filename = args.output + ".new_consensus_alleles.fasta"
allele_pileup_file = create_allele_pileup(results[gene][0], pileup_file)
- read_pileup_data(allele_pileup_file, size_allele, args.prob_err, consensus_file = new_alleles_filename)
+ read_pileup_data(allele_pileup_file, size_allele, args.prob_err, sample_name, consensus_file = new_alleles_filename)
if args.report_all_consensus:
new_alleles_filename = args.output + ".all_consensus_alleles.fasta"
allele_pileup_file = create_allele_pileup(results[gene][0], pileup_file)
- read_pileup_data(allele_pileup_file, size_allele, args.prob_err, consensus_file = new_alleles_filename)
+ read_pileup_data(allele_pileup_file, size_allele, args.prob_err, sample_name, consensus_file = new_alleles_filename)

return results # (allele, diffs, depth_problem, divergence)

@@ -1419,7 +1419,7 @@ def map_fileSet_to_db(args, sample_name, fastq_inputs, db_name, fasta, size, gen
logging.info(' Processing SAMtools pileup...')
hash_alignment, hash_max_depth, hash_edge_depth, avg_depth_allele, coverage_allele, \
mismatch_allele, indel_allele, missing_allele, size_allele, next_to_del_depth_allele= \
- read_pileup_data(pileup_file, size, args.prob_err)
+ read_pileup_data(pileup_file, size, args.prob_err, sample_name)

# Generate scores for all alleles (prints these and associated info if verbose)
# result = dict, with key=allele, value=score
@@ -1437,7 +1437,7 @@ def map_fileSet_to_db(args, sample_name, fastq_inputs, db_name, fasta, size, gen
allele_scores = parse_scores(run_type, args, scores, \
hash_edge_depth, avg_depth_allele, coverage_allele, mismatch_allele, \
indel_allele, missing_allele, size_allele, next_to_del_depth_allele,
- unique_gene_symbols, unique_allele_symbols, pileup_file)
+ unique_gene_symbols, unique_allele_symbols, pileup_file, sample_name)

# REPORT/RECORD RESULTS