Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Compare two files using awk command

    Hi all,

    I am trying to compare two files and get the output: The files are tab separated.

    File1:
    chr12 45677 45999 3000 a b
    chrX 90999 100000 34 c d

    File2:
    chr12 45680 46000 300 d g h k
    chrY 47800 80000 560 l y z m

    I want the all the columns from both files which has:

    The ‪first column should be same‬
    2 col of file 1 < 3col in file 2
    3col in file 1 > 2col in file 2


    I would really appreciate if anyone could help me in this regard ASAP.


    Thanks in advance,

    PS: I tried to use this command but, didn't understand how to change or modify it for my need:

    awk -F"/t" 'NR==FNR{a[$2]=$1FS$3;next} a[$3]{print $0 FS a[$3]}' 2.txt 1.txt > outputfile

  • #2
    Hi,
    Not sure i got it, but my guess is that you are looking for overlapping intervals.. consider BEDtools.

    Comment


    • #3
      I'm also not sure what you're asking here. Do you have an example output?

      for comparing files side-by-side, 'diff -y' is probably better than awk. If you want to join files on a common field, use 'join'. If you just want to combine files so that one file appears to the left of the other, use 'paste'. [all standard Linux commands]

      Comment


      • #4
        Hi anagari,

        I don't know if this is the kind of path you want to go down (non command-line) but galaxy (usegalaxy.org) has built-in tools for finding overlapping intervals as well.

        You can essentially upload your files and then from the tools on the left select Operate on Genomic Intervals -> Intersect

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Recent Advances in Sequencing Analysis Tools
          by seqadmin


          The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
          05-06-2024, 07:48 AM
        • 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

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, Today, 07:03 AM
        0 responses
        12 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-10-2024, 06:35 AM
        0 responses
        32 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-09-2024, 02:46 PM
        0 responses
        41 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-07-2024, 06:57 AM
        0 responses
        35 views
        0 likes
        Last Post seqadmin  
        Working...
        X