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

Bug fix and couple minor improvements #95

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion gen_reads.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env source
#!/usr/bin/env python3
# encoding: utf-8
""" ////////////////////////////////////////////////////////////////////////////////
/// ///
Expand Down Expand Up @@ -405,8 +405,13 @@ def main(raw_args=None):
# keep track of the number of reads we've sampled, for read-names
read_name_count = 1
unmapped_records = []
skip_chromosomes = off_target_scalar == 0.0 or off_target_discard

for chrom in range(len(ref_index)):
chrom_name = ref_index[chrom][0]
if input_regions and chrom_name not in input_regions and skip_chromosomes:
# print('Skipping {}'.format(chrom_name))
continue

# read in reference sequence and notate blocks of Ns
(ref_sequence, n_regions) = read_ref(reference, ref_index[chrom], n_handling)
Expand Down
3 changes: 2 additions & 1 deletion source/output_file_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ def write_fastq_record(self, read_name, read1, qual1, read2=None, qual2=None, or
if read2 is not None and orientation is True:
(read2, quality2) = (read2.reverse_complement(), qual2[::-1])
elif read2 is not None and orientation is False:
prev_read1 = read1
(read1, quality1) = (read2.reverse_complement(), qual2[::-1])
(read2, quality2) = (read1, qual1)
(read2, quality2) = (prev_read1, qual1)

if self.fasta_instead:
self.fq1_buffer.append('>' + read_name + '/1\n' + str(read1) + '\n')
Expand Down
4 changes: 2 additions & 2 deletions source/ref_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def read_ref(ref_path, ref_inds_i, n_handling, n_unknowns=True, quiet=False):
for region in n_atlas:
n_info['all'].extend(region)
if region[1] - region[0] <= n_handling[1]:
temp = my_dat.tomutable()
for i in range(region[0], region[1]):
temp = my_dat.tomutable()
temp[i] = random.choice(ALLOWED_NUCL)
my_dat = temp.toseq()
my_dat = temp.toseq()
else:
n_info['big'].extend(region)
elif n_handling[0] == 'allChr' and n_handling[2] in OK_CHR_ORD:
Expand Down