Header Leaderboard Ad

Collapse

How can I delete these lines?

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
      How RNA-Seq is Transforming Cancer Studies
      by seqadmin



      Cancer research has been transformed through numerous molecular techniques, with RNA sequencing (RNA-seq) playing a crucial role in understanding the complexity of the disease. Maša Ivin, Ph.D., Scientific Writer at Lexogen, and Yvonne Goepel Ph.D., Product Manager at Lexogen, remarked that “The high-throughput nature of RNA-seq allows for rapid profiling and deep exploration of the transcriptome.” They emphasized its indispensable role in cancer research, aiding in biomarker...
      09-07-2023, 11:15 PM
    • seqadmin
      Methods for Investigating the Transcriptome
      by seqadmin




      Ribonucleic acid (RNA) represents a range of diverse molecules that play a crucial role in many cellular processes. From serving as a protein template to regulating genes, the complex processes involving RNA make it a focal point of study for many scientists. This article will spotlight various methods scientists have developed to investigate different RNA subtypes and the broader transcriptome.

      Whole Transcriptome RNA-seq
      Whole transcriptome sequencing...
      08-31-2023, 11:07 AM

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by seqadmin, Yesterday, 09:05 AM
    0 responses
    12 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 09-21-2023, 06:18 AM
    0 responses
    10 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 09-20-2023, 09:17 AM
    0 responses
    12 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 09-19-2023, 09:23 AM
    0 responses
    27 views
    0 likes
    Last Post seqadmin  
    Working...
    X