Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.53 KB

README.md

File metadata and controls

60 lines (43 loc) · 1.53 KB

Fastx.cr

test Docs Latest

I hope that in the future this library will be able to read and write FASTA and FASTQ, but currently it can only read FASTA.

NOTE: Currently the standard Crystal library does not open bgzip well; it can only handle gzip files.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      fastx:
        github: kojix2/fastx.cr
  2. Run shards install

Usage

# Create a Reader instance for your FASTA file
reader = Fastx::Fasta::Reader.new("path_to_your_file.fa")

# Go through each sequence in the file
reader.each do |name, sequence|
  puts "Name: #{name}"
  puts "Sequence: #{sequence.to_s}"
end

# Always remember to close the reader
reader.close

High-level API

Fastx.open("path_to_your_file.fa") do |reader|
  reader.as(Fastx::Fasta::Reader) # Necessary in the current situation 
        .each do |name, sequence|
    puts "Name: #{name}"
    puts "Sequence: #{sequence.to_s}"
  end
end

Development

This library is in development.

Contributing

  1. Fork it (https://github.com/kojix2/fastx/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request