lindenb / jvarkit

Java utilities for Bioinformatics
https://jvarkit.readthedocs.io/
Other
478 stars 132 forks source link

java.lang.RuntimeException: Not a diploid organism. #169

Closed CornilleAmandine closed 7 months ago

CornilleAmandine commented 3 years ago

Subject of the issue

I got an error message, java.lang.RuntimeException: Not a diploid organism. I am working on a haploid organism. Does that mean that vcf to bam does not work for haploid organism?

Your environment

Thanks a lot, my best, Amandine

lindenb commented 3 years ago

yes it's only for diploid. I wrote this program for diploid only. If you want to create a 'fake' diploid.

in https://github.com/lindenb/jvarkit/blob/master/src/main/java/com/github/lindenb/jvarkit/tools/misc/VcfToBam.java#L288 change the lines:

if(alleles.size()!=2) throw new RuntimeException("Not a diploid organism.");
Allele allele=null;
if(genotype.isPhased())
{
allele =alleles.get(g_strand);
}
else
{
allele = alleles.get(Math.random()< 0.5?0:1);
}

to

Allele allele= alleles.get(0);

and compile again.

(not tested)

CornilleAmandine commented 3 years ago

OK thanks a lot! my best, Amandine

On Sat, 9 Jan 2021 at 13:13, Pierre Lindenbaum notifications@github.com wrote:

yes it's only for diploid. I wrote this program for diploid only. If you want to create a 'fake' diploid.

in https://github.com/lindenb/jvarkit/blob/master/src/main/java/com/github/lindenb/jvarkit/tools/misc/VcfToBam.java#L288 change the lines:

if(alleles.size()!=2) throw new RuntimeException("Not a diploid organism."); Allele allele=null; if(genotype.isPhased()) { allele =alleles.get(g_strand); } else { allele = alleles.get(Math.random()< 0.5?0:1); }

to

Allele allele= alleles.get(0);

and compile again.

(not tested)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lindenb/jvarkit/issues/169#issuecomment-757140740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQO7LYXDXWSMTM22PZKQUGDSZBB63ANCNFSM4V3QF6JA .

--

Chargée de Recherche CNRS Génétique Quantitative et Évolution - Le Moulon Université Paris-Saclay - INRAE - CNRS - AgroParisTech Ferme du Moulon 91190 Gif-sur-Yvette France phone : +33 6 72 44 85 55 phone : +33 1 69 33 23 52

Twitter: @CornilleAmand Google Scholar profile : https://scholar.google.com/citations?user=EqIE2h8AAAAJ&hl=fr Personal page : http://moulon.inrae.fr/personnes/acornille/ Group page: http://moulon.inrae.fr/en/equipes/atip/

On the ESEB-STN network on the ecological genomics of coevolution: https://eseb.org/prizes-funding/special-topic-networks/stn-current-networks/ecological-genomics-of-coevolutionary-interactions/ https://eseb.org/prizes-funding/special-topic-networks/stn-current-networks/ecological-genomics-of-coevolutionary-interactions/ On the wild apple orchard project: https://www.ideev.universite-paris-saclay.fr/en/the-orchard https://www.ideev.universite-paris-saclay.fr/index.php?option=com_content&view=article&id=321:orchard&catid=80&lang=en&Itemid=297

Tout message que j’envoie en dehors des heures de travail réglementaires ne nécessite aucune réponse immédiate