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 8144679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:26:59+00:00 2026-06-06T13:26:59+00:00

I’ve tested my program on a dozen Windows machines, a half dozen Macs, and

  • 0

I’ve tested my program on a dozen Windows machines, a half dozen Macs, and a Linux machine and it works without error on both the Windows and Linux but not the Macs. My program is designed to work with protein database files which are text files that range from 250MB to 10GB. I took 1/10th of the 250MB file to make a sample file for debugging purposes but found that the error did not occur with the smaller file.

I’ve narrowed down the bug to this section of code, in this section $tempFile, is the protein database file:

open(ps_file, "..".$slash."dataset".$slash.$tempFile) 
         or die "couldn't open $tempFile";
while(<ps_file>){
    chomp;


    my @curLine = split(/\t/, $_);
    my $filter = 1;
    if($taxon){
        chomp($curLine[2]);

        print "line2 ".$curLine[2].",\t".$taxR{$curLine[2]}."\n";

        $filter = $taxR{$curLine[2]};
    }
    if($filter){
        checkSeq(@curLine);
    }
}

This is a screenshot of the output of that print statement showing special characters:

output of that print statement showing special characters

This is what the output looks like on a Windows Machine:

output looks like on a Windows Machine

Here is an example of 1 line from the $tempFile

>sp|P48255|ABCX_CYAPA Probable ATP-dependent transporter ycf16 OS=Cyanophora paradoxa GN=ycf16 PE=3 SV=1 MSTEKTKILEVKNLKAQVDGTEILKGVNLTINSGEIHAIMGPNGSGKSTFSKILAGHPAYQVTGGEILFKNKNLLELEPEERARAGVFLAFQYPIEIAGVSNIDFLRLAYNNRRKEEGLTELDPLTFYSIVKEKLNVVKMDPHFLNRNVNEGFSGGEKKRNEILQMALLNPSLAILDETDSGLDIDALRIVAEGVNQLSNKENSIILITHYQRLLDYIVPDYIHVMQNGRILKTGGAELAKELEIKGYDWLNELEMVKK CYAPA

  • 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-06T13:27:01+00:00Added an answer on June 6, 2026 at 1:27 pm

    The problem probably lies in inconsistent line-endings. If, as I suspect, trailing whitespace is not significant, you’re better off removing that instead of chomping.

    Also note:

    • Bareword filehandles such as ps_file are package global variables that are subject to action at a distance, use lexical filehandles.

    • Use File::Spec or Path::Class to handle file paths in a platform independent way.

    • Include full file paths and error message if there is an error opening a file.

    • In

      chomp;
      
      my @curLine = split(/\t/, $_);
      my $filter = 1;
      if($taxon){
          chomp($curLine[2]);
      

    $curLine[2] comes from a string that was read in as a line and chomped. I don’t see why you are chomping that again.

    Here’s tidied up version of your code-snippet:

    use File::Spec::Functions qw( catfile );
    
    my $input_file = catfile('..', dataset => $tempFile);
    
    
    open my $ps_file, '<', $input_file
        or die "couldn't open '$input_file': $!";
    
    while (my $line = <$ps_file>) {
        $line =~ s/\s+\z//; # remove all trailing space
    
        my @curLine = split /\t/, $line;
    
        my $filter = 1;
        if ($taxon) {
            my $field = $curLine[2];
            $filter = $taxR{ $field };
    
            print join("\t", "line2 $field", $filter), "\n";
        }
        if ($filter) {
            checkSeq(@curLine);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
I am writing an app with both english and french support. The app requests
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.