Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rsharris/genodsp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.3+
Choose a base ref
...
head repository: rsharris/genodsp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Apr 30, 2019

  1. added 'actual' denom option for op_sum; bumped subversion to distingu…

    …ish from tagged release
    rsharris committed Apr 30, 2019
    Copy the full SHA
    be4d5de View commit details

Commits on Aug 5, 2019

  1. added --report:bash

    rsharris committed Aug 5, 2019
    Copy the full SHA
    f22e91a View commit details
  2. ()

    rsharris committed Aug 5, 2019
    Copy the full SHA
    14eae3a View commit details
  3. Copy the full SHA
    60b5eab View commit details
  4. ()

    rsharris committed Aug 5, 2019
    Copy the full SHA
    5e7d44e View commit details
  5. added erase command

    rsharris committed Aug 5, 2019
    Copy the full SHA
    da90324 View commit details
  6. Copy the full SHA
    62f70ef View commit details
  7. Copy the full SHA
    ae2f202 View commit details

Commits on Aug 14, 2019

  1. Copy the full SHA
    9b7cf8e View commit details
  2. Copy the full SHA
    816a881 View commit details

Commits on Aug 15, 2019

  1. Copy the full SHA
    3250516 View commit details
  2. Copy the full SHA
    44ae74d View commit details
  3. Copy the full SHA
    e4244b6 View commit details

Commits on Oct 1, 2019

  1. Copy the full SHA
    201b693 View commit details

Commits on Oct 23, 2019

  1. Copy the full SHA
    6145742 View commit details

Commits on Nov 21, 2019

  1. Copy the full SHA
    d8c3e78 View commit details

Commits on Dec 16, 2020

  1. .

    rsharris committed Dec 16, 2020
    Copy the full SHA
    b39a239 View commit details

Commits on Oct 18, 2021

  1. .

    rsharris committed Oct 18, 2021
    Copy the full SHA
    bf75bb4 View commit details

Commits on Nov 5, 2021

  1. .

    rsharris committed Nov 5, 2021
    Copy the full SHA
    5eee5c2 View commit details
  2. .

    rsharris committed Nov 5, 2021
    Copy the full SHA
    9213cdc View commit details

Commits on Jun 15, 2022

  1. added --report=comments

    rsharris committed Jun 15, 2022
    Copy the full SHA
    0521218 View commit details
  2. added --progress=input:<n>

    rsharris committed Jun 15, 2022
    Copy the full SHA
    a36fc67 View commit details
  3. .

    rsharris committed Jun 15, 2022
    Copy the full SHA
    8cc014f View commit details
  4. .

    rsharris committed Jun 15, 2022
    Copy the full SHA
    7cdf317 View commit details
  5. .

    rsharris committed Jun 15, 2022
    Copy the full SHA
    e6e34b3 View commit details

Commits on Jun 16, 2022

  1. .

    rsharris committed Jun 16, 2022
    Copy the full SHA
    0d42d4a View commit details
  2. .

    rsharris committed Jun 16, 2022
    Copy the full SHA
    084c614 View commit details

Commits on Oct 31, 2024

  1. removing hardcoded CC=gcc from Makefile, wrapping strncpy with #pragm…

    …as for gcc
    Richard Burhans committed Oct 31, 2024
    Copy the full SHA
    674a712 View commit details
  2. Merge pull request #1 from richard-burhans/stringop-truncation

    removing hardcoded CC=gcc from Makefile, wrapping strncpy with #pragmas for gcc
    rsharris authored Oct 31, 2024
    Copy the full SHA
    cfd3311 View commit details
Showing with 842 additions and 97 deletions.
  1. +12 −0 .gitignore
  2. +1 −2 Makefile
  3. +0 −1 README.md
  4. +6 −6 add.c
  5. +148 −7 clump.c
  6. +75 −27 genodsp.c
  7. +4 −0 genodsp_interface.h
  8. +7 −6 logical.c
  9. +325 −6 mask.c
  10. +1 −0 mask.h
  11. +14 −14 minmax.c
  12. +118 −6 morphology.c
  13. +6 −6 multiply.c
  14. +20 −1 percentile.c
  15. +37 −12 sum.c
  16. +63 −2 utilities.c
  17. +5 −1 utilities.h
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Compiled source #
###################
*.o
genodsp

# Makefile variants #
###################
Makefile.*

# OS generated files #
######################
.DS_Store
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CFLAGS = -O3 -Wall -Wextra -Werror
CC = gcc
LDLIBS = -lm

