Giter Site home page Giter Site logo

Comments (9)

ababaian avatar ababaian commented on August 22, 2024 1

Even simpler version with an open-ended scope for all columns greater then 5.

Robust Nth Column Selection

%YAML 1.2
---
name: faidx
file_extensions: [fa.fai,fasta.fai]
scope: source.faidx

# Fasta Index Filetype Description
# NAME  Name of this reference sequence
# LENGTH  Total length of this reference sequence, in bases
# OFFSET  Offset within the FASTA file of this sequence's first base
# LINEBASES The number of bases on each line
# LINEWIDTH The number of bytes in each line, including the newline

contexts:
  main:
    # COLUMN 1
    - match: '^[\S]*\t'
      scope: coord.Chr.faidx
      push: col2

  col2:
    # COLUMN 2
    - match: '[\S]*'
      scope: coord.Start.faidx
    - match: \t
      push: col3
    - match: $
      pop: true

  col3:
    # COLUMN 3
    - match: '[\S]*'
      scope: constant.numeric.faidx
    - match: \t
      push: col4
    - match: $
      pop: true

  col4:
    # COLUMN 4
    - match: '[\S]*'
      scope: comment.line.faidx
    - match: \t
      push: col5
    - match: $
      pop: true

  col5:
    # COLUMN 5
    - match: '[\S]*'
      scope: comment.line.faidx
    - match: \t
      push: colast
    - match: $
      pop: true

  colast:
    # Any COLUMN >5
    - match: .*
      scope: comment.line.faidx
      pop: true

from biosyntax-archive.

cpan-chu avatar cpan-chu commented on August 22, 2024

This is really cool.

I think it looks pretty robust as it is. Though, would it work for files with >5 columns? Might need to do some figuring out on how to encode the 5th column if there is a 6th column. Maybe something along the lines of '(?<=\t[\S]\t)[\S]\t'?

from biosyntax-archive.

cpan-chu avatar cpan-chu commented on August 22, 2024

brilliant!

from biosyntax-archive.

ababaian avatar ababaian commented on August 22, 2024

I think this same logic could be applied for gedit and Vim syntax as well. There is a Match Start // Match End logic which can be extended in this way. I would say if we figure this out soon we'll simplify our lives greatly.

Maybe read some syntax highlighting files for other complex langauges (C / XML etc...) to learn how other people solved similar problems.

from biosyntax-archive.

Ebedthan avatar Ebedthan commented on August 22, 2024

Can we get a screenshot of what it looks like @ababaian ?

from biosyntax-archive.

ababaian avatar ababaian commented on August 22, 2024

faidx

from biosyntax-archive.

Ebedthan avatar Ebedthan commented on August 22, 2024

Please can you give me the colors you used to do this colors scheme?

from biosyntax-archive.

ababaian avatar ababaian commented on August 22, 2024

I'd say let's not worry 100% about all the color schemes just yet. This was based off of bioMonokai for Sublime which is dark background. Gedit is based off of Kate and is light background so it might not work. The third column is simply the default 'numeric' color, fourth + fifth are comment colored.

We're going to have to formalize all the colors and/or set one dark one light theme to make the same for all the different programs. We can worry about this last; now we need the syntax files to work reliably for all the different software as the highest priority.

from biosyntax-archive.

ababaian avatar ababaian commented on August 22, 2024

Also faidx-gedit syntax

Check out Fasta Index Language File for an example of the logic. It's the same thing as in sublime / less where nested contexts can be used to select by column. This should make SAM/VCF/BED/GTF files much much easier to deal with.

faidx-gedit

from biosyntax-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.