Re: [Biopython] pd.df.to_csv(..., compression="bgzip")?
Dan Bolser <[email protected]> Wed, 13 Mar 2024 11:08:20 +0000
| Newsgroups | gmane.comp.python.bio.general |
|---|---|
| Message-ID | <CANs1yPKxW11Shib+DVJ+__BVTv7UVqhWV2pTajGZ3j6rPtY2og@mail.gmail.com> |
--===============0291377357251946784== Content-Type: multipart/alternative; boundary="0000000000009aa045061388cba0" --0000000000009aa045061388cba0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable pandas.to_csv is the function that writes data. pandas.read_csv silently handles decompression as needed. On Wed, Mar 13, 2024, 10:49 AM Peter Cock <[email protected]> wrote= : > Yes. BGZF is just a special kind of GZIP file, if all you are doing is > decompressing it for reading it then the standard gzip.open(...) > is fine. > > Peter > > > On Wed, Mar 13, 2024 at 10:03=E2=80=AFAM Dan Bolser <[email protected]= .uk> > wrote: > >> bgzip is a 'bio' thing, so thought I'd ask here. It's perhaps not >> 'biopython', but it's bio/python. >> >> On Tue, 12 Mar 2024 at 19:11, Sean Brimer <[email protected]> wrote: >> >>> Hi Dan, >>> >>> This feels more like a panda's issue than a biopython issue. That said, >>> I think you could just use gzip. I think. bgzip for samtools was built = on >>> top of gzip so it probably decompresses in a similar way. >>> >>> On Tue, Mar 12, 2024 at 12:52=E2=80=AFPM Dan Bolser <dan.bolser@outsee.= co.uk> >>> wrote: >>> >>>> Hi, >>>> >>>> I can pass `compression=3D"gzip"` to pandas.DataFrame.to_csv, but not >>>> bgzip... how to update pandas to support bgzip? >>>> >>>> >>>> Thanks, >>>> _______________________________________________ >>>> Biopython mailing list - [email protected] >>>> https://mailman.open-bio.org/mailman/listinfo/biopython >>>> >>> _______________________________________________ >> Biopython mailing list - [email protected] >> https://mailman.open-bio.org/mailman/listinfo/biopython >> > --0000000000009aa045061388cba0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">pandas.to_csv is the function that writes data. pandas.re= ad_csv silently handles decompression as needed.<div dir=3D"auto"><br></div= ><div dir=3D"auto"><br></div></div><br><div class=3D"gmail_quote"><div dir= =3D"ltr" class=3D"gmail_attr">On Wed, Mar 13, 2024, 10:49 AM Peter Cock <= ;<a href=3D"mailto:[email protected]">[email protected]</a>= > wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 = 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Y= es. BGZF is just a special kind of GZIP file, if all you are doing is</div>= <div>decompressing it for reading it then the standard gzip.open(...)</div>= <div>is fine.</div><div><br></div><div>Peter<br></div><div><br></div></div>= <br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed= , Mar 13, 2024 at 10:03=E2=80=AFAM Dan Bolser <<a href=3D"mailto:dan.bol= [email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]= .uk</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x"><div dir=3D"ltr">bgzip is a 'bio' thing, so thought I'd ask = here. It's perhaps not 'biopython', but it's bio/python.</d= iv><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On = Tue, 12 Mar 2024 at 19:11, Sean Brimer <<a href=3D"mailto:skbrimer@gmail= .com" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>> wrote= :<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.= 8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"lt= r"><div>Hi Dan, <br></div><div><br></div><div>This feels more like a panda&= #39;s issue than a biopython issue. That said, I think you could just use g= zip. I think. bgzip for samtools was built on top of gzip so it probably de= compresses in a similar way. <br></div></div><br><div class=3D"gmail_quote"= ><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Mar 12, 2024 at 12:52=E2=80= =AFPM Dan Bolser <<a href=3D"mailto:[email protected]" target=3D"_= blank" rel=3D"noreferrer">[email protected]</a>> wrote:<br></div><= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hi,<div><= br></div><div>I can pass `compression=3D"gzip"` to pandas.DataFra= me.to_csv, but not bgzip... how to update pandas to support bgzip?</div><di= v><br></div><div><br></div><div>Thanks,</div></div> _______________________________________________<br> Biopython mailing list=C2=A0 -=C2=A0 <a href=3D"mailto:Biopython@biopython.= org" target=3D"_blank" rel=3D"noreferrer">[email protected]</a><br> <a href=3D"https://mailman.open-bio.org/mailman/listinfo/biopython" rel=3D"= noreferrer noreferrer" target=3D"_blank">https://mailman.open-bio.org/mailm= an/listinfo/biopython</a><br> </blockquote></div> </blockquote></div> _______________________________________________<br> Biopython mailing list=C2=A0 -=C2=A0 <a href=3D"mailto:Biopython@biopython.= org" target=3D"_blank" rel=3D"noreferrer">[email protected]</a><br> <a href=3D"https://mailman.open-bio.org/mailman/listinfo/biopython" rel=3D"= noreferrer noreferrer" target=3D"_blank">https://mailman.open-bio.org/mailm= an/listinfo/biopython</a><br> </blockquote></div> </blockquote></div> --0000000000009aa045061388cba0-- --===============0291377357251946784== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Biopython mailing list - [email protected] https://mailman.open-bio.org/mailman/listinfo/biopython --===============0291377357251946784==--