Giter Site home page Giter Site logo

Comments (9)

shenwei356 avatar shenwei356 commented on June 14, 2024 1

#415 (comment)

from seqkit.

shenwei356 avatar shenwei356 commented on June 14, 2024

You can use the option --id-regexp to specify the IDs for matching.

seqkit grep -f nonproductiveIDs.txt nucleotide.fasta -o nonprodnucl.fasta  --id-regexp '^(.+)_frame='

from seqkit.

silvia1234567890 avatar silvia1234567890 commented on June 14, 2024

Hello,
I used that option and I still got this message:

[INFO] 608703 patterns loaded from file

and the file "nonprodnucl.fasta" is empty. Is it okay to use -o for the output files?

Thank you

from seqkit.

shenwei356 avatar shenwei356 commented on June 14, 2024

[INFO] 608703 patterns loaded from file

It just shows how many patterns are loaded.

The key problem is that these patterns have suffixes like _frame=1, which do not exist in the sequence file. So, we need to remove these suffixes before searching.

seqkit grep -f <(perl -pne  's/_frame\=\d+$//' nonproductiveIDs.txt) nucleotide.fasta -o nonprodnucl.fasta

Is it okay to use -o for the output files?

It is.

from seqkit.

silvia1234567890 avatar silvia1234567890 commented on June 14, 2024

Oh, I understand.
I would like to create the IDs.txt with the first 15 characters of the headers, because that sequence is an UMI and it's unique for every sequence. How could I do it?

from seqkit.

shenwei356 avatar shenwei356 commented on June 14, 2024
seqkit seq nonprod_seq.fasta -ni --id-regexp '(^.+?)\|' -o IDs.txt

Or

seqkit seq nonprod_seq.fasta -ni | cut -d '|' -f 1 > IDs.txt

Then you need to add the same --id-regexp '(^.+?)\|' when using seqkit grep, if the format does not change in nucleotide.fasta.

from seqkit.

silvia1234567890 avatar silvia1234567890 commented on June 14, 2024

and to create the IDs.txt with the full header except the _frame= (example) part? How could I do it?

from seqkit.

shenwei356 avatar shenwei356 commented on June 14, 2024

Well, you can just simply combine the methods above.

seqkit seq nonprod_seq.fasta -n | perl -pne  's/_frame\=\d+$//' > IDs.txt

from seqkit.

silvia1234567890 avatar silvia1234567890 commented on June 14, 2024

Hello, I ran this code:
seqkit seq nonproductive_seqs.fasta -ni --id-regexp 's/_frame\=\d+$//' -o IDs.txt
and I'm getting this error:
[ERRO] fastx: regular expression must contain "(" and ")" to capture matched ID. default: ^(\S+)\s?

from seqkit.

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.