Skip to content

Commit

Permalink
Merge pull request #266 from karel-brinda/docs_make_format
Browse files Browse the repository at this point in the history
Docs make format
  • Loading branch information
karel-brinda authored Mar 17, 2024
2 parents 5a1b29b + 3c7f7d9 commit a3dfdf5
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[style]
BASED_ON_STYLE = google
COLUMN_LIMIT=120

15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all test help clean cleanall cluster download download_asms download_cobs match map format report config conda
.PHONY: all test help clean cleanall cluster download download_asms download_cobs match map checkformat report config conda

SHELL=/usr/bin/env bash -eo pipefail
DATETIME=$(shell date -u +"%Y_%m_%dT%H_%M_%S")
Expand Down Expand Up @@ -106,9 +106,9 @@ report: ## Generate Snakemake report



##########
## Misc ##
##########
#############
## Cluster ##
#############
cluster_slurm: ## Submit to a SLURM cluster
sbatch \
-c 10 \
Expand All @@ -124,6 +124,13 @@ cluster_lsf: ## Submit to LSF cluster
scripts/check_if_config_is_ok_for_cluster_run.py
scripts/submit_lsf.sh

####################
## For developers ##
####################
format: ## Reformat Python and Snakemake files
yapf -i */*.py
snakefmt Snakefile

checkformat: ## Check source code format
snakefmt --check Snakefile
yapf --diff */*.py
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ Here's a list of all implemented commands (to be executed as `make {command}`):
####################
# General commands #
####################

all Run everything (the default rule)
test Quick test using 3 batches
help Print help messages
Expand Down
6 changes: 4 additions & 2 deletions scripts/batch_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def readfq(fp):
if l[0] in '>@': # fasta/q header line
last = l[:-1] # save this line
break
if not last: break
if not last:
break

####
# modified to include comments
Expand All @@ -72,7 +73,8 @@ def readfq(fp):
seqs.append(l[:-1])
if not last or last[0] != '+': # this is a fasta record
yield name, comment, ''.join(seqs), None # yield a fasta record
if not last: break
if not last:
break
else: # this is a fastq record
seq, leng, seqs = ''.join(seqs), 0, []
for l in fp: # read the quality
Expand Down
6 changes: 4 additions & 2 deletions scripts/filter_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def readfq(fp): # this is a generator function
if l[0] in '>@': # fasta/q header line
last = l[:-1] # save this line
break
if not last: break
if not last:
break
name, seqs, last = last[1:].partition(" ")[0], [], None
for l in fp: # read the sequence
if l[0] in '@+>':
Expand All @@ -84,7 +85,8 @@ def readfq(fp): # this is a generator function
seqs.append(l[:-1])
if not last or last[0] != '+': # this is a fasta record
yield name, ''.join(seqs), None # yield a fasta record
if not last: break
if not last:
break
else: # this is a fastq record
seq, leng, seqs = ''.join(seqs), 0, []
for l in fp: # read the quality
Expand Down
6 changes: 4 additions & 2 deletions scripts/filter_queries_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def fa_iterator(fn): # this is a generator function
if l[0] in '>@': # fasta/q header line
last = l[:-1] # save this line
break
if not last: break
if not last:
break
name, seqs, last = last[1:].partition(" ")[0], [], None
for l in fp: # read the sequence
if l[0] in '@+>':
Expand All @@ -107,7 +108,8 @@ def fa_iterator(fn): # this is a generator function
seqs.append(l[:-1])
if not last or last[0] != '+': # this is a fasta record
yield name, ''.join(seqs), None # yield a fasta record
if not last: break
if not last:
break
else: # this is a fastq record
seq, leng, seqs = ''.join(seqs), 0, []
for l in fp: # read the quality
Expand Down
6 changes: 4 additions & 2 deletions scripts/final_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def readfq(fp):
if l[0] in '>@':
last = l[:-1]
break
if not last: break
if not last:
break
name, seqs, last = last[1:].partition(" ")[0], [], None
for l in fp:
if l[0] in '@+>':
Expand All @@ -26,7 +27,8 @@ def readfq(fp):
seqs.append(l[:-1])
if not last or last[0] != '+':
yield name, ''.join(seqs), None
if not last: break
if not last:
break
else:
seq, leng, seqs = ''.join(seqs), 0, []
for l in fp:
Expand Down

0 comments on commit a3dfdf5

Please sign in to comment.