This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert multi-allele to bi-allele

Hi all,

I have a vcf file and several positions have multi-allele like

REF=TTT

ALT=T,TT,TTTT,TTTTT

To my knowledge, rare variant association tools only handle bi-allele sites. But I want to include these positions, too. So I tried to convert these sites into bi-allelic sites like "ins/del".

I used python to create this file, but the converted sites were not supported by association tool.

Does anyone know how to convert multi- to bi-allele?

vcf

In my opinion, we can separate these multi-allelic variants and do the association separately with specific statistic method.

1 answer

I've written a tool VcfMultiToOneAllele http://lindenb.github.io/jvarkit/VcfMultiToOneAllele.html

there's also a tool in GATK: LeftAlignAndTrimVariants https://software.broadinstitute.org/gatk/documentation/tooldocs/current/org_broadinstitute_gatk_tools_walkers_variantutils_LeftAlignAndTrimVariants.php with an option splitMultiallelics

--splitMultiallelics / -split

Split multiallelic records and left-align individual alleles If this argument is set, split multiallelic records and left-align individual alleles. If this argument is not set, multiallelic records are not attempted to left-align and will be copied as is.

UPDATE 2021: use bcftools norm

Thank you. But I don't want to split these sites into multiple sites. I want the number of lines remain same as before. What I want to do finally is association test, but the association tool will handle these multiple variants as independent, though they are actually from same position.

So the result file I want to have from the example above is like REF=Del, ALT=Ins and T,TT,TTT will be coded as Del, and TTTT, TTTTT should be Ins.

Thanks.

For those sites, I want to just remove them.

But for indels, multi-alleles are not caused by noises. So I want to include these sites to association test and I need to simplify them first. Actually I made it with python, but there was something wrong with new vcf file. It seems these newly D/I coded sites are not supported by variant tools, or other tools. These lines were just skipped.

The VcfMultiToOneAllele is giving the following error when I try to use ./gradlew

Downloading https://services.gradle.org/distributions/gradle-6.7-bin.zip

Exception in thread "main" java.net.ConnectException: Connection timed out (Connection timed out)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:284)
        at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:78)
        at org.gradle.wrapper.Download.download(Download.java:63)
        at org.gradle.wrapper.Install$1.call(Install.java:68)
        at org.gradle.wrapper.Install$1.call(Install.java:48)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
        at org.gradle.wrapper.Install.createDist(Install.java:48)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)

Is there a chance to use the tool without gradle?

Is there a chance to use the tool without gradle?

no

Log in to answer this question.