This is a test version of Biostars. For the public version, visit https://www.biostars.org.
using samtools to verify tabix. Query in python generates error.

I have the following file with index :

-rw-rw-r--  1 ryanicky ryanicky        335M Nov 22 16:15 multiallel.csv.gz drwxrwxrw- 18 ryanicky root            4.0K Nov 22
 16:17 .
 -rw-rw-r--  1 ryanicky ryanicky          70 Nov 22 16:32 multiallel.csv.gz.tbi

When I run the following in python I receive a failure error?

 Traceback (most recent call last):
      File "./LinRegAssociationTest_v3.py", line 154, in <module>
        cis_strs = GetCisSTRs(STRGTFILE, CHROM, start-DISTFROMGENE, end+DISTFROMGENE)
      File "./LinRegAssociationTest_v3.py", line 38, in GetCisSTRs
        records = tb.query(chrom, start-1, end+1)
    tabix.TabixError: query failed

Is there a test I can do at the command line using samtools?

Thanks,

Richard

samtools python tabix

1 answer

You don't need samtools. I would simply query any region that is in the file.

For example do bgzip -c -d multiallel.csv.gz | head and then take the first coordinate. Lets say this is chr1 445566,

then get it via tabix: tabix multiallel.csv.gz chr1:445565-445567

If everything is fine the overlapping entries should be returned.

Log in to answer this question.