Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaynagi committed Sep 27, 2024
2 parents 2b21a8a + 33ff84b commit 62170bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions AnoPrimer/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ def primer3_to_pandas(primer_dict, assay_type):
# Create a column which is primer pair #, and a column for primer
# parameter which does not contain primer pair #
primer_df = primer_df.iloc[row_start:, :].copy()
primer_df["primer_pair"] = primer_df["parameter"].str.extract("([0-9][0-9]|[0-9])")
primer_df["primer_pair"] = (
primer_df["parameter"].str.extract("([0-9][0-9]|[0-9])").astype(int) + 1
)
primer_df["parameter"] = primer_df["parameter"].str.replace(
"(_[0-9][0-9]|_[0-9])", "", regex=True
)
Expand All @@ -446,7 +448,8 @@ def primer3_to_pandas(primer_dict, assay_type):
required_info = [string.lower() for string in required_info]

# Subset data frame
primer_df = primer_df.loc[required_info, np.arange(primer_df.shape[1]).astype(str)]
primer_df = primer_df.loc[required_info, np.arange(1, primer_df.shape[1] + 1)]
primer_df.columns = primer_df.columns.astype(str)
return primer_df


Expand Down
7 changes: 5 additions & 2 deletions AnoPrimer/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ def plot_primer_locs(
# Plot exons, genes, primer spans
self._plot_exons(ax, locgff, exon_id_col)
self._plot_genes(ax, genegff, min_, max_)
self._plot_primers(ax, oligos)
handles = self._plot_primers(ax, oligos)

# Add legend and save if out_dir is provided
plt.legend(handles=ax.get_legend_handles_labels()[0], loc=legend_loc)
plt.legend(handles=handles, loc=legend_loc)
if out_dir:
fig.savefig(
f"{out_dir}/{assay_name}_primer_locs.png", dpi=300, bbox_inches="tight"
Expand Down Expand Up @@ -397,6 +398,8 @@ def _plot_primers(self, ax, oligos):
patch = patches.Patch(color=pal[pair], label=f"pair {pair}")
handles.append(patch)

return handles

def gget_blat_genome(self, assembly="anoGam3"):
"""
Align primers to the genome using BLAT.
Expand Down

0 comments on commit 62170bc

Please sign in to comment.