BioJulia / FASTX.jl

Parse and process FASTA and FASTQ formatted files of biological sequences.
https://biojulia.dev
MIT License
61 stars 20 forks source link

subset FASTX.FASTQ.Record #89

Closed Liripo closed 1 year ago

Liripo commented 1 year ago

There does not seem to be a convenient operation to subset the record directly!

julia> FASTX.FASTQ.Record("@name","ATC","!!!")[1:2]
ERROR: MethodError: no method matching getindex(::FASTX.FASTQ.Record, ::UnitRange{Int64})
jakobnissen commented 1 year ago

That's correct. To subset a record, you must construct a new one:

julia> rec = FASTX.FASTQ.Record("@name","ATC","!!!");

julia> FASTQRecord(
           description(rec),
           sequence(rec)[1:2],
           quality(rec)[1:2]
       )
FASTQ.Record:
  description: "@name"
     sequence: "AT"
      quality: "!!"

I could add that - that wouldn't be too hard.

Liripo commented 1 year ago

Thank you for your quick reply! It would be great to add this note to the documentation.