operators = sum clump percentile add multiply mask logical minmax morphology map opio variables
@@ -21,7 +20,7 @@ cleano:
rm -f *.o

install:
mv genodsp ${HOME}/${MACHTYPE}/bin
mv genodsp $${HOME}/bin

archive:
rm -f genodsp.tar.gz
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -146,4 +146,3 @@ percentile or better over 100 bp.
= clump --average=percentile99.5 --length=100 \
> clumps.dat


12 changes: 6 additions & 6 deletions add.c
Original file line number Diff line number Diff line change
@@ -197,8 +197,8 @@ void op_add_apply
dspop_add* op = (dspop_add*) _op;
char* filename = op->filename;
FILE* f;
char lineBuffer[1000];
char prevChrom[1000];
char lineBuffer[1001];
char prevChrom[1001];
valtype* v = NULL;
char* chrom;
spec* chromSpec;
@@ -240,7 +240,7 @@ void op_add_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
strncpy (prevChrom, chrom, sizeof(prevChrom));
safe_strncpy (prevChrom, chrom, sizeof(prevChrom)-1);
}

if (chromSpec == NULL) continue;
@@ -490,8 +490,8 @@ void op_subtract_apply
dspop_subtract* op = (dspop_subtract*) _op;
char* filename = op->filename;
FILE* f;
char lineBuffer[1000];
char prevChrom[1000];
char lineBuffer[1001];
char prevChrom[1001];
valtype* v = NULL;
char* chrom;
spec* chromSpec;
@@ -533,7 +533,7 @@ void op_subtract_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
strncpy (prevChrom, chrom, sizeof(prevChrom));
safe_strncpy (prevChrom, chrom, sizeof(prevChrom)-1);
}

if (chromSpec == NULL) continue;
155 changes: 148 additions & 7 deletions clump.c
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ typedef struct dspop_clump
char* averageVarName;
valtype average;
u32 minLength;
double relativeLength; // ratio of minLength to chromosome length
valtype oneVal;
valtype zeroVal;
int debug;
@@ -29,6 +30,7 @@ typedef struct dspop_clump

// prototypes

static void parse_min_length (char* name, char* arg, char*argVal, dspop_clump* op, int maxOk);
static void clump_search (dspop* _op, char* vName, u32 vLen, valtype* v,
int aboveThresh);

@@ -112,6 +114,9 @@ static void op_clump_usage_args (char* name, FILE* f, char* indent)
fprintf (f, "%s (default is 0.0)\n", indent);
fprintf (f, "%s --average=<variable> (T=) get average from named variable\n", indent);
fprintf (f, "%s --length=<length> (L=) minimum length of qualifying interval\n", indent);
fprintf (f, "%s <length> can also be in form <scale>*CL, in\n", indent);
fprintf (f, "%s which case it is relative to the chromosome\n", indent);
fprintf (f, "%s length\n", indent);
fprintf (f, "%s (default is 100)\n", indent);
fprintf (f, "%s --one=<value> (O=) value to fill qualifying intervals\n", indent);
fprintf (f, "%s (default is 1.0)\n", indent);
@@ -127,7 +132,6 @@ dspop* op_clump_parse (char* name, int _argc, char** _argv)
int argc = _argc;
char** argv = _argv;
char* arg, *argVal;
int tempInt;
valtype tempVal;
int haveAverage;

@@ -141,6 +145,7 @@ dspop* op_clump_parse (char* name, int _argc, char** _argv)
op->averageVarName = NULL;
op->average = 0.0;
op->minLength = 100;
op->relativeLength = 0.0;
op->oneVal = 1.0;
op->zeroVal = 0.0;
op->debug = false;
@@ -175,12 +180,7 @@ dspop* op_clump_parse (char* name, int _argc, char** _argv)
|| (strcmp_prefix (arg, "L=") == 0)
|| (strcmp_prefix (arg, "--L=") == 0))
{
tempInt = string_to_unitized_int (argVal, /*thousands*/ true);
if (tempInt == 0)
chastise ("[%s] minimum length can't be zero (\"%s\")\n", name, arg);
if (tempInt < 0)
chastise ("[%s] minimum length can't be negative (\"%s\")\n", name, arg);
op->minLength = (u32) tempInt;
parse_min_length (name, arg, argVal, op, /*maxOK*/true);
goto next_arg;
}

@@ -350,6 +350,139 @@ void op_skimp_apply
arg_dont_complain(valtype* v))
{ clump_search (_op,vName,vLen,v,/*above thresh*/ false); }

