Skip to content

question on in silico perturbation AND pre-training with Bulk-seq data #69

Description

@zhang0730

I am working with the perturb.md for in silico perturbation and encountering a problem:
Umap_direct(TFko,Input_dir,embedding,D,save,outdir)

ValueError                                Traceback (most recent call last)
Cell In[36], line 2
      1 save=True
----> 2 Umap_direct(TFko,Input_dir,embedding,D,save,outdir)

Cell In[35], line 21, in Umap_direct(TFko, Input_dir, embedding, D, save, outdir)
     19     continuous_values=[colors[i] for i in label1]
     20 # Create a scatter plot with colored dots based on the cluster annotations
---> 21     plt.scatter(embedding[:,0], embedding[:,1], c=continuous_values, s=2)
     22     for cluster in unique_clusters:
     23         indices = np.where(anno == cluster)

File ~/mambaforge/envs/LINGER/lib/python3.10/site-packages/matplotlib/pyplot.py:3687, in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, edgecolors, plotnonfinite, data, **kwargs)
   3668 @_copy_docstring_and_deprecators(Axes.scatter)
   3669 def scatter(
   3670     x: float | ArrayLike,
   (...)
   3685     **kwargs,
   3686 ) -> PathCollection:
-> 3687     __ret = gca().scatter(
   3688         x,
   3689         y,
   3690         s=s,
   3691         c=c,
   3692         marker=marker,
   3693         cmap=cmap,
   3694         norm=norm,
   3695         vmin=vmin,
   3696         vmax=vmax,
   3697         alpha=alpha,
   3698         linewidths=linewidths,
   3699         edgecolors=edgecolors,
   3700         plotnonfinite=plotnonfinite,
   3701         **({"data": data} if data is not None else {}),
   3702         **kwargs,
   3703     )
   3704     sci(__ret)
   3705     return __ret

File ~/mambaforge/envs/LINGER/lib/python3.10/site-packages/matplotlib/__init__.py:1465, in _preprocess_data.<locals>.inner(ax, data, *args, **kwargs)
   1462 @functools.wraps(func)
   1463 def inner(ax, *args, data=None, **kwargs):
   1464     if data is None:
-> 1465         return func(ax, *map(sanitize_sequence, args), **kwargs)
   1467     bound = new_sig.bind(ax, *args, **kwargs)
   1468     auto_label = (bound.arguments.get(label_namer)
   1469                   or bound.kwargs.get(label_namer))

File ~/mambaforge/envs/LINGER/lib/python3.10/site-packages/matplotlib/axes/_axes.py:4670, in Axes.scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, edgecolors, plotnonfinite, **kwargs)
   4667 if edgecolors is None:
   4668     orig_edgecolor = kwargs.get('edgecolor', None)
   4669 c, colors, edgecolors = \
-> 4670     self._parse_scatter_color_args(
   4671         c, edgecolors, kwargs, x.size,
   4672         get_next_color_func=self._get_patches_for_fill.get_next_color)
   4674 if plotnonfinite and colors is None:
   4675     c = np.ma.masked_invalid(c)

File ~/mambaforge/envs/LINGER/lib/python3.10/site-packages/matplotlib/axes/_axes.py:4499, in Axes._parse_scatter_color_args(c, edgecolors, kwargs, xsize, get_next_color_func)
   4495     else:
   4496         if len(colors) not in (0, 1, xsize):
   4497             # NB: remember that a single color is also acceptable.
   4498             # Besides *colors* will be an empty array if c == 'none'.
-> 4499             raise invalid_shape_exception(len(colors), xsize)
   4500 else:
   4501     colors = None  # use cmap, norm after collection is created

ValueError: 'c' argument has 1046 elements, which is inconsistent with 'x' and 'y' with size 1047.

in my opinion, this is because the embeding lenth is 1047 and the label length is 1046, but I couldn't find the solution after reading the code.

Another question is that could I pre-train the model with specific bulk-seq data on my own? The data_bulk.gz you provided is the processed data, could you provide the concrete oode?
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions