levseq 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {levseq-1.0.1/levseq.egg-info → levseq-1.0.2}/PKG-INFO +1 -1
- {levseq-1.0.1 → levseq-1.0.2}/levseq/__init__.py +1 -1
- {levseq-1.0.1 → levseq-1.0.2}/levseq/run_levseq.py +1 -1
- {levseq-1.0.1 → levseq-1.0.2}/levseq/visualization.py +42 -23
- {levseq-1.0.1 → levseq-1.0.2/levseq.egg-info}/PKG-INFO +1 -1
- {levseq-1.0.1 → levseq-1.0.2}/LICENSE +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/MANIFEST.in +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/README.md +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/IO_processor.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/barcoding/__init__.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/barcoding/demultiplex +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/barcoding/demultiplex-arm64 +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/barcoding/demultiplex-x86 +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/barcoding/minion_barcodes.fasta +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/basecaller.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/cmd.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/globals.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/interface.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/parser.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/screen.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/simulation.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/user.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/utils.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq/variantcaller.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq.egg-info/SOURCES.txt +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq.egg-info/dependency_links.txt +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq.egg-info/entry_points.txt +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq.egg-info/requires.txt +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/levseq.egg-info/top_level.txt +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/setup.cfg +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/setup.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/tests/test_demultiplex_docker.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/tests/test_seqs.py +0 -0
- {levseq-1.0.1 → levseq-1.0.2}/tests/test_variant_calling.py +0 -0
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
__title__ = 'levseq'
|
|
19
19
|
__description__ = 'LevSeq nanopore sequencing'
|
|
20
20
|
__url__ = 'https://github.com/fhalab/levseq/'
|
|
21
|
-
__version__ = '1.0.
|
|
21
|
+
__version__ = '1.0.2'
|
|
22
22
|
__author__ = 'Yueming Long, Emreay Gursoy, Ariane Mora'
|
|
23
23
|
__author_email__ = 'ylong@caltech.edu'
|
|
24
24
|
__license__ = 'GPL3'
|
|
@@ -248,7 +248,7 @@ def demux_fastq(file_to_fastq, result_folder, barcode_path):
|
|
|
248
248
|
raise FileNotFoundError(f"Executable not found: {executable_path}")
|
|
249
249
|
|
|
250
250
|
# Get min and max sequence length if user specified, otherwise use default
|
|
251
|
-
seq_min =
|
|
251
|
+
seq_min = 150
|
|
252
252
|
seq_max = 10000
|
|
253
253
|
|
|
254
254
|
# Use subprocess to run the executable
|
|
@@ -135,6 +135,19 @@ def _make_platemap(df, title, cmap=None):
|
|
|
135
135
|
|
|
136
136
|
Called via `generate_platemaps`; see docs there.
|
|
137
137
|
"""
|
|
138
|
+
# Handle empty dataframe case
|
|
139
|
+
if df.empty:
|
|
140
|
+
# Create a dummy plot with a message
|
|
141
|
+
empty_df = pd.DataFrame({
|
|
142
|
+
'Row': list('ABCDEFGH'),
|
|
143
|
+
'Column': [str(i) for i in range(1, 13)],
|
|
144
|
+
'logseqdepth': [0] * 96,
|
|
145
|
+
'Mutations': [''] * 96,
|
|
146
|
+
'Alignment Count': [0] * 96,
|
|
147
|
+
'Alignment Probability': [0] * 96
|
|
148
|
+
})
|
|
149
|
+
df = empty_df
|
|
150
|
+
|
|
138
151
|
# Convert SeqDepth to log for easier visualization.
|
|
139
152
|
df["logseqdepth"] = np.log(
|
|
140
153
|
df["Alignment Count"],
|
|
@@ -149,28 +162,30 @@ def _make_platemap(df, title, cmap=None):
|
|
|
149
162
|
# Set some base opts
|
|
150
163
|
opts = dict(invert_yaxis=True, title=title, show_legend=True)
|
|
151
164
|
|
|
152
|
-
#
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
add_min = False
|
|
159
|
-
if df["logseqdepth"].min() >= center:
|
|
160
|
-
add_min = True
|
|
161
|
-
|
|
162
|
-
# Adjust if it is greater than max of data (avoids ValueError)
|
|
163
|
-
if df["logseqdepth"].max() <= center:
|
|
164
|
-
# Adjust the center
|
|
165
|
-
center = df["logseqdepth"].median()
|
|
166
|
-
|
|
167
|
-
# center colormap
|
|
168
|
-
if not add_min:
|
|
169
|
-
color_levels = ns.viz._center_colormap(df["logseqdepth"], center)
|
|
165
|
+
# Set the center and handle empty or zero-only data
|
|
166
|
+
if df["logseqdepth"].max() <= 0:
|
|
167
|
+
# For empty data, create minimal valid range
|
|
168
|
+
df["logseqdepth"] = 1 # Set to constant value
|
|
169
|
+
color_levels = [0.9, 1, 1.1] # Create minimal valid range
|
|
170
|
+
seq_depth_cmap = ['#f7f7f7', '#f7f7f7'] # Use same color for uniform appearance
|
|
170
171
|
else:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
)
|
|
172
|
+
# Regular case with actual data
|
|
173
|
+
seq_depth_cmap = list(reversed(cc.CET_D9))
|
|
174
|
+
center = np.log(10)
|
|
175
|
+
add_min = False
|
|
176
|
+
|
|
177
|
+
if df["logseqdepth"].min() >= center:
|
|
178
|
+
add_min = True
|
|
179
|
+
|
|
180
|
+
if df["logseqdepth"].max() <= center:
|
|
181
|
+
center = df["logseqdepth"].median()
|
|
182
|
+
|
|
183
|
+
if not add_min:
|
|
184
|
+
color_levels = ns.viz._center_colormap(df["logseqdepth"], center)
|
|
185
|
+
else:
|
|
186
|
+
color_levels = ns.viz._center_colormap(
|
|
187
|
+
list(df["logseqdepth"]) + [np.log(1)], center
|
|
188
|
+
)
|
|
174
189
|
|
|
175
190
|
# Get heights
|
|
176
191
|
n_rows = len(df["Row"].unique())
|
|
@@ -271,7 +286,9 @@ def _make_platemap(df, title, cmap=None):
|
|
|
271
286
|
|
|
272
287
|
# Use in apply statement for residue labels
|
|
273
288
|
def split_variant_labels(mutation_string):
|
|
274
|
-
|
|
289
|
+
if pd.isna(mutation_string) or mutation_string == '':
|
|
290
|
+
return ''
|
|
291
|
+
|
|
275
292
|
num_mutations = len(mutation_string.split("_"))
|
|
276
293
|
|
|
277
294
|
if num_mutations > 4:
|
|
@@ -287,7 +304,7 @@ def _make_platemap(df, title, cmap=None):
|
|
|
287
304
|
|
|
288
305
|
# Set the font size based on if #PARENT# is in a well and num of mutations
|
|
289
306
|
max_num_mutations = _df["Labels"].apply(lambda x: len(x.split("\n"))).max()
|
|
290
|
-
has_parent = "#PARENT#" in _df["Labels"]
|
|
307
|
+
has_parent = "#PARENT#" in _df["Labels"].values
|
|
291
308
|
|
|
292
309
|
if max_num_mutations > 3 or has_parent:
|
|
293
310
|
label_fontsize = "8pt"
|
|
@@ -299,12 +316,14 @@ def _make_platemap(df, title, cmap=None):
|
|
|
299
316
|
["Column", "Row"],
|
|
300
317
|
"Labels",
|
|
301
318
|
).opts(text_font_size=label_fontsize, **opts, text_color="#000000")
|
|
319
|
+
|
|
302
320
|
# return formatted final plot
|
|
303
321
|
return (hm * boxes * labels).opts(
|
|
304
322
|
frame_height=550, frame_width=550 * 3 // 2, border=50, show_legend=True
|
|
305
323
|
)
|
|
306
324
|
|
|
307
325
|
|
|
326
|
+
|
|
308
327
|
# Main function to return heatmap with or without alignment
|
|
309
328
|
def generate_platemaps(
|
|
310
329
|
max_combo_data,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|