Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
snayfach committed Nov 2, 2016
1 parent 51e31ef commit 87d1025
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Install python dependencies as needed:
[read more...] (install.md)

Download & unpack reference database:
[http://lighthouse.ucsf.edu/MIDAS/midas_db_v1.1.tar.gz](http://lighthouse.ucsf.edu/MIDAS/midas_db_v1.1.tar.gz)
`tar -zxvf midas_db_v1.1.tar.gz`
[http://lighthouse.ucsf.edu/MIDAS/midas_db_v1.2.tar.gz](http://lighthouse.ucsf.edu/MIDAS/midas_db_v1.2.tar.gz)
`tar -zxvf midas_db_v1.2.tar.gz`
[read more...] (ref_db.md)

Update your environment:
`export PYTHONPATH=$PYTHONPATH:MIDAS`
`export PATH=$PATH:MIDAS/scripts`
`export MIDAS_DB=midas_db_v1.1`
`export MIDAS_DB=midas_db_v1.2`

Optionally, download & unpack example dataset:
[http://lighthouse.ucsf.edu/MIDAS/example.tar.gz](http://lighthouse.ucsf.edu/MIDAS/example.tar.gz)
Expand Down
2 changes: 2 additions & 0 deletions midas/analyze/track_strains.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def call_markers(species, samples, args):
# open marker list
markers = utility.parse_file(species.paths['markers'])
marker = fetch_marker(markers) # dictionary for 1st marker allele
if marker is None:
sys.exit("\nError: no marker alleles found in file: %s\n" % species.paths['markers'])

# init markers per sample
for sample in samples.values():
Expand Down
7 changes: 4 additions & 3 deletions midas/run/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ def count_mapped_bp(args, species, genes):
continue
else:
gene_id = aln_file.getrname(aln.reference_id)
aln_len = len(aln.query_alignment_sequence)
gene_len = genes[gene_id].length
genes[gene_id].reads += 1
genes[gene_id].bases += len(aln.query_alignment_sequence)
genes[gene_id].depth += genes[gene_id].bases/float(genes[gene_id].length)
genes[gene_id].bases += aln_len
genes[gene_id].depth += aln_len/float(gene_len)
j += 1
print(" total aligned reads: %s" % i)
print(" total mapped reads: %s" % j)
Expand All @@ -193,7 +195,6 @@ def normalize(args, species, genes):
# compute marker depth
for gene in genes.values():
if gene.marker_id is not None:
gene.depth = gene.depth
species[gene.species_id].markers[gene.marker_id] += gene.depth
# compute median marker depth
for sp in species.values():
Expand Down
6 changes: 3 additions & 3 deletions midas/run/snps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def build_genome_db(args, species):
db_stats['species'] += 1
infile = utility.iopen(sp.paths['fna'])
for r in Bio.SeqIO.parse(infile, 'fasta'):
outfile.write('>%s\n%s\n' % (r.id, str(r.seq).upper()))
db_stats['total_length'] += len(r.seq)
db_stats['total_seqs'] += 1
outfile.write('>%s\n%s\n' % (r.id, str(r.seq).upper()))
db_stats['total_length'] += len(r.seq)
db_stats['total_seqs'] += 1
infile.close()
outfile.close()
# print out database stats
Expand Down
2 changes: 1 addition & 1 deletion scripts/call_consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def sequence_description(sample):
desc = {}
desc['length'] = len(sample.seq)
desc['percent_missing'] = percent_missing(sample.seq)
desc['mean_depth'] = round(sample.sample_depth, 2)
desc['mean_depth'] = round(sample.mean_depth, 2)
return desc

def write_consensus(args, samples):
Expand Down

0 comments on commit 87d1025

Please sign in to comment.