//----------
//
// parse_min_length--
// Perform the clump-finding.
//
//----------

static void parse_min_length
(char* name,
char* arg,
char* argVal,
dspop_clump* op,
int maxOk)
{
int tempInt;
dspop_clump tempOp1, tempOp2;

// parse as, e.g., max(CL/3,1000)

if ((maxOk)
&& (strcmp_prefix (argVal, "max(") == 0)
&& (strcmp_suffix (argVal, ")") == 0))
{
char* field1, *field2;

// split into two fields
field1 = copy_string (argVal+strlen("max("));
field1[strlen(field1)-1] = 0;
field2 = strchr(field1,',');
if (field2 == NULL) goto bad_relative_length;
*(field2++) = 0;

// parse the fields
tempOp1.minLength = 0;
tempOp1.relativeLength = 0.0;
parse_min_length (name, arg, field1, &tempOp1, /*maxOK*/false);
tempOp2.minLength = 0;
tempOp2.relativeLength = 0.0;
parse_min_length (name, arg, field2, &tempOp2, /*maxOK*/false);

// make sure one field was relative, the other wasn't
if ((tempOp1.relativeLength > 0) == (tempOp2.relativeLength > 0))
goto bad_relative_length;

if (tempOp1.relativeLength > 0)
{
op->relativeLength = tempOp1.relativeLength;
op->minLength = tempOp2.minLength;
}
else
{
op->relativeLength = tempOp2.relativeLength;
op->minLength = tempOp1.minLength;
}

free (field1);
return;
}

// parse as CL

if (strcmp (argVal, "CL") == 0)
{
op->relativeLength = 1.0;
op->minLength = 0;
return;
}

// parse as, e.g., CL*.50

if (strcmp_prefix (argVal, "CL*") == 0)
{
op->relativeLength = string_to_double(argVal+strlen("CL*"));
if (op->relativeLength <= 0.0) goto relative_length_not_positive;
if (op->relativeLength > 1.0) goto relative_length_too_large;
op->minLength = 0;
return;
}

// parse as, e.g., .50*CL

if (strcmp_suffix (argVal, "*CL") == 0)
{
char* tempStr = copy_string (argVal);
tempStr[strlen(tempStr)-strlen("*CL")] = 0;
op->relativeLength = string_to_double(tempStr);
if (op->relativeLength <= 0.0) goto relative_length_not_positive;
if (op->relativeLength > 1.0) goto relative_length_too_large;
op->minLength = 0;
free(tempStr);
return;
}

// parse as, e.g., CL/3

if (strcmp_prefix (argVal, "CL/") == 0)
{
op->relativeLength = string_to_double(argVal+strlen("CL*"));
if (op->relativeLength < 0.0) goto relative_length_not_positive;
if (op->relativeLength < 1.0) goto relative_length_too_large;
op->relativeLength = 1.0 / op->relativeLength;
op->minLength = 0;
return;
}

// parse as, e.g., 100

tempInt = string_to_unitized_int (argVal, /*thousands*/ true);
if (tempInt == 0)
chastise ("[%s] minimum length can't be zero (\"%s\")\n", name, arg);
if (tempInt < 0)
chastise ("[%s] minimum length can't be negative (\"%s\")\n", name, arg);
op->minLength = (u32) tempInt;
op->relativeLength = 0.0;

return;

bad_relative_length:
fprintf (stderr, "[%s] can't parse relative length (at \"%s\")\n",
name, arg);
exit(EXIT_FAILURE);

relative_length_not_positive:
fprintf (stderr, "[%s] relative length has to be positive (at \"%s\")\n",
name, arg);
exit(EXIT_FAILURE);

relative_length_too_large:
fprintf (stderr, "[%s] relative length can't be more than 1 (at \"%s\")\n",
name, arg);
exit(EXIT_FAILURE);
// (never reaches here)
}

//----------
//
@@ -380,6 +513,14 @@ static void clump_search
u32 start, end, prevStart, prevEnd;
int allMonotonic;

if (op->relativeLength > 0.0)
{
u32 relLength = (u32) (op->relativeLength * vLen);
if (relLength > minLength) minLength = relLength;
if (op->debug)
fprintf (stderr, " vLen=%u minLength=%u\n",vLen,minLength);
}

// if the threshold is a named variable, fetch it now; note that we copy
// the value from the named variable, then destroy our reference to the
// named variable
Loading