Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyangzzu committed Jun 12, 2023
1 parent 54300b9 commit d1a7fd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion modules/ENVCHECK.nf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ process ENVCHECK {
## for folder, use ln, note this is a link to a folder
## find_dir=$( readlink -f !{reference_genome} )
## Copy reference genome, avoid singularity/docker access out data problem
cp -f -L !{reference_genome}/* !{params.GENOME_DIR}/
## cp -f -L !{reference_genome}/* !{params.GENOME_DIR}/
find !{reference_genome}/ -maxdepth 1 -type f | \
parallel -j0 cp -f -L {} !{params.GENOME_DIR}/
else
echo "### ERROR: not recognized reference_genome=!{reference_genome}"
exit -1
Expand Down
14 changes: 11 additions & 3 deletions utils/modbam2bed_extract_read_cpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,21 @@ def process_modbam2bed(input_bam, chr_list, reference_fasta, output_bed, canon_t
continue
### Filter out CpG sites
if ref_strand == "+":
reference_base = reference_fasta.fetch(chr_name, ref_pos, ref_pos + 2).upper()
try:
reference_base = reference_fasta.fetch(chr_name, ref_pos, ref_pos + 2).upper()
except:
continue
elif ref_strand == "-":
# For "-" strand, get the reverse complement of the reference sequence
reference_base = reverse_complement(
reference_fasta.fetch(chr_name, ref_pos - 1, ref_pos + 1)).upper()
try:
reference_base = reverse_complement(
reference_fasta.fetch(chr_name, ref_pos - 1, ref_pos + 1)).upper()
except:
continue
else:
reference_base = "NANA"
print("ref_strand is not correct!")

if reference_base in ['CG' or 'GC']:
if prob_mod < canon_threshold: # Extract canon_read and label as 0
# read_data.append([chr_name, ref_pos, ref_pos + 1, read_id, prob_mod, ref_strand, 0])
Expand Down

0 comments on commit d1a7fd5

Please sign in to comment.