OSC / phylogatr-web

The web app for the Phylogatr Project - https://phylogatr.org/
https://phylogatr.org/
MIT License
0 stars 0 forks source link

After running pipeline, Cuculus-micropterus has no occurrences #20

Open johrstrom opened 2 years ago

johrstrom commented 2 years ago
[11] pry(main)> Species.distinct.pluck(:id) - Occurrence.distinct.pluck(:species_id).uniq
   (154.6ms)  SELECT DISTINCT `species`.`id` FROM `species`
   (4.5ms)  SELECT DISTINCT `occurrences`.`species_id` FROM `occurrences`
=> [59884]
[12] pry(main)> Species.find(59884)
  Species Load (0.4ms)  SELECT  `species`.* FROM `species` WHERE `species`.`id` = 59884 LIMIT 1
=> #<Species:0x00000000338d5620
 id: 59884,
 path: "Aves/Cuculiformes/Cuculidae/Cuculus-micropterus",
 total_seqs: 14,
 total_bytes: 10028,
 aligned: true,
 taxon_kingdom: "Animalia",
 taxon_phylum: "Chordata",
 taxon_class: "Aves",
 taxon_order: "Cuculiformes",
 taxon_family: "Cuculidae",
 taxon_genus: "Cuculus",
 taxon_species: "Cuculus micropterus",
 taxon_subspecies: "">
[13] pry(main)> Species.find(59884).occurrences
  Species Load (0.3ms)  SELECT  `species`.* FROM `species` WHERE `species`.`id` = 59884 LIMIT 1
  Occurrence Load (0.4ms)  SELECT `occurrences`.* FROM `occurrences` WHERE `occurrences`.`species_id` = 59884
=> []
[14] pry(main)>
johrstrom commented 2 years ago

Another note says:

This may be indicative of a bug. What were the original occurrences, where did they go, why did this get created anyways?

Until then this can just be manually deleted in production by doing:

# give me a list of species id's to delete
Species.where(id: (Species.distinct.pluck(:id) - Occurrence.distinct.pluck(:species_id).uniq)).delete_all