Skip to content

Commit

Permalink
prefix header print
Browse files Browse the repository at this point in the history
  • Loading branch information
pratas committed Oct 20, 2022
1 parent cfa90d3 commit aa6b8d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pipelines/Simulation.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
#
ITERATIONS=20000;
RATE=0.00005;
ITERATIONS=10000;
RATE=0.0001;
#
rm -f ALL.fa;
#
printf "\n" > DIV;
#
gto_genomic_gen_random_dna -n 2000 -s 7 \
gto_genomic_gen_random_dna -n 5000 -s 7 \
| gto_fasta_from_seq -n "Synthetic DNA" > ORIGINAL.fa
#
cp ORIGINAL.fa IN.fa
Expand Down
1 change: 1 addition & 0 deletions src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ typedef int8_t I8;
#define DEF_NC_LEVEL 11
#define DEF_NC_MIN_THREADS 1
#define DEF_NC_MAX_THREADS 999999
#define HEADERS_PREFIX_SIZE 50

#define DEF_NCD_HELP 0
#define DEF_NCD_FORCE 0
Expand Down
23 changes: 19 additions & 4 deletions src/nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ void NormalizedCompression(NC_PARAMETERS *MAP)

if(P->verbose) fprintf(stderr, "[>] Compressing %s ...\n", !P->dna ?
"DNA" : "Aminoacids");


char identifier_prefix[FA->nReads+1][HEADERS_PREFIX_SIZE+1];
uint32_t idx_header = 0;

while((k = fread(buffer, 1, BUFFER_SIZE, F)))
for(idx = 0 ; idx < k ; ++idx)
{
Expand All @@ -512,17 +515,29 @@ void NormalizedCompression(NC_PARAMETERS *MAP)
continue;
}
if(sym == '\n' && header == 1)
{ header = 0; nSymbols = 0; continue; }
{
header = 0;
nSymbols = 0;
identifier_prefix[idx_reads-1][idx_header] = '\0';
idx_header = 0;
continue;
}
if(sym == '\n') continue;
if(header == 1) continue;
if(header == 1)
{
if(idx_header < HEADERS_PREFIX_SIZE)
identifier_prefix[idx_reads-1][idx_header++] = sym;
continue;
}
SEQ[nSymbols++] = sym;
}

if(!P->dna) vr[idx_reads-1] = CompressTargetRead (SEQ, nSymbols);
else vr[idx_reads-1] = CompressTargetReadAA (SEQ, nSymbols);

for(idx_reads = 0 ; idx_reads < FA->nReads ; ++idx_reads)
fprintf(stdout, "%"PRIu64"\t%lf\n", idx_reads+1, vr[idx_reads]);
fprintf(stdout, "%"PRIu64"\t%lf\t%s\n", idx_reads+1, vr[idx_reads],
identifier_prefix[idx_reads]);

fclose(F);

Expand Down

0 comments on commit aa6b8d6

Please sign in to comment.