Giter VIP home page Giter VIP logo

Comments (4)

esteinig avatar esteinig commented on June 13, 2024

Also on that note is there a function to write the complete read back to file, something like:

for read in fai:
    output.write(str(read))

This will write the sequence, but not the complete read.

from pyfastx.

esteinig avatar esteinig commented on June 13, 2024

Here is simple Python function for now:

def build_read_string(read, fastq: bool = False, comment: str = None):

    """ Build read string from pyfastx read """

    if fastq:
        return f"@{read.name}{' '+comment if comment else ''}" \
            f"\n{read.seq}\n+\n{read.qual}"
    else:
        return f">{read.name}\n{read.seq}"

from pyfastx.

lmdu avatar lmdu commented on June 13, 2024

Good suggestion! In later versions, I will consider adding a ".raw" attribution to read and sequence object to get raw string as it appeared in file. But I am not sure if the read comment is important. In many fastq files, the comment line only contains a '+' char.

from pyfastx.

esteinig avatar esteinig commented on June 13, 2024

Thanks that's great to hear! I was imprecise when I said comment, which was a reference to the pysam comment read attribute, containing the content after the read name. Sometimes it contains useful information, for example when generating Fastq files from nanopore basecalling:

@8dc817b4-9485-4b09-884f-c5b4fd741d75 runid=9e281aa698a86f2cde7f5c6db95cdfa8b3edd3ff read=58861 ch=178 start_time=2019-07-30T21:52:20Z

In this case it would be useful to be able to access the string after the @name from the fields runid to start_time

from pyfastx.

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.