-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98c3bb2
commit d937905
Showing
7 changed files
with
58 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,43 @@ | ||
def is_single_end(sample, unit): | ||
return pd.isnull(units.loc[(sample, unit), "fq2"]) | ||
|
||
|
||
def get_fastq(wildcards): | ||
return units.loc[(wildcards.sample, wildcards.unit), ["fq1", "fq2"]].dropna() | ||
|
||
|
||
def get_fq(wildcards): | ||
if config["trimming"]["skip"]: | ||
# no trimming, use raw reads | ||
return units.loc[(wildcards.sample, wildcards.unit), ["fq1", "fq2"]].dropna() | ||
else: | ||
# yes trimming, use trimmed data | ||
if not is_single_end(**wildcards): | ||
# paired-end sample | ||
return expand( | ||
"trimmed/{sample}-{unit}.{group}.fastq.gz", group=[1, 2], **wildcards | ||
) | ||
# single end sample | ||
return "trimmed/{sample}-{unit}.fastq.gz".format(**wildcards) | ||
|
||
|
||
def get_strandedness(units): | ||
if "strandedness" in units.columns: | ||
return units["strandedness"].tolist() | ||
else: | ||
strand_list = ["none"] | ||
return strand_list * units.shape[0] | ||
|
||
|
||
def get_deseq2_threads(wildcards=None): | ||
# https://twitter.com/mikelove/status/918770188568363008 | ||
few_coeffs = False if wildcards is None else len(get_contrast(wildcards)) < 10 | ||
return 1 if len(samples) < 100 or few_coeffs else 6 | ||
|
||
|
||
def strip_suffix(pattern, suffix): | ||
return pattern[: -len(suffix)] | ||
|
||
|
||
def get_contrast(wildcards): | ||
return config["diffexp"]["contrasts"][wildcards.contrast] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import sys | ||
# logging | ||
sys.stderr = open(snakemake.log[0], "w") | ||
|
||
import pandas as pd | ||
|
||
def get_column(strandedness): | ||
|