Skip to content

Commit

Permalink
Merge pull request #40 from sanjaynagi/f-strings-replace-@
Browse files Browse the repository at this point in the history
fix for numexpr bug - replace pd.query() '@' usage with f-strings
  • Loading branch information
sanjaynagi committed Aug 16, 2023
2 parents 7d55af8 + 611f8a8 commit 18ec124
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions AgamPrimer/AgamPrimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def prepare_cDNA_sequence(transcript, genome_seq, assay_name, cDNA_exon_junction

# subset gff to your gene
gff = ag3.geneset()
gff = gff.query("type == 'exon' & Parent == @transcript")
gff = gff.query(f"type == 'exon' & Parent == '{transcript}'")
# Get fasta sequence for each of our exons, and remember gDNA position
seq = dict()
gdna_pos = dict()
Expand Down Expand Up @@ -616,7 +616,7 @@ def check_and_split_target(target, assay_type):
assert (
target in gff["ID"].to_list()
), f"requested target {target} not in ag3 transcript set"
contig = gff.query("ID == @target")["contig"].unique()[0]
contig = gff.query(f"ID == '{target}'")["contig"].unique()[0]
return (contig, target)
else:
assert isinstance(
Expand Down Expand Up @@ -1068,23 +1068,23 @@ def _plotly_primers(

def _get_gDNA_locs(gff, contig, start, end):
locgff = gff.query(
"contig == @contig & type == 'exon' & start < @end & end > @start"
f"contig == '{contig}' & type == 'exon' & start < {end} & end > {start}"
)
min_ = locgff.start.min() - 100
max_ = locgff.end.max() + 100
genegff = gff.query(
"contig == @contig & type == 'gene' & start < @end & end > @start"
f"contig == '{contig}' & type == 'gene' & start < {end} & end > {start}"
)
return (locgff, min_, max_, genegff)


def _get_qPCR_locs(gff, contig, transcript):
# Load geneset (gff)
locgff = gff.query("Parent == @transcript & type == 'exon'")
locgff = gff.query(f"Parent == '{transcript}' & type == 'exon'")
min_ = locgff.start.min() - 200
max_ = locgff.end.max() + 200
genegff = gff.query(
"contig == @contig & type == 'gene' & start > @min_ & end < @max_"
f"contig == '{contig}' & type == 'gene' & start > {min_} & end < {max_}"
)
return (locgff, min_, max_, genegff)

Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "AgamPrimer"
version = "0.6.6"
version = "0.6.7"
description = "A package to design primers in Anopheles gambiae whilst considering genetic variation with malariagen_data"
authors = [
"Sanjay Nagi <sanjay.nagi@lstmed.ac.uk>",
Expand All @@ -13,7 +13,6 @@ license = "MIT"
[tool.poetry.dependencies]
python = ">=3.8,<3.12"
primer3-py = "2.0.0"
pandas = ">= 1.2, !=1.5.3"
malariagen_data = "*"
openpyxl = "*"
gget = "*"
Expand Down

0 comments on commit 18ec124

Please sign in to comment.