Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I delete these lines?

    Hi guys =) I'm sorry if this is a repeat but I haven't been able to find an answer using the search field or google.

    I am trying to edit a fastq file that has a corrupt line. The read in question is VH00362:5:AAAV5KTHV:1:1210:64850:6869 where the read is just a massive repeat – not the expected 110bp. I am trying to remove two lines from this file and asking around I've been told to use `sed` as in

    ```gzip -c file.fastq.gz | sed "45500973,45500974d" > new.fastq.gz```

    but when I run `wc -l ` to check the number of lines the results are incoherent, as if it has deleted much more than the two lines I asked. Another issue that I'm seeing with this file is that every time I run `gzip` I get a `invalid compressed data--format violated` error, which tells me the file is corrupted but I'm doing my best to salvage whatever I can from the file as it is an irreplaceable sample.

    Is there another way to simply delete these two lines? Any tool or command you could recommend? Any help is deeply appreciated.​

  • #2
    Dear Sebastian,

    I see several issues in your post:

    - first of all if you want to remove a entire read from a fastq file, you have to remove 4 lines and not only 2, because the base qualities are also encoded in the file (see here for a description of the fastq format: FASTQ format - Wikipedia​).

    -
    Code:
     gzip -c file
    will compress your file (and keep the original file uncompressed) rather than decompress it, you may want to use
    Code:
     gzip -d file
    or
    Code:
     gunzip file
    to decompress a file. That may be the reason why you get the "compressed data--format violated" error.

    - The 'sed' command should be written with single quotation mark like this:
    Code:
     sed '45500973,45500974d'
    So your editing command might be
    Code:
     sed '45500973,45500976' file.fastq
    - finally, you pipe your 'sed' result directly into a compressed file, with no use of gzip, which will not provide you with a compressed file.
    I would rather perform the decompression and compression steps separately from the editing as the piping can sometimes lead to issues.

    Hope that'll help and good luck!

    Comment

    Latest Articles

    Collapse

    • seqadmin
      Essential Discoveries and Tools in Epitranscriptomics
      by seqadmin




      The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
      04-22-2024, 07:01 AM
    • seqadmin
      Current Approaches to Protein Sequencing
      by seqadmin


      Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
      04-04-2024, 04:25 PM

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by seqadmin, Today, 11:49 AM
    0 responses
    12 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, Yesterday, 08:47 AM
    0 responses
    16 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-11-2024, 12:08 PM
    0 responses
    61 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-10-2024, 10:19 PM
    0 responses
    60 views
    0 likes
    Last Post seqadmin  
    Working...
    X