Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:00:45+00:00 2026-06-07T17:00:45+00:00

Basically, I need a script that can solve the problem in very short time.

  • 0

Basically, I need a script that can solve the problem in very short time. I have two files:

$ head -n 6 fcu.tsv

NM576455     0.324009324     0.578896174     2577
NM539570     0.204545455     0.607877092     2247
NM337132     0.288973384     0.673636364     792
NM374379     0.308300395     0.42            762
NM373443     0.263043478     0.547132867     1383
NM371839     0.298210736     0.492857143     1512

$ head -n 6 mart.tsv

NM539570 ILMN_2199362    15      58.52   protein_coding
NM576455 ILMN_2195138    1       65.74   protein_coding  nucleus cellular_component      SAM_2
NM576455 ILMN_2195138    1       65.74   protein_coding  protein binding molecular_function      SAM_2
NM576455 ILMN_1709067    1       65.74   protein_coding  nucleus cellular_component      SAM_2
NM576455 ILMN_1709067    1       65.74   protein_coding  protein binding molecular_function      SAM_2
NM576455 ILMN_2195138    1       65.74   protein_coding  nucleus cellular_component      SAM_type1

We need to append the 2nd, 3rd, and 4th fields of fcu.tsv to mart.tsv for each NM id in very short time.

$ head out.tsv

NM539570 ILMN_2199362    15      58.52   protein_coding  0.204545455     0.607877092     2247
NM576455 ILMN_2195138    1       65.74   protein_coding  nucleus cellular_component      SAM_2 0.324009324   0.578896174     2577
    NM576455 ILMN_2195138    1       65.74   protein_coding  protein binding molecular_function      SAM_2 0.324009324   0.578896174     2577
    NM576455 ILMN_1709067    1       65.74   protein_coding  nucleus cellular_component      SAM_2 0.324009324   0.578896174     2577
    NM576455 ILMN_1709067    1       65.74   protein_coding  protein binding molecular_function      SAM_2 0.324009324   0.578896174     2577
    NM576455 ILMN_2195138    1       65.74   protein_coding  nucleus cellular_component      SAM_type1 0.324009324   0.578896174     2577

This is what I did in matlab (I prefer that solution fix the bad codes here to make it faster rather than writing a new one)

fr1 = fopen('fcu.tsv', 'r');
fr2 = fopen('mart.tsv', 'r');

fw = fopen('out.tsv', 'w');

while feof(fr1) == 0
   line = fgetl(fr1);
   scan = textscan(line, '%s%f%f%d');

   frewind(fr2);

    while feof(fr2) == 0
        line2 = fgetl(fr2);
        scan2 = textscan(line2, '%s%s%s%f%s%s%s%s');

            if scan{1}{1} == scan2{1}{1} 

                fprintf(fw, '%s\t%f\t%f\t%d\n', line2, scan{2}, scan{3}, scan{4});

            end

    end

end

Help is appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:00:47+00:00Added an answer on June 7, 2026 at 5:00 pm

    This is a command-line centric solution, works on any system supporting coreutils, apologies if it is not applicable in your case.

    If mart.tsv was padded properly, as in:

    NM539570 ILMN_2199362    15      58.52   protein_coding  NA      NA                 NA                      NA
    NM576455 ILMN_2195138    1       65.74   protein_coding  nucleus cellular_component NA                      SAM_2
    NM576455 ILMN_2195138    1       65.74   protein_coding  protein binding            molecular_function      SAM_2
    NM576455 ILMN_1709067    1       65.74   protein_coding  nucleus cellular_component NA                      SAM_2
    NM576455 ILMN_1709067    1       65.74   protein_coding  protein binding            molecular_function      SAM_2
    NM576455 ILMN_2195138    1       65.74   protein_coding  nucleus cellular_component NA                      SAM_type1
    

    The solution could be a simple join (see info join):

    $ join <(sort mart.tsv) <(sort fcu.tsv) | column -t
    NM539570  ILMN_2199362  15  58.52  protein_coding  NA       NA                  NA                  NA         0.204545455  0.607877092  2247
    NM576455  ILMN_1709067  1   65.74  protein_coding  nucleus  cellular_component  NA                  SAM_2      0.324009324  0.578896174  2577
    NM576455  ILMN_1709067  1   65.74  protein_coding  protein  binding             molecular_function  SAM_2      0.324009324  0.578896174  2577
    NM576455  ILMN_2195138  1   65.74  protein_coding  nucleus  cellular_component  NA                  SAM_2      0.324009324  0.578896174  2577
    NM576455  ILMN_2195138  1   65.74  protein_coding  nucleus  cellular_component  NA                  SAM_type1  0.324009324  0.578896174  2577
    NM576455  ILMN_2195138  1   65.74  protein_coding  protein  binding             molecular_function  SAM_2      0.324009324  0.578896174  2577
    

    column comes from the bsdmainutils package.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically my problem is that I need to write a script that automatically creates
Basically what I need is an script that, when provided with a time and
Basically I need to create a textarea that is character limited, but will have
have a small javscript that users can include into their sites like so: <script
basically need to change the value that - admin_url() returns any idea?
I am looking for some open source ASP.net script that basically creates an IIS
Sorry the title is very vague. Basically, I'm stuck with something. I have an
I have made a Actions Script 3 code that fetches an image, does an
Basically, what I'm trying to do is simply make a small script that accesses
I am currently writing a script that will basically ‘install’ a codeigniter installation automatically.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.