Merck / Merck/deepbgc

DeepBGC failed with ValueError: Grouper for 'sequence_id' not 1-dimensional

Open
#100 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
161
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Hello
Could you please help me with the folowing error: DeepBGC failed with ValueError: Grouper for 'sequence_id' not 1-dimensional
Thank you very much!!!

Commands:

deepbgc prepare --output-tsv cat_saxi_clusters_refs.prepared.tsv cat_saxi_clusters_refs_genomic.fasta
deepbgc train --model deepbgc.json --output SaxiDetector.pkl --config PFAM2VEC ./pfam2vec.csv Saxi_Positives.incluster.pfam.tsv Fake_negatives.pfam.tsv
ERROR 29/07 18:14:08 DeepBGC failed with ValueError: Grouper for 'sequence_id' not 1-dimensional

cat_saxi_clusters_refs_genomic.fasta contains six nucleotide sequences from a BGC of six species

Based on the GeneSwap_Negatives.pfam.tsv file, I edited the cat_saxi_clusters_refs.prepared.tsv to have the same columns as the GeneSwap_Negatives.pfam.tsv file, including the 'sequence_id', which consist of six BGC identifiers in the positive file and 'NEG_FAKE_CLUSTER' in the edited Fake_negatives.pfam.tsv
Both files have these columns:
sequence_id|contig_id|protein_id|gene_start|gene_end|gene_strand|pfam_id|domain_start|domain_end|bitscore|in_cluster

Saxi_Positives.incluster.pfam.tsv with in_cluster = 1 and six sequence_id to group by during training
Fake_negatives.pfam.tsv with in_cluster = 0 and one sequence_id

I got the deepbgc.json and pfam2vec.csv from github

Complete error message:
Traceback (most recent call last):
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/deepbgc/main.py", line 113, in main
run(argv)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/deepbgc/main.py", line 102, in run
args.func.run(**args_dict)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/deepbgc/command/train.py", line 60, in run
train_samples, train_y = util.read_samples(inputs, target)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/deepbgc/util.py", line 561, in read_samples
samples = [sample for sample_id, sample in domains.groupby('sequence_id')]
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/pandas/core/generic.py", line 7632, in groupby
observed=observed, **kwargs)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 2110, in groupby
return klass(obj, by, **kwds)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 360, in init
mutated=self.mutated)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/pandas/core/groupby/grouper.py", line 602, in _get_grouper
if not isinstance(gpr, Grouping) else gpr)
File "/home/marlaux/anaconda3/envs/deepbgc/lib/python3.7/site-packages/pandas/core/groupby/grouper.py", line 322, in init
"Grouper for '{}' not 1-dimensional".format(t))
ValueError: Grouper for 'sequence_id' not 1-dimensional
ERROR 29/07 18:14:08 ================================================================================
ERROR 29/07 18:14:08 DeepBGC failed with ValueError: Grouper for 'sequence_id' not 1-dimensional
ERROR 29/07 18:14:08 ================================================================================

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at deepbgc/util.py:561, where read_samples groups the training data, and compare the sequence_id headers in Saxi_Positives.incluster.pfam.tsv and Fake_negatives.pfam.tsv. Then rerun the displayed deepbgc train command; the issue is resolved when training proceeds without the ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
bioinformatics, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.