wukevin / tcr-bert

Large language modeling applied to T-cell receptor (TCR) sequences.
Apache License 2.0
47 stars 8 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'muscle' #6

Closed a96123155 closed 1 year ago

a96123155 commented 1 year ago

Hi, When I try to running the './jupyter/transformers_glanville_classifier_and_clustering.ipynb', there is a error on figs = [motif_from_cluster(c, fname=os.path.join(PLOT_DIR, f"glanville_embed_cluster_motif_{c}.pdf")) for c in ['25', '22', '20']]:

FileNotFoundError                         Traceback (most recent call last)
Cell In[14], line 22
     19         fig.savefig(fname, bbox_inches='tight')
     20     return fig
---> 22 figs = [motif_from_cluster(c, fname=os.path.join(PLOT_DIR, f"glanville_embed_cluster_motif_{c}.pdf")) for c in ['25', '22', '20']]
     23 for f in figs:
     24     f.show()

Cell In[14], line 22, in <listcomp>(.0)
     19         fig.savefig(fname, bbox_inches='tight')
     20     return fig
---> 22 figs = [motif_from_cluster(c, fname=os.path.join(PLOT_DIR, f"glanville_embed_cluster_motif_{c}.pdf")) for c in ['25', '22', '20']]
     23 for f in figs:
     24     f.show()

Cell In[14], line 13, in motif_from_cluster(cluster, fname)
      7 logo_kwargs = {
      8     "color_scheme": "dmslogo_funcgroup",
      9     "show_spines": False,
     10     "alpha": 0.9,
     11 }
     12 fig, ax = plt.subplots(figsize=(4, 1.3), dpi=300)
---> 13 custom_metrics.motif_from_sequences(cluster_of_interest['CDR3b'], normalize_pwm=False, ax=ax, **logo_kwargs)[1]
     14 ax.set(
     15     xticks=[],
     16     yticks=[],
     17 )
     18 if fname is not None:

File ~/tcr-bert/tcr/custom_metrics.py:214, in motif_from_sequences(sequences, normalize_pwm, dedup, **kwargs)
    212 if dedup:
    213     sequences = utils.dedup(sequences)
--> 214 msa_seqs = Muscle.run_muscle(sequences)
    215 msa_pwm = per_position_aa_count(msa_seqs, normalize=normalize_pwm)
    216 logo = logomaker.Logo(msa_pwm, **kwargs)

File ~/tcr-bert/tcr/Muscle.py:39, in run_muscle(sequences, fast)
     37 print(subprocess.DEVNULL)
     38 print(shlex.split(muscle_cmd))
---> 39 retval = subprocess.call(
     40     shlex.split(muscle_cmd),
     41     stdout=subprocess.DEVNULL,
     42     stderr=subprocess.DEVNULL,
     43 )
     44 assert retval == 0, f"Exit code {retval} when running muscle"
     45 msa_seqs = list(utils.read_fasta(muscle_output_fname).values())

File ~/.conda/envs/tcrbert/lib/python3.9/subprocess.py:349, in call(timeout, *popenargs, **kwargs)
    341 def call(*popenargs, timeout=None, **kwargs):
    342     """Run command with arguments.  Wait for command to complete or
    343     timeout, then return the returncode attribute.
    344 
   (...)
    347     retcode = call(["ls", "-l"])
    348     """
--> 349     with Popen(*popenargs, **kwargs) as p:
    350         try:
    351             return p.wait(timeout=timeout)

File ~/.conda/envs/tcrbert/lib/python3.9/subprocess.py:951, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    947         if self.text_mode:
    948             self.stderr = io.TextIOWrapper(self.stderr,
    949                     encoding=encoding, errors=errors)
--> 951     self._execute_child(args, executable, preexec_fn, close_fds,
    952                         pass_fds, cwd, env,
    953                         startupinfo, creationflags, shell,
    954                         p2cread, p2cwrite,
    955                         c2pread, c2pwrite,
    956                         errread, errwrite,
    957                         restore_signals,
    958                         gid, gids, uid, umask,
    959                         start_new_session)
    960 except:
    961     # Cleanup if the child failed starting.
    962     for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File ~/.conda/envs/tcrbert/lib/python3.9/subprocess.py:1823, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session)
   1821     if errno_num != 0:
   1822         err_msg = os.strerror(errno_num)
-> 1823     raise child_exception_type(errno_num, err_msg, err_filename)
   1824 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'muscle'

I found that if using it in Shell, it will be worked. But I want to see it in jupyter... What Can I solve it?

Thank you.