diff --git a/bin/accession_id.sh b/bin/accession_id.sh index 87b3b5a4..b9cd3ed7 100755 --- a/bin/accession_id.sh +++ b/bin/accession_id.sh @@ -23,7 +23,8 @@ then helpFunction fi -id=$(echo $GCST|sed 's/GCST/1/g') +ida=$(echo $GCST|sed 's/GCST/1/g') +id=$(($ida-1)) lower=$((10#$id/1000*1000+1)) upper=$(((10#$id/1000+1)*1000)) diff --git a/bin/lib/SumStatRecord.py b/bin/lib/SumStatRecord.py index 80591afb..899dc697 100755 --- a/bin/lib/SumStatRecord.py +++ b/bin/lib/SumStatRecord.py @@ -13,7 +13,7 @@ def __init__(self, chrom, pos, other_al, effect_al, beta, oddsr, self.other_al = other_al self.effect_al = effect_al self.data = data - self.beta = float(beta) if beta is not None else None + self.beta = safe_float(beta) if beta is not None else None self.oddsr = safe_float(oddsr) if oddsr is not None else None self.oddsr_lower = safe_float(oddsr_lower) if oddsr_lower is not None else None self.oddsr_upper = safe_float(oddsr_upper) if oddsr_upper is not None else None @@ -74,8 +74,9 @@ def flip_beta(self): to flipping. """ # Flip beta - if self.beta and self.beta != 0: - self.beta = self.beta * -1 + if self.beta: + if self.beta != 0: + self.beta = self.beta * -1 # Flip OR if self.oddsr: self.oddsr = self.oddsr ** -1 diff --git a/bin/main_pysam.py b/bin/main_pysam.py index 51683d55..bbc236e4 100755 --- a/bin/main_pysam.py +++ b/bin/main_pysam.py @@ -165,9 +165,12 @@ def main(): out_raw["hm_coordinate_conversion"] = ss_rec.data["hm_coordinate_conversion"] out_raw["variant_id"] = vcf_rec.hgvs()[0] if vcf_rec and ss_rec.is_harmonised else args.na_rep_out out_raw["rsid"] = ss_rec.hm_rsid if vcf_rec and ss_rec.is_harmonised else args.na_rep_out - out_raw["standard_error"]=ss_rec.data["standard_error"] if ss_rec.data["standard_error"] is not None else args.na_rep_out + try: + out_raw["standard_error"]=ss_rec.data["standard_error"] if ss_rec.data["standard_error"] is not None else args.na_rep_out + except: + out_raw["standard_error"]=args.na_rep_out # Add other data from summary stat file - outed=["chromosome","base_pair_location","p_value","effect_allele","other_allele","effect_allele_frequency","beta","odds_ratio","standard_error","rsid","ci_upper","ci_lower","hm_coordinate_conversion"] + outed=["chromosome","base_pair_location","p_value","effect_allele","other_allele","effect_allele_frequency","beta","odds_ratio","rsid","standard_error","ci_upper","ci_lower","hm_coordinate_conversion"] for key in ss_rec.data: if key not in outed: value = ss_rec.data[key] if ss_rec.data[key] else args.na_rep_out @@ -262,7 +265,7 @@ def parse_args(): '(b) 0_base '), nargs='?', type=str, - const="1-based") + default="1-based") mode_group.add_argument('--palin_mode', metavar="[infer|forward|reverse|drop]", help=('Mode to use for palindromic variants:\n' '(a) infer strand from effect-allele freq, ' diff --git a/modules/local/harmonization_log.nf b/modules/local/harmonization_log.nf index d436fd84..8672880a 100644 --- a/modules/local/harmonization_log.nf +++ b/modules/local/harmonization_log.nf @@ -35,19 +35,20 @@ process harmonization_log { data_file_name="${GCST}.h.tsv.gz" out_yaml="${GCST}.h.tsv.gz-meta.yaml" data_file_md5sum=\$(md5sum<${launchDir}/$GCST/final/${GCST}.h.tsv.gz | awk '{print \$1}') - date_last_modified=\$(date +"%Y-%m-%d") + date_metadata_last_modified=\$(date +"%Y-%m-%d") harmonisation_reference=\$(tabix -H "${params.ref}/homo_sapiens-${chr}.vcf.gz" | grep reference | cut -f2 -d '=') gwas_metadata.py \ -i $raw_yaml \ -o \$out_yaml \ - --dataFileName \$data_file_name \ + -e \ + --data_file_name \$data_file_name \ --data_file_md5sum \$data_file_md5sum \ --is_harmonised True \ --is_sorted True \ --genome_assembly GRCh38 \ --coordinate_system 1-based \ - --date_last_modified \$date_last_modified \ + --date_metadata_last_modified \$date_metadata_last_modified \ --harmonisation_reference \$harmonisation_reference \ """ } \ No newline at end of file