Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build database fails due to non-unique entries in fasta #22

Closed
silenus092 opened this issue Jan 6, 2022 · 2 comments
Closed

build database fails due to non-unique entries in fasta #22

silenus092 opened this issue Jan 6, 2022 · 2 comments

Comments

@silenus092
Copy link
Collaborator

In GitLab by @oliverdrechsel on Jan 6, 2022, 10:45

If covsonar hits non-unique ids in building database it fails. That's perfect. A helpful hint would be, if it would state the violating id.

Traceback (most recent call last):
  File "[...]sonar.py", line 430, in <module>
    snr.add(args.file, cachedir=args.cache, cpus=args.cpus, force=args.force, timeout=args.timeout, quiet=args.quiet, noprogress=args.noprogress, compressed=args.compressed, source=args.source, collection=args.collection, lab=args.lab
  File "[...]/tools/covsonar/sonar.py", line 242, in add
    self.db.import_genome_from_cache(cache.dirname, to_import, msg=msg, dbm=dbm, disable_progressbar=disable_progressbar)
  File "[...]/tools/covsonar/lib/sonardb.py", line 2239, in import_genome_from_cache
    self.import_genome(**preprocessed_data, seq=seq, dbm=dbm)
  File "[...]/tools/covsonar/lib/sonardb.py", line 2272, in import_genome
    dbm.insert_genome(acc, descr, seqhash)
  File "[...]/tools/covsonar/lib/sonardb.py", line 1308, in insert_genome
    self.cursor.execute(sql, [acc, descr, seqhash])
sqlite3.IntegrityError: UNIQUE constraint failed: genome.accession

@silenus092
Copy link
Collaborator Author

In GitLab by @kunaphas.kon on Jan 11, 2022, 23:10

Hi @oliverdrechsel ,

Thank you for your report

If you don't mind, can you provide the command and related files to generate this error?🐛

Then, we can reproduce this error and enhance it properly.

Thanks

@silenus092
Copy link
Collaborator Author

In GitLab by @kunaphas.kon on Jan 13, 2022, 14:20

Ok, thank you @oliverdrechsel

so next time if we get an error during the add command, it will report the error with the causal ID.

(Error while processing ID: {#ID}")

For example

Error while processing ID: 'XXX-negative-XXX-01'
# and  then follow with raising an exception as usual 
warning:
Traceback (most recent call last):
  File "/covsonar/lib/sonardb.py", line 2258, in import_genome_from_cache
    self.import_genome(**preprocessed_data, seq=seq, dbm=dbm)
  File "/covsonar/lib/sonardb.py", line 2307, in import_genome
    raise  er
  File "/covsonar/lib/sonardb.py", line 2292, in import_genome
    dbm.insert_genome(acc, descr, seqhash)
  File "/covsonar/lib/sonardb.py", line 1310, in insert_genome
    self.cursor.execute(sql, [acc, descr, seqhash])
sqlite3.IntegrityError: UNIQUE constraint failed: genome.accession

if this ok, I will put this update into the next covSonar update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant