Skip to content

Commit

Permalink
passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lpantano committed Sep 13, 2024
1 parent c2a5626 commit 8aeb7a5
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 289 deletions.
4 changes: 2 additions & 2 deletions mirtop/gff/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def convert_gff_counts(args):
if extra == "Invalid":
continue
logger.debug("COUNTS::EXTRA:%s" % extra)
cols_variants = [cols_variants] + _expand(extra, True)
#import pdb; pdb.set_trace()
cols_variants = cols_variants + _expand(extra, True)
summary = [UID, Read, mirna, variant] + cols_variants + expression
logger.debug(summary)
all_lines.append(summary)
#import pdb; pdb.set_trace()
df = pd.DataFrame(all_lines, columns = ['UID', 'Read', 'miRNA', 'Variant'] + variant_header + samples)
df = df.drop_duplicates()
df.to_csv(out_file, sep="\t", index=False)
Expand Down
8 changes: 4 additions & 4 deletions mirtop/gff/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ def _add_missing(df):
# ref_miRNA_mean
category = "ref_miRNA_mean"
if sum(df['category']==category) == 0:
df2 = {'category': category, 'sample': df['sample'].iat[0], 'counts': 0}
df = df.append(df2, ignore_index = True)
df2 = pd.DataFrame({'category': category, 'sample': df['sample'].iat[0], 'counts': 0}, index=[0])
df = pd.concat([df, df2], ignore_index = True)

category = "isomiR_sum"
if sum(df['category']==category) == 0:
df2 = {'category': category, 'sample': df['sample'].iat[0], 'counts': 0}
df = df.append(df2, ignore_index = True)
df2 = pd.DataFrame({'category': category, 'sample': df['sample'].iat[0], 'counts': 0}, index=[0])
df = pd.concat([df, df2], ignore_index = True)

return df

Expand Down
4 changes: 2 additions & 2 deletions mirtop/mirna/realign.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from Bio.Align import PairwiseAligner
from Bio import pairwise2
from Bio.Seq import Seq
from collections import defaultdict

Expand Down Expand Up @@ -94,7 +94,7 @@ def formatGFF(self):
value.append("iso_3p:%s%s" % (direction, size))
if not value:
value = ["NA"]
return ",".join(sorted(list(set(value))))
return ",".join(list(set(value)))

def format(self, sep="\t"):
"""Create tabular line from variant fields."""
Expand Down
Loading

0 comments on commit 8aeb7a5

Please sign in to comment.