Indexing a fasta file with FASTX.jl

I have been informed it is possible to use FASTX.jl to index a file. However I am struggling to do this. I think I am meant to use FASTA:Record() but am unsure how to pass the data to the function.

reader = FASTA.Reader(GzipDecompressorStream(open("D:/OneDrive - University of Copenhagen/PhD/Projects/Termite_metagenomes/assembly/small_megahit_final_assembly.fa.gz")))
indexed = FASTA.Record(reader)

ERROR: MethodError: no method matching FASTX.FASTA.Record(::FASTX.FASTA.Reader{TranscodingStreams.TranscodingStream{GzipDecompressor, IOStream}})

By index you mean creating a .fai file ? I don’t think that’s possible with FASTX (see FASTX.jl/index.jl at be4082269bff2a797afe54dd3cd94051ca6affce · BioJulia/FASTX.jl · GitHub).

If you already have an index however you can pass it to Reader :

FASTA.Reader(input::IO; index = nothing)

Not sure how you use it though, or if it works with fastqs.

If you just want to read a Record you can just do :

 record = FASTA.Record()
 read!(reader, record)

See the docs: FASTQ formatted files · FASTX.jl

1 Like