<commit_before>#!/usr/bin/perl


use strict;
use File::Basename;

my @suffixlist=(".sam", ".bam", ".bam.bai", ".fastq");
my $frag=$ARGV[0];
my $nuc=180;

open (SAM, "<$ARGV[1]") || die "Could not open $ARGV[0]\n";

my $file=basename($ARGV[1], @suffixlist);

# my $nfr_file=$file."_NFR.sam";
# my $nuc_file=$file."_Nuc.sam";

open (NFR, ">>$ARGV[2]");
open (NUC, ">>$ARGV[3]");
open (OUT, ">>$ARGV[4]");
open (DIST, ">>$ARGV[5]");

while (<SAM>){

	chomp;
	
	if( $_=~/^\@/){
		print NFR $_."\n";
		print NUC $_."\n";
		}
	else {
	
		my @tmp=split(/\t/, $_);
		
		if ($tmp[8] >=0 ){
			print DIST $tmp[8]."\n";
		}
		
		if (abs($tmp[8]) <= $frag){
	
			print NFR $_."\n";
			}
			
		elsif (abs($tmp[8]) >= $nuc) {
			
			print NUC $_."\n";
			}
		
		else {
		
			print OUT $_."\n";
			}
		}
	}<commit_msg>added header printing to left over sam record file<commit_after>#!/usr/bin/perl


use strict;
use File::Basename;

my @suffixlist=(".sam", ".bam", ".bam.bai", ".fastq");
my $frag=$ARGV[0];
my $nuc=180;

open (SAM, "<$ARGV[1]") || die "Could not open $ARGV[0]\n";

my $file=basename($ARGV[1], @suffixlist);

# my $nfr_file=$file."_NFR.sam";
# my $nuc_file=$file."_Nuc.sam";

open (NFR, ">>$ARGV[2]");
open (NUC, ">>$ARGV[3]");
open (OUT, ">>$ARGV[4]");
open (DIST, ">>$ARGV[5]");

while (<SAM>){

	chomp;
	
	if( $_=~/^\@/){
		print NFR $_."\n";
		print NUC $_."\n";
		print OUT $_."\n";
		}
	else {
	
		my @tmp=split(/\t/, $_);
		
		if ($tmp[8] >=0 ){
			print DIST $tmp[8]."\n";
		}
		
		if (abs($tmp[8]) <= $frag){
	
			print NFR $_."\n";
			}
			
		elsif (abs($tmp[8]) >= $nuc) {
			
			print NUC $_."\n";
			}
		
		else {
		
			print OUT $_."\n";
			}
		}
	}
{'fraction_non_alphanumeric': 0.28725961538461536, 'fraction_numerical': 0.019230769230769232, 'mean_word_length': 2.92688679245283, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2184553', 'n_tokens_mistral': 901, 'n_tokens_neox': 778, 'n_words': 163}