id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
223,000 | kieferk/dfply | dfply/reshape.py | unite | def unite(df, colname, *args, **kwargs):
"""
Does the inverse of `separate`, joining columns together by a specified
separator.
Any columns that are not strings will be converted to strings.
Args:
df (pandas.DataFrame): DataFrame passed in through the pipe.
colname (str): the name ... | python | def unite(df, colname, *args, **kwargs):
"""
Does the inverse of `separate`, joining columns together by a specified
separator.
Any columns that are not strings will be converted to strings.
Args:
df (pandas.DataFrame): DataFrame passed in through the pipe.
colname (str): the name ... | [
"def",
"unite",
"(",
"df",
",",
"colname",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"to_unite",
"=",
"list",
"(",
"[",
"a",
"for",
"a",
"in",
"flatten",
"(",
"args",
")",
"]",
")",
"sep",
"=",
"kwargs",
".",
"get",
"(",
"'sep'",
"... | Does the inverse of `separate`, joining columns together by a specified
separator.
Any columns that are not strings will be converted to strings.
Args:
df (pandas.DataFrame): DataFrame passed in through the pipe.
colname (str): the name of the new joined column.
*args: list of colu... | [
"Does",
"the",
"inverse",
"of",
"separate",
"joining",
"columns",
"together",
"by",
"a",
"specified",
"separator",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/reshape.py#L281-L329 |
223,001 | kieferk/dfply | dfply/set_ops.py | validate_set_ops | def validate_set_ops(df, other):
"""
Helper function to ensure that DataFrames are valid for set operations.
Columns must be the same name in the same order, and indices must be of the
same dimension with the same names.
"""
if df.columns.values.tolist() != other.columns.values.tolist():
... | python | def validate_set_ops(df, other):
"""
Helper function to ensure that DataFrames are valid for set operations.
Columns must be the same name in the same order, and indices must be of the
same dimension with the same names.
"""
if df.columns.values.tolist() != other.columns.values.tolist():
... | [
"def",
"validate_set_ops",
"(",
"df",
",",
"other",
")",
":",
"if",
"df",
".",
"columns",
".",
"values",
".",
"tolist",
"(",
")",
"!=",
"other",
".",
"columns",
".",
"values",
".",
"tolist",
"(",
")",
":",
"not_in_df",
"=",
"[",
"col",
"for",
"col"... | Helper function to ensure that DataFrames are valid for set operations.
Columns must be the same name in the same order, and indices must be of the
same dimension with the same names. | [
"Helper",
"function",
"to",
"ensure",
"that",
"DataFrames",
"are",
"valid",
"for",
"set",
"operations",
".",
"Columns",
"must",
"be",
"the",
"same",
"name",
"in",
"the",
"same",
"order",
"and",
"indices",
"must",
"be",
"of",
"the",
"same",
"dimension",
"wi... | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/set_ops.py#L6-L27 |
223,002 | kieferk/dfply | dfply/set_ops.py | union | def union(df, other, index=False, keep='first'):
"""
Returns rows that appear in either DataFrame.
Args:
df (pandas.DataFrame): data passed in through the pipe.
other (pandas.DataFrame): other DataFrame to use for set operation with
the first.
Kwargs:
index (bool): ... | python | def union(df, other, index=False, keep='first'):
"""
Returns rows that appear in either DataFrame.
Args:
df (pandas.DataFrame): data passed in through the pipe.
other (pandas.DataFrame): other DataFrame to use for set operation with
the first.
Kwargs:
index (bool): ... | [
"def",
"union",
"(",
"df",
",",
"other",
",",
"index",
"=",
"False",
",",
"keep",
"=",
"'first'",
")",
":",
"validate_set_ops",
"(",
"df",
",",
"other",
")",
"stacked",
"=",
"df",
".",
"append",
"(",
"other",
")",
"if",
"index",
":",
"stacked_reset_i... | Returns rows that appear in either DataFrame.
Args:
df (pandas.DataFrame): data passed in through the pipe.
other (pandas.DataFrame): other DataFrame to use for set operation with
the first.
Kwargs:
index (bool): Boolean indicating whether to consider the pandas index
... | [
"Returns",
"rows",
"that",
"appear",
"in",
"either",
"DataFrame",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/set_ops.py#L35-L60 |
223,003 | kieferk/dfply | dfply/set_ops.py | intersect | def intersect(df, other, index=False, keep='first'):
"""
Returns rows that appear in both DataFrames.
Args:
df (pandas.DataFrame): data passed in through the pipe.
other (pandas.DataFrame): other DataFrame to use for set operation with
the first.
Kwargs:
index (bool... | python | def intersect(df, other, index=False, keep='first'):
"""
Returns rows that appear in both DataFrames.
Args:
df (pandas.DataFrame): data passed in through the pipe.
other (pandas.DataFrame): other DataFrame to use for set operation with
the first.
Kwargs:
index (bool... | [
"def",
"intersect",
"(",
"df",
",",
"other",
",",
"index",
"=",
"False",
",",
"keep",
"=",
"'first'",
")",
":",
"validate_set_ops",
"(",
"df",
",",
"other",
")",
"if",
"index",
":",
"df_reset_index",
"=",
"df",
".",
"reset_index",
"(",
")",
"other_rese... | Returns rows that appear in both DataFrames.
Args:
df (pandas.DataFrame): data passed in through the pipe.
other (pandas.DataFrame): other DataFrame to use for set operation with
the first.
Kwargs:
index (bool): Boolean indicating whether to consider the pandas index
... | [
"Returns",
"rows",
"that",
"appear",
"in",
"both",
"DataFrames",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/set_ops.py#L69-L105 |
223,004 | kieferk/dfply | dfply/transform.py | transmute | def transmute(df, *keep_columns, **kwargs):
"""
Creates columns and then returns those new columns and optionally specified
original columns from the DataFrame.
This works like `mutate`, but designed to discard the original columns used
to create the new ones.
Args:
*keep_columns: Colu... | python | def transmute(df, *keep_columns, **kwargs):
"""
Creates columns and then returns those new columns and optionally specified
original columns from the DataFrame.
This works like `mutate`, but designed to discard the original columns used
to create the new ones.
Args:
*keep_columns: Colu... | [
"def",
"transmute",
"(",
"df",
",",
"*",
"keep_columns",
",",
"*",
"*",
"kwargs",
")",
":",
"keep_cols",
"=",
"[",
"]",
"for",
"col",
"in",
"flatten",
"(",
"keep_columns",
")",
":",
"try",
":",
"keep_cols",
".",
"append",
"(",
"col",
".",
"name",
"... | Creates columns and then returns those new columns and optionally specified
original columns from the DataFrame.
This works like `mutate`, but designed to discard the original columns used
to create the new ones.
Args:
*keep_columns: Column labels to keep. Can be string, symbolic, or
... | [
"Creates",
"columns",
"and",
"then",
"returns",
"those",
"new",
"columns",
"and",
"optionally",
"specified",
"original",
"columns",
"from",
"the",
"DataFrame",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/transform.py#L64-L101 |
223,005 | kieferk/dfply | dfply/vector.py | coalesce | def coalesce(*series):
"""
Takes the first non-NaN value in order across the specified series,
returning a new series. Mimics the coalesce function in dplyr and SQL.
Args:
*series: Series objects, typically represented in their symbolic form
(like X.series).
Example:
df... | python | def coalesce(*series):
"""
Takes the first non-NaN value in order across the specified series,
returning a new series. Mimics the coalesce function in dplyr and SQL.
Args:
*series: Series objects, typically represented in their symbolic form
(like X.series).
Example:
df... | [
"def",
"coalesce",
"(",
"*",
"series",
")",
":",
"series",
"=",
"[",
"pd",
".",
"Series",
"(",
"s",
")",
"for",
"s",
"in",
"series",
"]",
"coalescer",
"=",
"pd",
".",
"concat",
"(",
"series",
",",
"axis",
"=",
"1",
")",
"min_nonna",
"=",
"np",
... | Takes the first non-NaN value in order across the specified series,
returning a new series. Mimics the coalesce function in dplyr and SQL.
Args:
*series: Series objects, typically represented in their symbolic form
(like X.series).
Example:
df = pd.DataFrame({
'a':[... | [
"Takes",
"the",
"first",
"non",
"-",
"NaN",
"value",
"in",
"order",
"across",
"the",
"specified",
"series",
"returning",
"a",
"new",
"series",
".",
"Mimics",
"the",
"coalesce",
"function",
"in",
"dplyr",
"and",
"SQL",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/vector.py#L80-L110 |
223,006 | kieferk/dfply | dfply/vector.py | case_when | def case_when(*conditions):
"""
Functions as a switch statement, creating a new series out of logical
conditions specified by 2-item lists where the left-hand item is the
logical condition and the right-hand item is the value where that
condition is true.
Conditions should go from the most spec... | python | def case_when(*conditions):
"""
Functions as a switch statement, creating a new series out of logical
conditions specified by 2-item lists where the left-hand item is the
logical condition and the right-hand item is the value where that
condition is true.
Conditions should go from the most spec... | [
"def",
"case_when",
"(",
"*",
"conditions",
")",
":",
"lengths",
"=",
"[",
"]",
"for",
"logical",
",",
"outcome",
"in",
"conditions",
":",
"if",
"isinstance",
"(",
"logical",
",",
"collections",
".",
"Iterable",
")",
":",
"lengths",
".",
"append",
"(",
... | Functions as a switch statement, creating a new series out of logical
conditions specified by 2-item lists where the left-hand item is the
logical condition and the right-hand item is the value where that
condition is true.
Conditions should go from the most specific to the most general. A
conditio... | [
"Functions",
"as",
"a",
"switch",
"statement",
"creating",
"a",
"new",
"series",
"out",
"of",
"logical",
"conditions",
"specified",
"by",
"2",
"-",
"item",
"lists",
"where",
"the",
"left",
"-",
"hand",
"item",
"is",
"the",
"logical",
"condition",
"and",
"t... | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/vector.py#L118-L189 |
223,007 | kieferk/dfply | dfply/vector.py | if_else | def if_else(condition, when_true, otherwise):
"""
Wraps creation of a series based on if-else conditional logic into a function
call.
Provide a boolean vector condition, value(s) when true, and value(s)
when false, and a vector will be returned the same length as the conditional
vector accordin... | python | def if_else(condition, when_true, otherwise):
"""
Wraps creation of a series based on if-else conditional logic into a function
call.
Provide a boolean vector condition, value(s) when true, and value(s)
when false, and a vector will be returned the same length as the conditional
vector accordin... | [
"def",
"if_else",
"(",
"condition",
",",
"when_true",
",",
"otherwise",
")",
":",
"if",
"not",
"isinstance",
"(",
"when_true",
",",
"collections",
".",
"Iterable",
")",
"or",
"isinstance",
"(",
"when_true",
",",
"str",
")",
":",
"when_true",
"=",
"np",
"... | Wraps creation of a series based on if-else conditional logic into a function
call.
Provide a boolean vector condition, value(s) when true, and value(s)
when false, and a vector will be returned the same length as the conditional
vector according to the logical statement.
Args:
condition: ... | [
"Wraps",
"creation",
"of",
"a",
"series",
"based",
"on",
"if",
"-",
"else",
"conditional",
"logic",
"into",
"a",
"function",
"call",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/vector.py#L197-L231 |
223,008 | kieferk/dfply | dfply/vector.py | na_if | def na_if(series, *values):
"""
If values in a series match a specified value, change them to `np.nan`.
Args:
series: Series or vector, often symbolic.
*values: Value(s) to convert to `np.nan` in the series.
"""
series = pd.Series(series)
series[series.isin(values)] = np.nan
... | python | def na_if(series, *values):
"""
If values in a series match a specified value, change them to `np.nan`.
Args:
series: Series or vector, often symbolic.
*values: Value(s) to convert to `np.nan` in the series.
"""
series = pd.Series(series)
series[series.isin(values)] = np.nan
... | [
"def",
"na_if",
"(",
"series",
",",
"*",
"values",
")",
":",
"series",
"=",
"pd",
".",
"Series",
"(",
"series",
")",
"series",
"[",
"series",
".",
"isin",
"(",
"values",
")",
"]",
"=",
"np",
".",
"nan",
"return",
"series"
] | If values in a series match a specified value, change them to `np.nan`.
Args:
series: Series or vector, often symbolic.
*values: Value(s) to convert to `np.nan` in the series. | [
"If",
"values",
"in",
"a",
"series",
"match",
"a",
"specified",
"value",
"change",
"them",
"to",
"np",
".",
"nan",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/vector.py#L239-L250 |
223,009 | kieferk/dfply | dfply/window_functions.py | between | def between(series, a, b, inclusive=False):
"""
Returns a boolean series specifying whether rows of the input series
are between values `a` and `b`.
Args:
series: column to compare, typically symbolic.
a: value series must be greater than (or equal to if `inclusive=True`)
fo... | python | def between(series, a, b, inclusive=False):
"""
Returns a boolean series specifying whether rows of the input series
are between values `a` and `b`.
Args:
series: column to compare, typically symbolic.
a: value series must be greater than (or equal to if `inclusive=True`)
fo... | [
"def",
"between",
"(",
"series",
",",
"a",
",",
"b",
",",
"inclusive",
"=",
"False",
")",
":",
"if",
"inclusive",
"==",
"True",
":",
"met_condition",
"=",
"(",
"series",
">=",
"a",
")",
"&",
"(",
"series",
"<=",
"b",
")",
"elif",
"inclusive",
"==",... | Returns a boolean series specifying whether rows of the input series
are between values `a` and `b`.
Args:
series: column to compare, typically symbolic.
a: value series must be greater than (or equal to if `inclusive=True`)
for the output series to be `True` at that position.
... | [
"Returns",
"a",
"boolean",
"series",
"specifying",
"whether",
"rows",
"of",
"the",
"input",
"series",
"are",
"between",
"values",
"a",
"and",
"b",
"."
] | 6a858f066602735a90f8b6b85106bc39ceadc282 | https://github.com/kieferk/dfply/blob/6a858f066602735a90f8b6b85106bc39ceadc282/dfply/window_functions.py#L43-L64 |
223,010 | euske/pdfminer | pdfminer/psparser.py | PSBaseParser.seek | def seek(self, pos):
"""Seeks the parser to the given position.
"""
if self.debug:
logging.debug('seek: %r' % pos)
self.fp.seek(pos)
# reset the status for nextline()
self.bufpos = pos
self.buf = b''
self.charpos = 0
# reset the status ... | python | def seek(self, pos):
"""Seeks the parser to the given position.
"""
if self.debug:
logging.debug('seek: %r' % pos)
self.fp.seek(pos)
# reset the status for nextline()
self.bufpos = pos
self.buf = b''
self.charpos = 0
# reset the status ... | [
"def",
"seek",
"(",
"self",
",",
"pos",
")",
":",
"if",
"self",
".",
"debug",
":",
"logging",
".",
"debug",
"(",
"'seek: %r'",
"%",
"pos",
")",
"self",
".",
"fp",
".",
"seek",
"(",
"pos",
")",
"# reset the status for nextline()",
"self",
".",
"bufpos",... | Seeks the parser to the given position. | [
"Seeks",
"the",
"parser",
"to",
"the",
"given",
"position",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/psparser.py#L191-L206 |
223,011 | euske/pdfminer | pdfminer/psparser.py | PSBaseParser.nextline | def nextline(self):
"""Fetches a next line that ends either with \\r or \\n.
"""
linebuf = b''
linepos = self.bufpos + self.charpos
eol = False
while 1:
self.fillbuf()
if eol:
c = self.buf[self.charpos]
# handle b'\r... | python | def nextline(self):
"""Fetches a next line that ends either with \\r or \\n.
"""
linebuf = b''
linepos = self.bufpos + self.charpos
eol = False
while 1:
self.fillbuf()
if eol:
c = self.buf[self.charpos]
# handle b'\r... | [
"def",
"nextline",
"(",
"self",
")",
":",
"linebuf",
"=",
"b''",
"linepos",
"=",
"self",
".",
"bufpos",
"+",
"self",
".",
"charpos",
"eol",
"=",
"False",
"while",
"1",
":",
"self",
".",
"fillbuf",
"(",
")",
"if",
"eol",
":",
"c",
"=",
"self",
"."... | Fetches a next line that ends either with \\r or \\n. | [
"Fetches",
"a",
"next",
"line",
"that",
"ends",
"either",
"with",
"\\\\",
"r",
"or",
"\\\\",
"n",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/psparser.py#L219-L247 |
223,012 | euske/pdfminer | pdfminer/psparser.py | PSBaseParser.revreadlines | def revreadlines(self):
"""Fetches a next line backward.
This is used to locate the trailers at the end of a file.
"""
self.fp.seek(0, 2)
pos = self.fp.tell()
buf = b''
while 0 < pos:
prevpos = pos
pos = max(0, pos-self.BUFSIZ)
... | python | def revreadlines(self):
"""Fetches a next line backward.
This is used to locate the trailers at the end of a file.
"""
self.fp.seek(0, 2)
pos = self.fp.tell()
buf = b''
while 0 < pos:
prevpos = pos
pos = max(0, pos-self.BUFSIZ)
... | [
"def",
"revreadlines",
"(",
"self",
")",
":",
"self",
".",
"fp",
".",
"seek",
"(",
"0",
",",
"2",
")",
"pos",
"=",
"self",
".",
"fp",
".",
"tell",
"(",
")",
"buf",
"=",
"b''",
"while",
"0",
"<",
"pos",
":",
"prevpos",
"=",
"pos",
"pos",
"=",
... | Fetches a next line backward.
This is used to locate the trailers at the end of a file. | [
"Fetches",
"a",
"next",
"line",
"backward",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/psparser.py#L249-L272 |
223,013 | euske/pdfminer | pdfminer/psparser.py | PSStackParser.nextobject | def nextobject(self):
"""Yields a list of objects.
Returns keywords, literals, strings, numbers, arrays and dictionaries.
Arrays and dictionaries are represented as Python lists and dictionaries.
"""
while not self.results:
(pos, token) = self.nexttoken()
... | python | def nextobject(self):
"""Yields a list of objects.
Returns keywords, literals, strings, numbers, arrays and dictionaries.
Arrays and dictionaries are represented as Python lists and dictionaries.
"""
while not self.results:
(pos, token) = self.nexttoken()
... | [
"def",
"nextobject",
"(",
"self",
")",
":",
"while",
"not",
"self",
".",
"results",
":",
"(",
"pos",
",",
"token",
")",
"=",
"self",
".",
"nexttoken",
"(",
")",
"#print (pos,token), (self.curtype, self.curstack)",
"if",
"isinstance",
"(",
"token",
",",
"(",
... | Yields a list of objects.
Returns keywords, literals, strings, numbers, arrays and dictionaries.
Arrays and dictionaries are represented as Python lists and dictionaries. | [
"Yields",
"a",
"list",
"of",
"objects",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/psparser.py#L567-L626 |
223,014 | euske/pdfminer | pdfminer/encodingdb.py | name2unicode | def name2unicode(name):
"""Converts Adobe glyph names to Unicode numbers."""
if name in glyphname2unicode:
return glyphname2unicode[name]
m = STRIP_NAME.search(name)
if not m:
raise KeyError(name)
return unichr(int(m.group(0))) | python | def name2unicode(name):
"""Converts Adobe glyph names to Unicode numbers."""
if name in glyphname2unicode:
return glyphname2unicode[name]
m = STRIP_NAME.search(name)
if not m:
raise KeyError(name)
return unichr(int(m.group(0))) | [
"def",
"name2unicode",
"(",
"name",
")",
":",
"if",
"name",
"in",
"glyphname2unicode",
":",
"return",
"glyphname2unicode",
"[",
"name",
"]",
"m",
"=",
"STRIP_NAME",
".",
"search",
"(",
"name",
")",
"if",
"not",
"m",
":",
"raise",
"KeyError",
"(",
"name",... | Converts Adobe glyph names to Unicode numbers. | [
"Converts",
"Adobe",
"glyph",
"names",
"to",
"Unicode",
"numbers",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/encodingdb.py#L13-L20 |
223,015 | euske/pdfminer | pdfminer/pdftypes.py | resolve1 | def resolve1(x, default=None):
"""Resolves an object.
If this is an array or dictionary, it may still contains
some indirect objects inside.
"""
while isinstance(x, PDFObjRef):
x = x.resolve(default=default)
return x | python | def resolve1(x, default=None):
"""Resolves an object.
If this is an array or dictionary, it may still contains
some indirect objects inside.
"""
while isinstance(x, PDFObjRef):
x = x.resolve(default=default)
return x | [
"def",
"resolve1",
"(",
"x",
",",
"default",
"=",
"None",
")",
":",
"while",
"isinstance",
"(",
"x",
",",
"PDFObjRef",
")",
":",
"x",
"=",
"x",
".",
"resolve",
"(",
"default",
"=",
"default",
")",
"return",
"x"
] | Resolves an object.
If this is an array or dictionary, it may still contains
some indirect objects inside. | [
"Resolves",
"an",
"object",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/pdftypes.py#L73-L81 |
223,016 | euske/pdfminer | pdfminer/pdftypes.py | resolve_all | def resolve_all(x, default=None):
"""Recursively resolves the given object and all the internals.
Make sure there is no indirect reference within the nested object.
This procedure might be slow.
"""
while isinstance(x, PDFObjRef):
x = x.resolve(default=default)
if isinstance(x, list):
... | python | def resolve_all(x, default=None):
"""Recursively resolves the given object and all the internals.
Make sure there is no indirect reference within the nested object.
This procedure might be slow.
"""
while isinstance(x, PDFObjRef):
x = x.resolve(default=default)
if isinstance(x, list):
... | [
"def",
"resolve_all",
"(",
"x",
",",
"default",
"=",
"None",
")",
":",
"while",
"isinstance",
"(",
"x",
",",
"PDFObjRef",
")",
":",
"x",
"=",
"x",
".",
"resolve",
"(",
"default",
"=",
"default",
")",
"if",
"isinstance",
"(",
"x",
",",
"list",
")",
... | Recursively resolves the given object and all the internals.
Make sure there is no indirect reference within the nested object.
This procedure might be slow. | [
"Recursively",
"resolves",
"the",
"given",
"object",
"and",
"all",
"the",
"internals",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/pdftypes.py#L84-L97 |
223,017 | euske/pdfminer | pdfminer/pdftypes.py | decipher_all | def decipher_all(decipher, objid, genno, x):
"""Recursively deciphers the given object.
"""
if isinstance(x, str):
return decipher(objid, genno, x)
if isinstance(x, list):
x = [decipher_all(decipher, objid, genno, v) for v in x]
elif isinstance(x, dict):
for (k, v) in x.iteri... | python | def decipher_all(decipher, objid, genno, x):
"""Recursively deciphers the given object.
"""
if isinstance(x, str):
return decipher(objid, genno, x)
if isinstance(x, list):
x = [decipher_all(decipher, objid, genno, v) for v in x]
elif isinstance(x, dict):
for (k, v) in x.iteri... | [
"def",
"decipher_all",
"(",
"decipher",
",",
"objid",
",",
"genno",
",",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"str",
")",
":",
"return",
"decipher",
"(",
"objid",
",",
"genno",
",",
"x",
")",
"if",
"isinstance",
"(",
"x",
",",
"list",
... | Recursively deciphers the given object. | [
"Recursively",
"deciphers",
"the",
"given",
"object",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/pdftypes.py#L100-L110 |
223,018 | euske/pdfminer | pdfminer/pdfdocument.py | PDFDocument.find_xref | def find_xref(self, parser):
"""Internal function used to locate the first XRef."""
# search the last xref table by scanning the file backwards.
prev = None
for line in parser.revreadlines():
line = line.strip()
if self.debug:
logging.debug('find_x... | python | def find_xref(self, parser):
"""Internal function used to locate the first XRef."""
# search the last xref table by scanning the file backwards.
prev = None
for line in parser.revreadlines():
line = line.strip()
if self.debug:
logging.debug('find_x... | [
"def",
"find_xref",
"(",
"self",
",",
"parser",
")",
":",
"# search the last xref table by scanning the file backwards.",
"prev",
"=",
"None",
"for",
"line",
"in",
"parser",
".",
"revreadlines",
"(",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",... | Internal function used to locate the first XRef. | [
"Internal",
"function",
"used",
"to",
"locate",
"the",
"first",
"XRef",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/pdfdocument.py#L755-L771 |
223,019 | euske/pdfminer | pdfminer/pdfdocument.py | PDFDocument.read_xref_from | def read_xref_from(self, parser, start, xrefs):
"""Reads XRefs from the given location."""
parser.seek(start)
parser.reset()
try:
(pos, token) = parser.nexttoken()
except PSEOF:
raise PDFNoValidXRef('Unexpected EOF')
if self.debug:
logg... | python | def read_xref_from(self, parser, start, xrefs):
"""Reads XRefs from the given location."""
parser.seek(start)
parser.reset()
try:
(pos, token) = parser.nexttoken()
except PSEOF:
raise PDFNoValidXRef('Unexpected EOF')
if self.debug:
logg... | [
"def",
"read_xref_from",
"(",
"self",
",",
"parser",
",",
"start",
",",
"xrefs",
")",
":",
"parser",
".",
"seek",
"(",
"start",
")",
"parser",
".",
"reset",
"(",
")",
"try",
":",
"(",
"pos",
",",
"token",
")",
"=",
"parser",
".",
"nexttoken",
"(",
... | Reads XRefs from the given location. | [
"Reads",
"XRefs",
"from",
"the",
"given",
"location",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/pdfdocument.py#L774-L806 |
223,020 | euske/pdfminer | pdfminer/utils.py | mult_matrix | def mult_matrix(m1, m0):
(a1, b1, c1, d1, e1, f1) = m1
(a0, b0, c0, d0, e0, f0) = m0
"""Returns the multiplication of two matrices."""
return (a0*a1+c0*b1, b0*a1+d0*b1,
a0*c1+c0*d1, b0*c1+d0*d1,
a0*e1+c0*f1+e0, b0*e1+d0*f1+f0) | python | def mult_matrix(m1, m0):
(a1, b1, c1, d1, e1, f1) = m1
(a0, b0, c0, d0, e0, f0) = m0
"""Returns the multiplication of two matrices."""
return (a0*a1+c0*b1, b0*a1+d0*b1,
a0*c1+c0*d1, b0*c1+d0*d1,
a0*e1+c0*f1+e0, b0*e1+d0*f1+f0) | [
"def",
"mult_matrix",
"(",
"m1",
",",
"m0",
")",
":",
"(",
"a1",
",",
"b1",
",",
"c1",
",",
"d1",
",",
"e1",
",",
"f1",
")",
"=",
"m1",
"(",
"a0",
",",
"b0",
",",
"c0",
",",
"d0",
",",
"e0",
",",
"f0",
")",
"=",
"m0",
"return",
"(",
"a0... | Returns the multiplication of two matrices. | [
"Returns",
"the",
"multiplication",
"of",
"two",
"matrices",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L57-L63 |
223,021 | euske/pdfminer | pdfminer/utils.py | uniq | def uniq(objs):
"""Eliminates duplicated elements."""
done = set()
for obj in objs:
if obj in done:
continue
done.add(obj)
yield obj
return | python | def uniq(objs):
"""Eliminates duplicated elements."""
done = set()
for obj in objs:
if obj in done:
continue
done.add(obj)
yield obj
return | [
"def",
"uniq",
"(",
"objs",
")",
":",
"done",
"=",
"set",
"(",
")",
"for",
"obj",
"in",
"objs",
":",
"if",
"obj",
"in",
"done",
":",
"continue",
"done",
".",
"add",
"(",
"obj",
")",
"yield",
"obj",
"return"
] | Eliminates duplicated elements. | [
"Eliminates",
"duplicated",
"elements",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L95-L103 |
223,022 | euske/pdfminer | pdfminer/utils.py | csort | def csort(objs, key):
"""Order-preserving sorting function."""
idxs = dict((obj, i) for (i, obj) in enumerate(objs))
return sorted(objs, key=lambda obj: (key(obj), idxs[obj])) | python | def csort(objs, key):
"""Order-preserving sorting function."""
idxs = dict((obj, i) for (i, obj) in enumerate(objs))
return sorted(objs, key=lambda obj: (key(obj), idxs[obj])) | [
"def",
"csort",
"(",
"objs",
",",
"key",
")",
":",
"idxs",
"=",
"dict",
"(",
"(",
"obj",
",",
"i",
")",
"for",
"(",
"i",
",",
"obj",
")",
"in",
"enumerate",
"(",
"objs",
")",
")",
"return",
"sorted",
"(",
"objs",
",",
"key",
"=",
"lambda",
"o... | Order-preserving sorting function. | [
"Order",
"-",
"preserving",
"sorting",
"function",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L107-L110 |
223,023 | euske/pdfminer | pdfminer/utils.py | fsplit | def fsplit(pred, objs):
"""Split a list into two classes according to the predicate."""
t = []
f = []
for obj in objs:
if pred(obj):
t.append(obj)
else:
f.append(obj)
return (t, f) | python | def fsplit(pred, objs):
"""Split a list into two classes according to the predicate."""
t = []
f = []
for obj in objs:
if pred(obj):
t.append(obj)
else:
f.append(obj)
return (t, f) | [
"def",
"fsplit",
"(",
"pred",
",",
"objs",
")",
":",
"t",
"=",
"[",
"]",
"f",
"=",
"[",
"]",
"for",
"obj",
"in",
"objs",
":",
"if",
"pred",
"(",
"obj",
")",
":",
"t",
".",
"append",
"(",
"obj",
")",
"else",
":",
"f",
".",
"append",
"(",
"... | Split a list into two classes according to the predicate. | [
"Split",
"a",
"list",
"into",
"two",
"classes",
"according",
"to",
"the",
"predicate",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L114-L123 |
223,024 | euske/pdfminer | pdfminer/utils.py | drange | def drange(v0, v1, d):
"""Returns a discrete range."""
assert v0 < v1
return xrange(int(v0)//d, int(v1+d)//d) | python | def drange(v0, v1, d):
"""Returns a discrete range."""
assert v0 < v1
return xrange(int(v0)//d, int(v1+d)//d) | [
"def",
"drange",
"(",
"v0",
",",
"v1",
",",
"d",
")",
":",
"assert",
"v0",
"<",
"v1",
"return",
"xrange",
"(",
"int",
"(",
"v0",
")",
"//",
"d",
",",
"int",
"(",
"v1",
"+",
"d",
")",
"//",
"d",
")"
] | Returns a discrete range. | [
"Returns",
"a",
"discrete",
"range",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L127-L130 |
223,025 | euske/pdfminer | pdfminer/utils.py | get_bound | def get_bound(pts):
"""Compute a minimal rectangle that covers all the points."""
(x0, y0, x1, y1) = (INF, INF, -INF, -INF)
for (x, y) in pts:
x0 = min(x0, x)
y0 = min(y0, y)
x1 = max(x1, x)
y1 = max(y1, y)
return (x0, y0, x1, y1) | python | def get_bound(pts):
"""Compute a minimal rectangle that covers all the points."""
(x0, y0, x1, y1) = (INF, INF, -INF, -INF)
for (x, y) in pts:
x0 = min(x0, x)
y0 = min(y0, y)
x1 = max(x1, x)
y1 = max(y1, y)
return (x0, y0, x1, y1) | [
"def",
"get_bound",
"(",
"pts",
")",
":",
"(",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
")",
"=",
"(",
"INF",
",",
"INF",
",",
"-",
"INF",
",",
"-",
"INF",
")",
"for",
"(",
"x",
",",
"y",
")",
"in",
"pts",
":",
"x0",
"=",
"min",
"(",
"x0"... | Compute a minimal rectangle that covers all the points. | [
"Compute",
"a",
"minimal",
"rectangle",
"that",
"covers",
"all",
"the",
"points",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L134-L142 |
223,026 | euske/pdfminer | pdfminer/utils.py | choplist | def choplist(n, seq):
"""Groups every n elements of the list."""
r = []
for x in seq:
r.append(x)
if len(r) == n:
yield tuple(r)
r = []
return | python | def choplist(n, seq):
"""Groups every n elements of the list."""
r = []
for x in seq:
r.append(x)
if len(r) == n:
yield tuple(r)
r = []
return | [
"def",
"choplist",
"(",
"n",
",",
"seq",
")",
":",
"r",
"=",
"[",
"]",
"for",
"x",
"in",
"seq",
":",
"r",
".",
"append",
"(",
"x",
")",
"if",
"len",
"(",
"r",
")",
"==",
"n",
":",
"yield",
"tuple",
"(",
"r",
")",
"r",
"=",
"[",
"]",
"re... | Groups every n elements of the list. | [
"Groups",
"every",
"n",
"elements",
"of",
"the",
"list",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L157-L165 |
223,027 | euske/pdfminer | pdfminer/utils.py | decode_text | def decode_text(s):
"""Decodes a PDFDocEncoding string to Unicode."""
if s.startswith(b'\xfe\xff'):
return unicode(s[2:], 'utf-16be', 'ignore')
else:
return ''.join(PDFDocEncoding[ord(c)] for c in s) | python | def decode_text(s):
"""Decodes a PDFDocEncoding string to Unicode."""
if s.startswith(b'\xfe\xff'):
return unicode(s[2:], 'utf-16be', 'ignore')
else:
return ''.join(PDFDocEncoding[ord(c)] for c in s) | [
"def",
"decode_text",
"(",
"s",
")",
":",
"if",
"s",
".",
"startswith",
"(",
"b'\\xfe\\xff'",
")",
":",
"return",
"unicode",
"(",
"s",
"[",
"2",
":",
"]",
",",
"'utf-16be'",
",",
"'ignore'",
")",
"else",
":",
"return",
"''",
".",
"join",
"(",
"PDFD... | Decodes a PDFDocEncoding string to Unicode. | [
"Decodes",
"a",
"PDFDocEncoding",
"string",
"to",
"Unicode",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/utils.py#L223-L228 |
223,028 | euske/pdfminer | pdfminer/pdfparser.py | PDFParser.do_keyword | def do_keyword(self, pos, token):
"""Handles PDF-related keywords."""
if token in (self.KEYWORD_XREF, self.KEYWORD_STARTXREF):
self.add_results(*self.pop(1))
elif token is self.KEYWORD_ENDOBJ:
self.add_results(*self.pop(4))
elif token is self.KEYWORD_NULL:
... | python | def do_keyword(self, pos, token):
"""Handles PDF-related keywords."""
if token in (self.KEYWORD_XREF, self.KEYWORD_STARTXREF):
self.add_results(*self.pop(1))
elif token is self.KEYWORD_ENDOBJ:
self.add_results(*self.pop(4))
elif token is self.KEYWORD_NULL:
... | [
"def",
"do_keyword",
"(",
"self",
",",
"pos",
",",
"token",
")",
":",
"if",
"token",
"in",
"(",
"self",
".",
"KEYWORD_XREF",
",",
"self",
".",
"KEYWORD_STARTXREF",
")",
":",
"self",
".",
"add_results",
"(",
"*",
"self",
".",
"pop",
"(",
"1",
")",
"... | Handles PDF-related keywords. | [
"Handles",
"PDF",
"-",
"related",
"keywords",
"."
] | 8150458718e9024c80b00e74965510b20206e588 | https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/pdfparser.py#L60-L133 |
223,029 | eliangcs/http-prompt | http_prompt/execution.py | generate_help_text | def generate_help_text():
"""Return a formatted string listing commands, HTTPie options, and HTTP
actions.
"""
def generate_cmds_with_explanations(summary, cmds):
text = '{0}:\n'.format(summary)
for cmd, explanation in cmds:
text += '\t{0:<10}\t{1:<20}\n'.format(cmd, explanat... | python | def generate_help_text():
"""Return a formatted string listing commands, HTTPie options, and HTTP
actions.
"""
def generate_cmds_with_explanations(summary, cmds):
text = '{0}:\n'.format(summary)
for cmd, explanation in cmds:
text += '\t{0:<10}\t{1:<20}\n'.format(cmd, explanat... | [
"def",
"generate_help_text",
"(",
")",
":",
"def",
"generate_cmds_with_explanations",
"(",
"summary",
",",
"cmds",
")",
":",
"text",
"=",
"'{0}:\\n'",
".",
"format",
"(",
"summary",
")",
"for",
"cmd",
",",
"explanation",
"in",
"cmds",
":",
"text",
"+=",
"'... | Return a formatted string listing commands, HTTPie options, and HTTP
actions. | [
"Return",
"a",
"formatted",
"string",
"listing",
"commands",
"HTTPie",
"options",
"and",
"HTTP",
"actions",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/execution.py#L154-L168 |
223,030 | eliangcs/http-prompt | http_prompt/utils.py | colformat | def colformat(strings, num_sep_spaces=1, terminal_width=None):
"""Format a list of strings like ls does multi-column output."""
if terminal_width is None:
terminal_width = get_terminal_size().columns
if not strings:
return
num_items = len(strings)
max_len = max([len(strip_ansi_esca... | python | def colformat(strings, num_sep_spaces=1, terminal_width=None):
"""Format a list of strings like ls does multi-column output."""
if terminal_width is None:
terminal_width = get_terminal_size().columns
if not strings:
return
num_items = len(strings)
max_len = max([len(strip_ansi_esca... | [
"def",
"colformat",
"(",
"strings",
",",
"num_sep_spaces",
"=",
"1",
",",
"terminal_width",
"=",
"None",
")",
":",
"if",
"terminal_width",
"is",
"None",
":",
"terminal_width",
"=",
"get_terminal_size",
"(",
")",
".",
"columns",
"if",
"not",
"strings",
":",
... | Format a list of strings like ls does multi-column output. | [
"Format",
"a",
"list",
"of",
"strings",
"like",
"ls",
"does",
"multi",
"-",
"column",
"output",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/utils.py#L47-L89 |
223,031 | eliangcs/http-prompt | http_prompt/contextio.py | load_context | def load_context(context, file_path=None):
"""Load a Context object in place from user data directory."""
if not file_path:
file_path = _get_context_filepath()
if os.path.exists(file_path):
with io.open(file_path, encoding='utf-8') as f:
for line in f:
execute(lin... | python | def load_context(context, file_path=None):
"""Load a Context object in place from user data directory."""
if not file_path:
file_path = _get_context_filepath()
if os.path.exists(file_path):
with io.open(file_path, encoding='utf-8') as f:
for line in f:
execute(lin... | [
"def",
"load_context",
"(",
"context",
",",
"file_path",
"=",
"None",
")",
":",
"if",
"not",
"file_path",
":",
"file_path",
"=",
"_get_context_filepath",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"file_path",
")",
":",
"with",
"io",
".",
"... | Load a Context object in place from user data directory. | [
"Load",
"a",
"Context",
"object",
"in",
"place",
"from",
"user",
"data",
"directory",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/contextio.py#L23-L30 |
223,032 | eliangcs/http-prompt | http_prompt/contextio.py | save_context | def save_context(context):
"""Save a Context object to user data directory."""
file_path = _get_context_filepath()
content = format_to_http_prompt(context, excluded_options=EXCLUDED_OPTIONS)
with io.open(file_path, 'w', encoding='utf-8') as f:
f.write(content) | python | def save_context(context):
"""Save a Context object to user data directory."""
file_path = _get_context_filepath()
content = format_to_http_prompt(context, excluded_options=EXCLUDED_OPTIONS)
with io.open(file_path, 'w', encoding='utf-8') as f:
f.write(content) | [
"def",
"save_context",
"(",
"context",
")",
":",
"file_path",
"=",
"_get_context_filepath",
"(",
")",
"content",
"=",
"format_to_http_prompt",
"(",
"context",
",",
"excluded_options",
"=",
"EXCLUDED_OPTIONS",
")",
"with",
"io",
".",
"open",
"(",
"file_path",
","... | Save a Context object to user data directory. | [
"Save",
"a",
"Context",
"object",
"to",
"user",
"data",
"directory",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/contextio.py#L33-L38 |
223,033 | eliangcs/http-prompt | http_prompt/context/transform.py | extract_args_for_httpie_main | def extract_args_for_httpie_main(context, method=None):
"""Transform a Context object to a list of arguments that can be passed to
HTTPie main function.
"""
args = _extract_httpie_options(context)
if method:
args.append(method.upper())
args.append(context.url)
args += _extract_http... | python | def extract_args_for_httpie_main(context, method=None):
"""Transform a Context object to a list of arguments that can be passed to
HTTPie main function.
"""
args = _extract_httpie_options(context)
if method:
args.append(method.upper())
args.append(context.url)
args += _extract_http... | [
"def",
"extract_args_for_httpie_main",
"(",
"context",
",",
"method",
"=",
"None",
")",
":",
"args",
"=",
"_extract_httpie_options",
"(",
"context",
")",
"if",
"method",
":",
"args",
".",
"append",
"(",
"method",
".",
"upper",
"(",
")",
")",
"args",
".",
... | Transform a Context object to a list of arguments that can be passed to
HTTPie main function. | [
"Transform",
"a",
"Context",
"object",
"to",
"a",
"list",
"of",
"arguments",
"that",
"can",
"be",
"passed",
"to",
"HTTPie",
"main",
"function",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/context/transform.py#L73-L84 |
223,034 | eliangcs/http-prompt | http_prompt/context/transform.py | format_to_httpie | def format_to_httpie(context, method=None):
"""Format a Context object to an HTTPie command."""
cmd = ['http'] + _extract_httpie_options(context, quote=True,
join_key_value=True)
if method:
cmd.append(method.upper())
cmd.append(context.url)
cmd +=... | python | def format_to_httpie(context, method=None):
"""Format a Context object to an HTTPie command."""
cmd = ['http'] + _extract_httpie_options(context, quote=True,
join_key_value=True)
if method:
cmd.append(method.upper())
cmd.append(context.url)
cmd +=... | [
"def",
"format_to_httpie",
"(",
"context",
",",
"method",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'http'",
"]",
"+",
"_extract_httpie_options",
"(",
"context",
",",
"quote",
"=",
"True",
",",
"join_key_value",
"=",
"True",
")",
"if",
"method",
":",
"cmd... | Format a Context object to an HTTPie command. | [
"Format",
"a",
"Context",
"object",
"to",
"an",
"HTTPie",
"command",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/context/transform.py#L97-L105 |
223,035 | eliangcs/http-prompt | http_prompt/context/transform.py | format_to_http_prompt | def format_to_http_prompt(context, excluded_options=None):
"""Format a Context object to HTTP Prompt commands."""
cmds = _extract_httpie_options(context, quote=True, join_key_value=True,
excluded_keys=excluded_options)
cmds.append('cd ' + smart_quote(context.url))
cmds... | python | def format_to_http_prompt(context, excluded_options=None):
"""Format a Context object to HTTP Prompt commands."""
cmds = _extract_httpie_options(context, quote=True, join_key_value=True,
excluded_keys=excluded_options)
cmds.append('cd ' + smart_quote(context.url))
cmds... | [
"def",
"format_to_http_prompt",
"(",
"context",
",",
"excluded_options",
"=",
"None",
")",
":",
"cmds",
"=",
"_extract_httpie_options",
"(",
"context",
",",
"quote",
"=",
"True",
",",
"join_key_value",
"=",
"True",
",",
"excluded_keys",
"=",
"excluded_options",
... | Format a Context object to HTTP Prompt commands. | [
"Format",
"a",
"Context",
"object",
"to",
"HTTP",
"Prompt",
"commands",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/context/transform.py#L108-L114 |
223,036 | eliangcs/http-prompt | http_prompt/config.py | initialize | def initialize():
"""Initialize a default config file if it doesn't exist yet.
Returns:
tuple: A tuple of (copied, dst_path). `copied` is a bool indicating if
this function created the default config file. `dst_path` is the
path of the user config file.
"""
dst_path = ge... | python | def initialize():
"""Initialize a default config file if it doesn't exist yet.
Returns:
tuple: A tuple of (copied, dst_path). `copied` is a bool indicating if
this function created the default config file. `dst_path` is the
path of the user config file.
"""
dst_path = ge... | [
"def",
"initialize",
"(",
")",
":",
"dst_path",
"=",
"get_user_config_path",
"(",
")",
"copied",
"=",
"False",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dst_path",
")",
":",
"src_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
... | Initialize a default config file if it doesn't exist yet.
Returns:
tuple: A tuple of (copied, dst_path). `copied` is a bool indicating if
this function created the default config file. `dst_path` is the
path of the user config file. | [
"Initialize",
"a",
"default",
"config",
"file",
"if",
"it",
"doesn",
"t",
"exist",
"yet",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/config.py#L17-L31 |
223,037 | eliangcs/http-prompt | http_prompt/config.py | load_user | def load_user():
"""Read user config file and return it as a dict."""
config_path = get_user_config_path()
config = {}
# TODO: This may be overkill and too slow just for reading a config file
with open(config_path) as f:
code = compile(f.read(), config_path, 'exec')
exec(code, config)
... | python | def load_user():
"""Read user config file and return it as a dict."""
config_path = get_user_config_path()
config = {}
# TODO: This may be overkill and too slow just for reading a config file
with open(config_path) as f:
code = compile(f.read(), config_path, 'exec')
exec(code, config)
... | [
"def",
"load_user",
"(",
")",
":",
"config_path",
"=",
"get_user_config_path",
"(",
")",
"config",
"=",
"{",
"}",
"# TODO: This may be overkill and too slow just for reading a config file",
"with",
"open",
"(",
"config_path",
")",
"as",
"f",
":",
"code",
"=",
"compi... | Read user config file and return it as a dict. | [
"Read",
"user",
"config",
"file",
"and",
"return",
"it",
"as",
"a",
"dict",
"."
] | 189321f25e3526fa1b79a9dc38c317892c478986 | https://github.com/eliangcs/http-prompt/blob/189321f25e3526fa1b79a9dc38c317892c478986/http_prompt/config.py#L48-L63 |
223,038 | bcbio/bcbio-nextgen | bcbio/bam/fastq.py | filter_single_reads_by_length | def filter_single_reads_by_length(in_file, quality_format, min_length=20,
out_file=None):
"""
removes reads from a fastq file which are shorter than a minimum
length
"""
logger.info("Removing reads in %s thare are less than %d bases."
% (in_file, mi... | python | def filter_single_reads_by_length(in_file, quality_format, min_length=20,
out_file=None):
"""
removes reads from a fastq file which are shorter than a minimum
length
"""
logger.info("Removing reads in %s thare are less than %d bases."
% (in_file, mi... | [
"def",
"filter_single_reads_by_length",
"(",
"in_file",
",",
"quality_format",
",",
"min_length",
"=",
"20",
",",
"out_file",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"\"Removing reads in %s thare are less than %d bases.\"",
"%",
"(",
"in_file",
",",
"min_... | removes reads from a fastq file which are shorter than a minimum
length | [
"removes",
"reads",
"from",
"a",
"fastq",
"file",
"which",
"are",
"shorter",
"than",
"a",
"minimum",
"length"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fastq.py#L40-L55 |
223,039 | bcbio/bcbio-nextgen | bcbio/bam/fastq.py | filter_reads_by_length | def filter_reads_by_length(fq1, fq2, quality_format, min_length=20):
"""
removes reads from a pair of fastq files that are shorter than
a minimum length. removes both ends of a read if one end falls
below the threshold while maintaining the order of the reads
"""
logger.info("Removing reads in... | python | def filter_reads_by_length(fq1, fq2, quality_format, min_length=20):
"""
removes reads from a pair of fastq files that are shorter than
a minimum length. removes both ends of a read if one end falls
below the threshold while maintaining the order of the reads
"""
logger.info("Removing reads in... | [
"def",
"filter_reads_by_length",
"(",
"fq1",
",",
"fq2",
",",
"quality_format",
",",
"min_length",
"=",
"20",
")",
":",
"logger",
".",
"info",
"(",
"\"Removing reads in %s and %s that \"",
"\"are less than %d bases.\"",
"%",
"(",
"fq1",
",",
"fq2",
",",
"min_lengt... | removes reads from a pair of fastq files that are shorter than
a minimum length. removes both ends of a read if one end falls
below the threshold while maintaining the order of the reads | [
"removes",
"reads",
"from",
"a",
"pair",
"of",
"fastq",
"files",
"that",
"are",
"shorter",
"than",
"a",
"minimum",
"length",
".",
"removes",
"both",
"ends",
"of",
"a",
"read",
"if",
"one",
"end",
"falls",
"below",
"the",
"threshold",
"while",
"maintaining"... | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fastq.py#L57-L99 |
223,040 | bcbio/bcbio-nextgen | bcbio/bam/fastq.py | rstrip_extra | def rstrip_extra(fname):
"""Strip extraneous, non-discriminative filename info from the end of a file.
"""
to_strip = ("_R", ".R", "-R", "_", "fastq", ".", "-")
while fname.endswith(to_strip):
for x in to_strip:
if fname.endswith(x):
fname = fname[:len(fname) - len(x)... | python | def rstrip_extra(fname):
"""Strip extraneous, non-discriminative filename info from the end of a file.
"""
to_strip = ("_R", ".R", "-R", "_", "fastq", ".", "-")
while fname.endswith(to_strip):
for x in to_strip:
if fname.endswith(x):
fname = fname[:len(fname) - len(x)... | [
"def",
"rstrip_extra",
"(",
"fname",
")",
":",
"to_strip",
"=",
"(",
"\"_R\"",
",",
"\".R\"",
",",
"\"-R\"",
",",
"\"_\"",
",",
"\"fastq\"",
",",
"\".\"",
",",
"\"-\"",
")",
"while",
"fname",
".",
"endswith",
"(",
"to_strip",
")",
":",
"for",
"x",
"i... | Strip extraneous, non-discriminative filename info from the end of a file. | [
"Strip",
"extraneous",
"non",
"-",
"discriminative",
"filename",
"info",
"from",
"the",
"end",
"of",
"a",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fastq.py#L101-L110 |
223,041 | bcbio/bcbio-nextgen | bcbio/bam/fastq.py | fast_combine_pairs | def fast_combine_pairs(files, force_single, full_name, separators):
"""
assume files that need to be paired are within 10 entries of each other, once the list is sorted
"""
files = sort_filenames(files)
chunks = tz.sliding_window(10, files)
pairs = [combine_pairs(chunk, force_single, full_name, ... | python | def fast_combine_pairs(files, force_single, full_name, separators):
"""
assume files that need to be paired are within 10 entries of each other, once the list is sorted
"""
files = sort_filenames(files)
chunks = tz.sliding_window(10, files)
pairs = [combine_pairs(chunk, force_single, full_name, ... | [
"def",
"fast_combine_pairs",
"(",
"files",
",",
"force_single",
",",
"full_name",
",",
"separators",
")",
":",
"files",
"=",
"sort_filenames",
"(",
"files",
")",
"chunks",
"=",
"tz",
".",
"sliding_window",
"(",
"10",
",",
"files",
")",
"pairs",
"=",
"[",
... | assume files that need to be paired are within 10 entries of each other, once the list is sorted | [
"assume",
"files",
"that",
"need",
"to",
"be",
"paired",
"are",
"within",
"10",
"entries",
"of",
"each",
"other",
"once",
"the",
"list",
"is",
"sorted"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fastq.py#L187-L204 |
223,042 | bcbio/bcbio-nextgen | bcbio/bam/fastq.py | open_fastq | def open_fastq(in_file):
""" open a fastq file, using gzip if it is gzipped
"""
if objectstore.is_remote(in_file):
return objectstore.open_file(in_file)
else:
return utils.open_gzipsafe(in_file) | python | def open_fastq(in_file):
""" open a fastq file, using gzip if it is gzipped
"""
if objectstore.is_remote(in_file):
return objectstore.open_file(in_file)
else:
return utils.open_gzipsafe(in_file) | [
"def",
"open_fastq",
"(",
"in_file",
")",
":",
"if",
"objectstore",
".",
"is_remote",
"(",
"in_file",
")",
":",
"return",
"objectstore",
".",
"open_file",
"(",
"in_file",
")",
"else",
":",
"return",
"utils",
".",
"open_gzipsafe",
"(",
"in_file",
")"
] | open a fastq file, using gzip if it is gzipped | [
"open",
"a",
"fastq",
"file",
"using",
"gzip",
"if",
"it",
"is",
"gzipped"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/fastq.py#L309-L315 |
223,043 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | get_region_bed | def get_region_bed(region, items, out_file, want_gzip=True):
"""Retrieve BED file of regions to analyze, either single or multi-region.
"""
variant_regions = bedutils.population_variant_regions(items, merged=True)
target = shared.subset_variant_regions(variant_regions, region, out_file, items)
if no... | python | def get_region_bed(region, items, out_file, want_gzip=True):
"""Retrieve BED file of regions to analyze, either single or multi-region.
"""
variant_regions = bedutils.population_variant_regions(items, merged=True)
target = shared.subset_variant_regions(variant_regions, region, out_file, items)
if no... | [
"def",
"get_region_bed",
"(",
"region",
",",
"items",
",",
"out_file",
",",
"want_gzip",
"=",
"True",
")",
":",
"variant_regions",
"=",
"bedutils",
".",
"population_variant_regions",
"(",
"items",
",",
"merged",
"=",
"True",
")",
"target",
"=",
"shared",
"."... | Retrieve BED file of regions to analyze, either single or multi-region. | [
"Retrieve",
"BED",
"file",
"of",
"regions",
"to",
"analyze",
"either",
"single",
"or",
"multi",
"-",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L36-L52 |
223,044 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | coverage_interval_from_bed | def coverage_interval_from_bed(bed_file, per_chrom=True):
"""Calculate a coverage interval for the current region BED.
This helps correctly work with cases of uneven coverage across an analysis
genome. strelka2 and other model based callers have flags for targeted and non
which depend on the local cont... | python | def coverage_interval_from_bed(bed_file, per_chrom=True):
"""Calculate a coverage interval for the current region BED.
This helps correctly work with cases of uneven coverage across an analysis
genome. strelka2 and other model based callers have flags for targeted and non
which depend on the local cont... | [
"def",
"coverage_interval_from_bed",
"(",
"bed_file",
",",
"per_chrom",
"=",
"True",
")",
":",
"total_starts",
"=",
"{",
"}",
"total_ends",
"=",
"{",
"}",
"bed_bases",
"=",
"collections",
".",
"defaultdict",
"(",
"int",
")",
"with",
"utils",
".",
"open_gzips... | Calculate a coverage interval for the current region BED.
This helps correctly work with cases of uneven coverage across an analysis
genome. strelka2 and other model based callers have flags for targeted and non
which depend on the local context.
Checks coverage per chromosome, avoiding non-standard c... | [
"Calculate",
"a",
"coverage",
"interval",
"for",
"the",
"current",
"region",
"BED",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L54-L93 |
223,045 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | _is_targeted_region | def _is_targeted_region(cur_bed, data):
"""Calculate if we should process region as a targeted or WGS.
Currently always based on total coverage interval, as that validates best and
is consistent between CWL (larger blocks) and non-CWL runs (smaller blocks).
We can check core usage and provide a consist... | python | def _is_targeted_region(cur_bed, data):
"""Calculate if we should process region as a targeted or WGS.
Currently always based on total coverage interval, as that validates best and
is consistent between CWL (larger blocks) and non-CWL runs (smaller blocks).
We can check core usage and provide a consist... | [
"def",
"_is_targeted_region",
"(",
"cur_bed",
",",
"data",
")",
":",
"cores",
"=",
"dd",
".",
"get_num_cores",
"(",
"data",
")",
"if",
"cores",
">",
"0",
":",
"# Apply to all core setups now for consistency",
"return",
"dd",
".",
"get_coverage_interval",
"(",
"d... | Calculate if we should process region as a targeted or WGS.
Currently always based on total coverage interval, as that validates best and
is consistent between CWL (larger blocks) and non-CWL runs (smaller blocks).
We can check core usage and provide a consistent report when moving to CWL
exclusively. | [
"Calculate",
"if",
"we",
"should",
"process",
"region",
"as",
"a",
"targeted",
"or",
"WGS",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L95-L107 |
223,046 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | _postprocess_somatic | def _postprocess_somatic(in_file, paired):
"""Post-process somatic calls to provide standard output.
- Converts SGT and NT into standard VCF GT fields
- Replace generic TUMOR NORMAL names in VCF with sample names.
"""
out_file = in_file.replace(".vcf.gz", "-fixed.vcf")
if not utils.file_exists(... | python | def _postprocess_somatic(in_file, paired):
"""Post-process somatic calls to provide standard output.
- Converts SGT and NT into standard VCF GT fields
- Replace generic TUMOR NORMAL names in VCF with sample names.
"""
out_file = in_file.replace(".vcf.gz", "-fixed.vcf")
if not utils.file_exists(... | [
"def",
"_postprocess_somatic",
"(",
"in_file",
",",
"paired",
")",
":",
"out_file",
"=",
"in_file",
".",
"replace",
"(",
"\".vcf.gz\"",
",",
"\"-fixed.vcf\"",
")",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
"and",
"not",
"utils",
".",
... | Post-process somatic calls to provide standard output.
- Converts SGT and NT into standard VCF GT fields
- Replace generic TUMOR NORMAL names in VCF with sample names. | [
"Post",
"-",
"process",
"somatic",
"calls",
"to",
"provide",
"standard",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L272-L307 |
223,047 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | _run_workflow | def _run_workflow(data, workflow_file, work_dir):
"""Run Strelka2 analysis inside prepared workflow directory.
"""
utils.remove_safe(os.path.join(work_dir, "workspace"))
cmd = [utils.get_program_python("configureStrelkaGermlineWorkflow.py"),
workflow_file, "-m", "local", "-j", dd.get_num_core... | python | def _run_workflow(data, workflow_file, work_dir):
"""Run Strelka2 analysis inside prepared workflow directory.
"""
utils.remove_safe(os.path.join(work_dir, "workspace"))
cmd = [utils.get_program_python("configureStrelkaGermlineWorkflow.py"),
workflow_file, "-m", "local", "-j", dd.get_num_core... | [
"def",
"_run_workflow",
"(",
"data",
",",
"workflow_file",
",",
"work_dir",
")",
":",
"utils",
".",
"remove_safe",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"workspace\"",
")",
")",
"cmd",
"=",
"[",
"utils",
".",
"get_program_python",
... | Run Strelka2 analysis inside prepared workflow directory. | [
"Run",
"Strelka2",
"analysis",
"inside",
"prepared",
"workflow",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L320-L327 |
223,048 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | run_gvcfgenotyper | def run_gvcfgenotyper(data, orig_region, vrn_files, out_file):
"""Merge strelka2 and Illumina compatible gVCFs with gvcfgenotyper.
https://github.com/Illumina/gvcfgenotyper
Also need to explore GLnexus (https://github.com/dnanexus-rnd/GLnexus)
"""
if not utils.file_exists(out_file):
with f... | python | def run_gvcfgenotyper(data, orig_region, vrn_files, out_file):
"""Merge strelka2 and Illumina compatible gVCFs with gvcfgenotyper.
https://github.com/Illumina/gvcfgenotyper
Also need to explore GLnexus (https://github.com/dnanexus-rnd/GLnexus)
"""
if not utils.file_exists(out_file):
with f... | [
"def",
"run_gvcfgenotyper",
"(",
"data",
",",
"orig_region",
",",
"vrn_files",
",",
"out_file",
")",
":",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",... | Merge strelka2 and Illumina compatible gVCFs with gvcfgenotyper.
https://github.com/Illumina/gvcfgenotyper
Also need to explore GLnexus (https://github.com/dnanexus-rnd/GLnexus) | [
"Merge",
"strelka2",
"and",
"Illumina",
"compatible",
"gVCFs",
"with",
"gvcfgenotyper",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L331-L351 |
223,049 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | _run_gvcfgenotyper | def _run_gvcfgenotyper(data, region, vrn_files, out_file):
"""Run gvcfgenotyper on a single gVCF region in input file.
"""
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
input_file = "%s-inputs.txt" % utils.splitext_plus(tx_out_file)[0]
... | python | def _run_gvcfgenotyper(data, region, vrn_files, out_file):
"""Run gvcfgenotyper on a single gVCF region in input file.
"""
if not utils.file_exists(out_file):
with file_transaction(data, out_file) as tx_out_file:
input_file = "%s-inputs.txt" % utils.splitext_plus(tx_out_file)[0]
... | [
"def",
"_run_gvcfgenotyper",
"(",
"data",
",",
"region",
",",
"vrn_files",
",",
"out_file",
")",
":",
"if",
"not",
"utils",
".",
"file_exists",
"(",
"out_file",
")",
":",
"with",
"file_transaction",
"(",
"data",
",",
"out_file",
")",
"as",
"tx_out_file",
"... | Run gvcfgenotyper on a single gVCF region in input file. | [
"Run",
"gvcfgenotyper",
"on",
"a",
"single",
"gVCF",
"region",
"in",
"input",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L353-L364 |
223,050 | bcbio/bcbio-nextgen | bcbio/variation/strelka2.py | _find_gvcf_blocks | def _find_gvcf_blocks(vcf_file, region, tmp_dir):
"""Retrieve gVCF blocks within our current evaluation region.
gvcfgenotyper does not support calling larger regions with individual
coverage blocks, so we split our big region into potentially multiple.
"""
region_file = os.path.join(tmp_dir, "cur_r... | python | def _find_gvcf_blocks(vcf_file, region, tmp_dir):
"""Retrieve gVCF blocks within our current evaluation region.
gvcfgenotyper does not support calling larger regions with individual
coverage blocks, so we split our big region into potentially multiple.
"""
region_file = os.path.join(tmp_dir, "cur_r... | [
"def",
"_find_gvcf_blocks",
"(",
"vcf_file",
",",
"region",
",",
"tmp_dir",
")",
":",
"region_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmp_dir",
",",
"\"cur_region.bed\"",
")",
"with",
"open",
"(",
"region_file",
",",
"\"w\"",
")",
"as",
"out_hand... | Retrieve gVCF blocks within our current evaluation region.
gvcfgenotyper does not support calling larger regions with individual
coverage blocks, so we split our big region into potentially multiple. | [
"Retrieve",
"gVCF",
"blocks",
"within",
"our",
"current",
"evaluation",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/strelka2.py#L366-L385 |
223,051 | bcbio/bcbio-nextgen | bcbio/hla/__init__.py | run | def run(samples, run_parallel):
"""Run HLA detection on the input samples.
"""
to_process = []
extras = []
for data in (xs[0] for xs in samples):
hlacaller = tz.get_in(["config", "algorithm", "hlacaller"], data)
if hlacaller:
to_process.append(data)
else:
... | python | def run(samples, run_parallel):
"""Run HLA detection on the input samples.
"""
to_process = []
extras = []
for data in (xs[0] for xs in samples):
hlacaller = tz.get_in(["config", "algorithm", "hlacaller"], data)
if hlacaller:
to_process.append(data)
else:
... | [
"def",
"run",
"(",
"samples",
",",
"run_parallel",
")",
":",
"to_process",
"=",
"[",
"]",
"extras",
"=",
"[",
"]",
"for",
"data",
"in",
"(",
"xs",
"[",
"0",
"]",
"for",
"xs",
"in",
"samples",
")",
":",
"hlacaller",
"=",
"tz",
".",
"get_in",
"(",
... | Run HLA detection on the input samples. | [
"Run",
"HLA",
"detection",
"on",
"the",
"input",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hla/__init__.py#L20-L32 |
223,052 | bcbio/bcbio-nextgen | bcbio/ngsalign/bwa.py | align_bam | def align_bam(in_bam, ref_file, names, align_dir, data):
"""Perform direct alignment of an input BAM file with BWA using pipes.
This avoids disk IO by piping between processes:
- samtools sort of input BAM to queryname
- bedtools conversion to interleaved FASTQ
- bwa-mem alignment
- samtool... | python | def align_bam(in_bam, ref_file, names, align_dir, data):
"""Perform direct alignment of an input BAM file with BWA using pipes.
This avoids disk IO by piping between processes:
- samtools sort of input BAM to queryname
- bedtools conversion to interleaved FASTQ
- bwa-mem alignment
- samtool... | [
"def",
"align_bam",
"(",
"in_bam",
",",
"ref_file",
",",
"names",
",",
"align_dir",
",",
"data",
")",
":",
"config",
"=",
"data",
"[",
"\"config\"",
"]",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"align_dir",
",",
"\"{0}-sort.bam\"",
".",
"... | Perform direct alignment of an input BAM file with BWA using pipes.
This avoids disk IO by piping between processes:
- samtools sort of input BAM to queryname
- bedtools conversion to interleaved FASTQ
- bwa-mem alignment
- samtools conversion to BAM
- samtools sort to coordinate | [
"Perform",
"direct",
"alignment",
"of",
"an",
"input",
"BAM",
"file",
"with",
"BWA",
"using",
"pipes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bwa.py#L21-L53 |
223,053 | bcbio/bcbio-nextgen | bcbio/ngsalign/bwa.py | _get_bwa_mem_cmd | def _get_bwa_mem_cmd(data, out_file, ref_file, fastq1, fastq2=""):
"""Perform piped bwa mem mapping potentially with alternative alleles in GRCh38 + HLA typing.
Commands for HLA post-processing:
base=TEST
run-HLA $base.hla > $base.hla.top
cat $base.hla.HLA*.gt | grep ^GT | cut -f2- > $base... | python | def _get_bwa_mem_cmd(data, out_file, ref_file, fastq1, fastq2=""):
"""Perform piped bwa mem mapping potentially with alternative alleles in GRCh38 + HLA typing.
Commands for HLA post-processing:
base=TEST
run-HLA $base.hla > $base.hla.top
cat $base.hla.HLA*.gt | grep ^GT | cut -f2- > $base... | [
"def",
"_get_bwa_mem_cmd",
"(",
"data",
",",
"out_file",
",",
"ref_file",
",",
"fastq1",
",",
"fastq2",
"=",
"\"\"",
")",
":",
"alt_file",
"=",
"ref_file",
"+",
"\".alt\"",
"if",
"utils",
".",
"file_exists",
"(",
"alt_file",
")",
"and",
"dd",
".",
"get_h... | Perform piped bwa mem mapping potentially with alternative alleles in GRCh38 + HLA typing.
Commands for HLA post-processing:
base=TEST
run-HLA $base.hla > $base.hla.top
cat $base.hla.HLA*.gt | grep ^GT | cut -f2- > $base.hla.all
rm -f $base.hla.HLA*gt
rm -f $base.hla.HLA*gz | [
"Perform",
"piped",
"bwa",
"mem",
"mapping",
"potentially",
"with",
"alternative",
"alleles",
"in",
"GRCh38",
"+",
"HLA",
"typing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bwa.py#L55-L94 |
223,054 | bcbio/bcbio-nextgen | bcbio/ngsalign/bwa.py | _align_mem | def _align_mem(fastq_file, pair_file, ref_file, out_file, names, rg_info, data):
"""Perform bwa-mem alignment on supported read lengths.
"""
with postalign.tobam_cl(data, out_file, pair_file != "") as (tobam_cl, tx_out_file):
cmd = ("unset JAVA_HOME && "
"%s | %s" % (_get_bwa_mem_cmd(... | python | def _align_mem(fastq_file, pair_file, ref_file, out_file, names, rg_info, data):
"""Perform bwa-mem alignment on supported read lengths.
"""
with postalign.tobam_cl(data, out_file, pair_file != "") as (tobam_cl, tx_out_file):
cmd = ("unset JAVA_HOME && "
"%s | %s" % (_get_bwa_mem_cmd(... | [
"def",
"_align_mem",
"(",
"fastq_file",
",",
"pair_file",
",",
"ref_file",
",",
"out_file",
",",
"names",
",",
"rg_info",
",",
"data",
")",
":",
"with",
"postalign",
".",
"tobam_cl",
"(",
"data",
",",
"out_file",
",",
"pair_file",
"!=",
"\"\"",
")",
"as"... | Perform bwa-mem alignment on supported read lengths. | [
"Perform",
"bwa",
"-",
"mem",
"alignment",
"on",
"supported",
"read",
"lengths",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bwa.py#L174-L182 |
223,055 | bcbio/bcbio-nextgen | bcbio/ngsalign/bwa.py | _align_backtrack | def _align_backtrack(fastq_file, pair_file, ref_file, out_file, names, rg_info, data):
"""Perform a BWA alignment using 'aln' backtrack algorithm.
"""
bwa = config_utils.get_program("bwa", data["config"])
config = data["config"]
sai1_file = "%s_1.sai" % os.path.splitext(out_file)[0]
sai2_file = ... | python | def _align_backtrack(fastq_file, pair_file, ref_file, out_file, names, rg_info, data):
"""Perform a BWA alignment using 'aln' backtrack algorithm.
"""
bwa = config_utils.get_program("bwa", data["config"])
config = data["config"]
sai1_file = "%s_1.sai" % os.path.splitext(out_file)[0]
sai2_file = ... | [
"def",
"_align_backtrack",
"(",
"fastq_file",
",",
"pair_file",
",",
"ref_file",
",",
"out_file",
",",
"names",
",",
"rg_info",
",",
"data",
")",
":",
"bwa",
"=",
"config_utils",
".",
"get_program",
"(",
"\"bwa\"",
",",
"data",
"[",
"\"config\"",
"]",
")",... | Perform a BWA alignment using 'aln' backtrack algorithm. | [
"Perform",
"a",
"BWA",
"alignment",
"using",
"aln",
"backtrack",
"algorithm",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/bwa.py#L184-L203 |
223,056 | bcbio/bcbio-nextgen | bcbio/pipeline/main.py | run_main | def run_main(workdir, config_file=None, fc_dir=None, run_info_yaml=None,
parallel=None, workflow=None):
"""Run variant analysis, handling command line options.
"""
# Set environment to standard to use periods for decimals and avoid localization
os.environ["LC_ALL"] = "C"
os.environ["LC"... | python | def run_main(workdir, config_file=None, fc_dir=None, run_info_yaml=None,
parallel=None, workflow=None):
"""Run variant analysis, handling command line options.
"""
# Set environment to standard to use periods for decimals and avoid localization
os.environ["LC_ALL"] = "C"
os.environ["LC"... | [
"def",
"run_main",
"(",
"workdir",
",",
"config_file",
"=",
"None",
",",
"fc_dir",
"=",
"None",
",",
"run_info_yaml",
"=",
"None",
",",
"parallel",
"=",
"None",
",",
"workflow",
"=",
"None",
")",
":",
"# Set environment to standard to use periods for decimals and ... | Run variant analysis, handling command line options. | [
"Run",
"variant",
"analysis",
"handling",
"command",
"line",
"options",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/main.py#L29-L55 |
223,057 | bcbio/bcbio-nextgen | bcbio/pipeline/main.py | _setup_resources | def _setup_resources():
"""Attempt to increase resource limits up to hard limits.
This allows us to avoid out of file handle limits where we can
move beyond the soft limit up to the hard limit.
"""
target_procs = 10240
cur_proc, max_proc = resource.getrlimit(resource.RLIMIT_NPROC)
target_pr... | python | def _setup_resources():
"""Attempt to increase resource limits up to hard limits.
This allows us to avoid out of file handle limits where we can
move beyond the soft limit up to the hard limit.
"""
target_procs = 10240
cur_proc, max_proc = resource.getrlimit(resource.RLIMIT_NPROC)
target_pr... | [
"def",
"_setup_resources",
"(",
")",
":",
"target_procs",
"=",
"10240",
"cur_proc",
",",
"max_proc",
"=",
"resource",
".",
"getrlimit",
"(",
"resource",
".",
"RLIMIT_NPROC",
")",
"target_proc",
"=",
"min",
"(",
"max_proc",
",",
"target_procs",
")",
"if",
"ma... | Attempt to increase resource limits up to hard limits.
This allows us to avoid out of file handle limits where we can
move beyond the soft limit up to the hard limit. | [
"Attempt",
"to",
"increase",
"resource",
"limits",
"up",
"to",
"hard",
"limits",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/main.py#L57-L69 |
223,058 | bcbio/bcbio-nextgen | bcbio/pipeline/main.py | _wres | def _wres(parallel, progs, fresources=None, ensure_mem=None):
"""Add resource information to the parallel environment on required programs and files.
Enables spinning up required machines and operating in non-shared filesystem
environments.
progs -- Third party tools used in processing
fresources ... | python | def _wres(parallel, progs, fresources=None, ensure_mem=None):
"""Add resource information to the parallel environment on required programs and files.
Enables spinning up required machines and operating in non-shared filesystem
environments.
progs -- Third party tools used in processing
fresources ... | [
"def",
"_wres",
"(",
"parallel",
",",
"progs",
",",
"fresources",
"=",
"None",
",",
"ensure_mem",
"=",
"None",
")",
":",
"parallel",
"=",
"copy",
".",
"deepcopy",
"(",
"parallel",
")",
"parallel",
"[",
"\"progs\"",
"]",
"=",
"progs",
"if",
"fresources",
... | Add resource information to the parallel environment on required programs and files.
Enables spinning up required machines and operating in non-shared filesystem
environments.
progs -- Third party tools used in processing
fresources -- Required file-based resources needed. These will be transferred on... | [
"Add",
"resource",
"information",
"to",
"the",
"parallel",
"environment",
"on",
"required",
"programs",
"and",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/main.py#L94-L112 |
223,059 | bcbio/bcbio-nextgen | bcbio/pipeline/main.py | rnaseq_prep_samples | def rnaseq_prep_samples(config, run_info_yaml, parallel, dirs, samples):
"""
organizes RNA-seq and small-RNAseq samples, converting from BAM if
necessary and trimming if necessary
"""
pipeline = dd.get_in_samples(samples, dd.get_analysis)
trim_reads_set = any([tz.get_in(["algorithm", "trim_reads... | python | def rnaseq_prep_samples(config, run_info_yaml, parallel, dirs, samples):
"""
organizes RNA-seq and small-RNAseq samples, converting from BAM if
necessary and trimming if necessary
"""
pipeline = dd.get_in_samples(samples, dd.get_analysis)
trim_reads_set = any([tz.get_in(["algorithm", "trim_reads... | [
"def",
"rnaseq_prep_samples",
"(",
"config",
",",
"run_info_yaml",
",",
"parallel",
",",
"dirs",
",",
"samples",
")",
":",
"pipeline",
"=",
"dd",
".",
"get_in_samples",
"(",
"samples",
",",
"dd",
".",
"get_analysis",
")",
"trim_reads_set",
"=",
"any",
"(",
... | organizes RNA-seq and small-RNAseq samples, converting from BAM if
necessary and trimming if necessary | [
"organizes",
"RNA",
"-",
"seq",
"and",
"small",
"-",
"RNAseq",
"samples",
"converting",
"from",
"BAM",
"if",
"necessary",
"and",
"trimming",
"if",
"necessary"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/main.py#L394-L418 |
223,060 | bcbio/bcbio-nextgen | bcbio/pipeline/main.py | _pair_samples_with_pipelines | def _pair_samples_with_pipelines(run_info_yaml, config):
"""Map samples defined in input file to pipelines to run.
"""
samples = config_utils.load_config(run_info_yaml)
if isinstance(samples, dict):
resources = samples.pop("resources")
samples = samples["details"]
else:
resou... | python | def _pair_samples_with_pipelines(run_info_yaml, config):
"""Map samples defined in input file to pipelines to run.
"""
samples = config_utils.load_config(run_info_yaml)
if isinstance(samples, dict):
resources = samples.pop("resources")
samples = samples["details"]
else:
resou... | [
"def",
"_pair_samples_with_pipelines",
"(",
"run_info_yaml",
",",
"config",
")",
":",
"samples",
"=",
"config_utils",
".",
"load_config",
"(",
"run_info_yaml",
")",
"if",
"isinstance",
"(",
"samples",
",",
"dict",
")",
":",
"resources",
"=",
"samples",
".",
"p... | Map samples defined in input file to pipelines to run. | [
"Map",
"samples",
"defined",
"in",
"input",
"file",
"to",
"pipelines",
"to",
"run",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/main.py#L430-L461 |
223,061 | bcbio/bcbio-nextgen | bcbio/hla/bwakit.py | run | def run(data):
"""HLA typing with bwakit, parsing output from called genotype files.
"""
bwakit_dir = os.path.dirname(os.path.realpath(utils.which("run-bwamem")))
hla_fqs = tz.get_in(["hla", "fastq"], data, [])
if len(hla_fqs) > 0:
hla_base = os.path.commonprefix(hla_fqs)
while hla_b... | python | def run(data):
"""HLA typing with bwakit, parsing output from called genotype files.
"""
bwakit_dir = os.path.dirname(os.path.realpath(utils.which("run-bwamem")))
hla_fqs = tz.get_in(["hla", "fastq"], data, [])
if len(hla_fqs) > 0:
hla_base = os.path.commonprefix(hla_fqs)
while hla_b... | [
"def",
"run",
"(",
"data",
")",
":",
"bwakit_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"utils",
".",
"which",
"(",
"\"run-bwamem\"",
")",
")",
")",
"hla_fqs",
"=",
"tz",
".",
"get_in",
"(",
"[",
"... | HLA typing with bwakit, parsing output from called genotype files. | [
"HLA",
"typing",
"with",
"bwakit",
"parsing",
"output",
"from",
"called",
"genotype",
"files",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hla/bwakit.py#L18-L34 |
223,062 | bcbio/bcbio-nextgen | bcbio/hla/bwakit.py | _organize_calls | def _organize_calls(out_file, hla_base, data):
"""Prepare genotype calls, reporting best call along with quality metrics.
"""
hla_truth = get_hla_truthset(data)
sample = dd.get_sample_name(data)
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") as out_handle:
... | python | def _organize_calls(out_file, hla_base, data):
"""Prepare genotype calls, reporting best call along with quality metrics.
"""
hla_truth = get_hla_truthset(data)
sample = dd.get_sample_name(data)
with file_transaction(data, out_file) as tx_out_file:
with open(tx_out_file, "w") as out_handle:
... | [
"def",
"_organize_calls",
"(",
"out_file",
",",
"hla_base",
",",
"data",
")",
":",
"hla_truth",
"=",
"get_hla_truthset",
"(",
"data",
")",
"sample",
"=",
"dd",
".",
"get_sample_name",
"(",
"data",
")",
"with",
"file_transaction",
"(",
"data",
",",
"out_file"... | Prepare genotype calls, reporting best call along with quality metrics. | [
"Prepare",
"genotype",
"calls",
"reporting",
"best",
"call",
"along",
"with",
"quality",
"metrics",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hla/bwakit.py#L36-L64 |
223,063 | bcbio/bcbio-nextgen | bcbio/hla/bwakit.py | matches_truth | def matches_truth(call_alleles, truth_alleles, data):
"""Flexibly check if truth and call alleles match, using p-groups.
"""
if not truth_alleles:
return ""
else:
def _remove_p(x):
return x[:-1] if x.endswith("P") else x
t_cmp = set([_remove_p(hla_groups.hla_protein(x... | python | def matches_truth(call_alleles, truth_alleles, data):
"""Flexibly check if truth and call alleles match, using p-groups.
"""
if not truth_alleles:
return ""
else:
def _remove_p(x):
return x[:-1] if x.endswith("P") else x
t_cmp = set([_remove_p(hla_groups.hla_protein(x... | [
"def",
"matches_truth",
"(",
"call_alleles",
",",
"truth_alleles",
",",
"data",
")",
":",
"if",
"not",
"truth_alleles",
":",
"return",
"\"\"",
"else",
":",
"def",
"_remove_p",
"(",
"x",
")",
":",
"return",
"x",
"[",
":",
"-",
"1",
"]",
"if",
"x",
"."... | Flexibly check if truth and call alleles match, using p-groups. | [
"Flexibly",
"check",
"if",
"truth",
"and",
"call",
"alleles",
"match",
"using",
"p",
"-",
"groups",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hla/bwakit.py#L66-L76 |
223,064 | bcbio/bcbio-nextgen | bcbio/hla/bwakit.py | get_hla_truthset | def get_hla_truthset(data):
"""Retrieve expected truth calls for annotating HLA called output.
"""
val_csv = tz.get_in(["config", "algorithm", "hlavalidate"], data)
out = {}
if val_csv and utils.file_exists(val_csv):
with open(val_csv) as in_handle:
reader = csv.reader(in_handle)... | python | def get_hla_truthset(data):
"""Retrieve expected truth calls for annotating HLA called output.
"""
val_csv = tz.get_in(["config", "algorithm", "hlavalidate"], data)
out = {}
if val_csv and utils.file_exists(val_csv):
with open(val_csv) as in_handle:
reader = csv.reader(in_handle)... | [
"def",
"get_hla_truthset",
"(",
"data",
")",
":",
"val_csv",
"=",
"tz",
".",
"get_in",
"(",
"[",
"\"config\"",
",",
"\"algorithm\"",
",",
"\"hlavalidate\"",
"]",
",",
"data",
")",
"out",
"=",
"{",
"}",
"if",
"val_csv",
"and",
"utils",
".",
"file_exists",... | Retrieve expected truth calls for annotating HLA called output. | [
"Retrieve",
"expected",
"truth",
"calls",
"for",
"annotating",
"HLA",
"called",
"output",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/hla/bwakit.py#L78-L89 |
223,065 | bcbio/bcbio-nextgen | scripts/utils/bam_to_fastq_region.py | bam_to_fastq_pair | def bam_to_fastq_pair(in_file, target_region, pair):
"""Generator to convert BAM files into name, seq, qual in a region.
"""
space, start, end = target_region
bam_file = pysam.Samfile(in_file, "rb")
for read in bam_file:
if (not read.is_unmapped and not read.mate_is_unmapped
... | python | def bam_to_fastq_pair(in_file, target_region, pair):
"""Generator to convert BAM files into name, seq, qual in a region.
"""
space, start, end = target_region
bam_file = pysam.Samfile(in_file, "rb")
for read in bam_file:
if (not read.is_unmapped and not read.mate_is_unmapped
... | [
"def",
"bam_to_fastq_pair",
"(",
"in_file",
",",
"target_region",
",",
"pair",
")",
":",
"space",
",",
"start",
",",
"end",
"=",
"target_region",
"bam_file",
"=",
"pysam",
".",
"Samfile",
"(",
"in_file",
",",
"\"rb\"",
")",
"for",
"read",
"in",
"bam_file",... | Generator to convert BAM files into name, seq, qual in a region. | [
"Generator",
"to",
"convert",
"BAM",
"files",
"into",
"name",
"seq",
"qual",
"in",
"a",
"region",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/bam_to_fastq_region.py#L32-L50 |
223,066 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | sample_callable_bed | def sample_callable_bed(bam_file, ref_file, data):
"""Retrieve callable regions for a sample subset by defined analysis regions.
"""
from bcbio.heterogeneity import chromhacks
CovInfo = collections.namedtuple("CovInfo", "callable, raw_callable, depth_files")
noalt_calling = "noalt_calling" in dd.get... | python | def sample_callable_bed(bam_file, ref_file, data):
"""Retrieve callable regions for a sample subset by defined analysis regions.
"""
from bcbio.heterogeneity import chromhacks
CovInfo = collections.namedtuple("CovInfo", "callable, raw_callable, depth_files")
noalt_calling = "noalt_calling" in dd.get... | [
"def",
"sample_callable_bed",
"(",
"bam_file",
",",
"ref_file",
",",
"data",
")",
":",
"from",
"bcbio",
".",
"heterogeneity",
"import",
"chromhacks",
"CovInfo",
"=",
"collections",
".",
"namedtuple",
"(",
"\"CovInfo\"",
",",
"\"callable, raw_callable, depth_files\"",
... | Retrieve callable regions for a sample subset by defined analysis regions. | [
"Retrieve",
"callable",
"regions",
"for",
"a",
"sample",
"subset",
"by",
"defined",
"analysis",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L32-L57 |
223,067 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | get_ref_bedtool | def get_ref_bedtool(ref_file, config, chrom=None):
"""Retrieve a pybedtool BedTool object with reference sizes from input reference.
"""
broad_runner = broad.runner_from_path("picard", config)
ref_dict = broad_runner.run_fn("picard_index_ref", ref_file)
ref_lines = []
with pysam.Samfile(ref_dict... | python | def get_ref_bedtool(ref_file, config, chrom=None):
"""Retrieve a pybedtool BedTool object with reference sizes from input reference.
"""
broad_runner = broad.runner_from_path("picard", config)
ref_dict = broad_runner.run_fn("picard_index_ref", ref_file)
ref_lines = []
with pysam.Samfile(ref_dict... | [
"def",
"get_ref_bedtool",
"(",
"ref_file",
",",
"config",
",",
"chrom",
"=",
"None",
")",
":",
"broad_runner",
"=",
"broad",
".",
"runner_from_path",
"(",
"\"picard\"",
",",
"config",
")",
"ref_dict",
"=",
"broad_runner",
".",
"run_fn",
"(",
"\"picard_index_re... | Retrieve a pybedtool BedTool object with reference sizes from input reference. | [
"Retrieve",
"a",
"pybedtool",
"BedTool",
"object",
"with",
"reference",
"sizes",
"from",
"input",
"reference",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L59-L69 |
223,068 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | _get_nblock_regions | def _get_nblock_regions(in_file, min_n_size, ref_regions):
"""Retrieve coordinates of regions in reference genome with no mapping.
These are potential breakpoints for parallelizing analysis.
"""
out_lines = []
called_contigs = set([])
with utils.open_gzipsafe(in_file) as in_handle:
for l... | python | def _get_nblock_regions(in_file, min_n_size, ref_regions):
"""Retrieve coordinates of regions in reference genome with no mapping.
These are potential breakpoints for parallelizing analysis.
"""
out_lines = []
called_contigs = set([])
with utils.open_gzipsafe(in_file) as in_handle:
for l... | [
"def",
"_get_nblock_regions",
"(",
"in_file",
",",
"min_n_size",
",",
"ref_regions",
")",
":",
"out_lines",
"=",
"[",
"]",
"called_contigs",
"=",
"set",
"(",
"[",
"]",
")",
"with",
"utils",
".",
"open_gzipsafe",
"(",
"in_file",
")",
"as",
"in_handle",
":",... | Retrieve coordinates of regions in reference genome with no mapping.
These are potential breakpoints for parallelizing analysis. | [
"Retrieve",
"coordinates",
"of",
"regions",
"in",
"reference",
"genome",
"with",
"no",
"mapping",
".",
"These",
"are",
"potential",
"breakpoints",
"for",
"parallelizing",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L71-L87 |
223,069 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | _combine_regions | def _combine_regions(all_regions, ref_regions):
"""Combine multiple BEDtools regions of regions into sorted final BEDtool.
"""
chrom_order = {}
for i, x in enumerate(ref_regions):
chrom_order[x.chrom] = i
def wchrom_key(x):
chrom, start, end = x
return (chrom_order[chrom], st... | python | def _combine_regions(all_regions, ref_regions):
"""Combine multiple BEDtools regions of regions into sorted final BEDtool.
"""
chrom_order = {}
for i, x in enumerate(ref_regions):
chrom_order[x.chrom] = i
def wchrom_key(x):
chrom, start, end = x
return (chrom_order[chrom], st... | [
"def",
"_combine_regions",
"(",
"all_regions",
",",
"ref_regions",
")",
":",
"chrom_order",
"=",
"{",
"}",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"ref_regions",
")",
":",
"chrom_order",
"[",
"x",
".",
"chrom",
"]",
"=",
"i",
"def",
"wchrom_key",
... | Combine multiple BEDtools regions of regions into sorted final BEDtool. | [
"Combine",
"multiple",
"BEDtools",
"regions",
"of",
"regions",
"into",
"sorted",
"final",
"BEDtool",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L89-L104 |
223,070 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | _add_config_regions | def _add_config_regions(nblock_regions, ref_regions, data):
"""Add additional nblock regions based on configured regions to call.
Identifies user defined regions which we should not be analyzing.
"""
input_regions_bed = dd.get_variant_regions(data)
if input_regions_bed:
input_regions = pybed... | python | def _add_config_regions(nblock_regions, ref_regions, data):
"""Add additional nblock regions based on configured regions to call.
Identifies user defined regions which we should not be analyzing.
"""
input_regions_bed = dd.get_variant_regions(data)
if input_regions_bed:
input_regions = pybed... | [
"def",
"_add_config_regions",
"(",
"nblock_regions",
",",
"ref_regions",
",",
"data",
")",
":",
"input_regions_bed",
"=",
"dd",
".",
"get_variant_regions",
"(",
"data",
")",
"if",
"input_regions_bed",
":",
"input_regions",
"=",
"pybedtools",
".",
"BedTool",
"(",
... | Add additional nblock regions based on configured regions to call.
Identifies user defined regions which we should not be analyzing. | [
"Add",
"additional",
"nblock",
"regions",
"based",
"on",
"configured",
"regions",
"to",
"call",
".",
"Identifies",
"user",
"defined",
"regions",
"which",
"we",
"should",
"not",
"be",
"analyzing",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L106-L130 |
223,071 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | block_regions | def block_regions(callable_bed, in_bam, ref_file, data):
"""Find blocks of regions for analysis from mapped input BAM file.
Identifies islands of callable regions, surrounding by regions
with no read support, that can be analyzed independently.
"""
min_n_size = int(data["config"]["algorithm"].get("... | python | def block_regions(callable_bed, in_bam, ref_file, data):
"""Find blocks of regions for analysis from mapped input BAM file.
Identifies islands of callable regions, surrounding by regions
with no read support, that can be analyzed independently.
"""
min_n_size = int(data["config"]["algorithm"].get("... | [
"def",
"block_regions",
"(",
"callable_bed",
",",
"in_bam",
",",
"ref_file",
",",
"data",
")",
":",
"min_n_size",
"=",
"int",
"(",
"data",
"[",
"\"config\"",
"]",
"[",
"\"algorithm\"",
"]",
".",
"get",
"(",
"\"nomap_split_size\"",
",",
"250",
")",
")",
"... | Find blocks of regions for analysis from mapped input BAM file.
Identifies islands of callable regions, surrounding by regions
with no read support, that can be analyzed independently. | [
"Find",
"blocks",
"of",
"regions",
"for",
"analysis",
"from",
"mapped",
"input",
"BAM",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L182-L207 |
223,072 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | _analysis_block_stats | def _analysis_block_stats(regions, samples):
"""Provide statistics on sizes and number of analysis blocks.
"""
prev = None
between_sizes = []
region_sizes = []
for region in regions:
if prev and prev.chrom == region.chrom:
between_sizes.append(region.start - prev.end)
... | python | def _analysis_block_stats(regions, samples):
"""Provide statistics on sizes and number of analysis blocks.
"""
prev = None
between_sizes = []
region_sizes = []
for region in regions:
if prev and prev.chrom == region.chrom:
between_sizes.append(region.start - prev.end)
... | [
"def",
"_analysis_block_stats",
"(",
"regions",
",",
"samples",
")",
":",
"prev",
"=",
"None",
"between_sizes",
"=",
"[",
"]",
"region_sizes",
"=",
"[",
"]",
"for",
"region",
"in",
"regions",
":",
"if",
"prev",
"and",
"prev",
".",
"chrom",
"==",
"region"... | Provide statistics on sizes and number of analysis blocks. | [
"Provide",
"statistics",
"on",
"sizes",
"and",
"number",
"of",
"analysis",
"blocks",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L216-L244 |
223,073 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | _needs_region_update | def _needs_region_update(out_file, samples):
"""Check if we need to update BED file of regions, supporting back compatibility.
"""
nblock_files = [x["regions"]["nblock"] for x in samples if "regions" in x]
# For older approaches and do not create a new set of analysis
# regions, since the new algori... | python | def _needs_region_update(out_file, samples):
"""Check if we need to update BED file of regions, supporting back compatibility.
"""
nblock_files = [x["regions"]["nblock"] for x in samples if "regions" in x]
# For older approaches and do not create a new set of analysis
# regions, since the new algori... | [
"def",
"_needs_region_update",
"(",
"out_file",
",",
"samples",
")",
":",
"nblock_files",
"=",
"[",
"x",
"[",
"\"regions\"",
"]",
"[",
"\"nblock\"",
"]",
"for",
"x",
"in",
"samples",
"if",
"\"regions\"",
"in",
"x",
"]",
"# For older approaches and do not create ... | Check if we need to update BED file of regions, supporting back compatibility. | [
"Check",
"if",
"we",
"need",
"to",
"update",
"BED",
"file",
"of",
"regions",
"supporting",
"back",
"compatibility",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L246-L261 |
223,074 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | combine_sample_regions | def combine_sample_regions(*samples):
"""Create batch-level sets of callable regions for multi-sample calling.
Intersects all non-callable (nblock) regions from all samples in a batch,
producing a global set of callable regions.
"""
samples = utils.unpack_worlds(samples)
samples = cwlutils.unpa... | python | def combine_sample_regions(*samples):
"""Create batch-level sets of callable regions for multi-sample calling.
Intersects all non-callable (nblock) regions from all samples in a batch,
producing a global set of callable regions.
"""
samples = utils.unpack_worlds(samples)
samples = cwlutils.unpa... | [
"def",
"combine_sample_regions",
"(",
"*",
"samples",
")",
":",
"samples",
"=",
"utils",
".",
"unpack_worlds",
"(",
"samples",
")",
"samples",
"=",
"cwlutils",
".",
"unpack_tarballs",
"(",
"samples",
",",
"samples",
"[",
"0",
"]",
")",
"# back compatibility --... | Create batch-level sets of callable regions for multi-sample calling.
Intersects all non-callable (nblock) regions from all samples in a batch,
producing a global set of callable regions. | [
"Create",
"batch",
"-",
"level",
"sets",
"of",
"callable",
"regions",
"for",
"multi",
"-",
"sample",
"calling",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L263-L311 |
223,075 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | _combine_sample_regions_batch | def _combine_sample_regions_batch(batch, items):
"""Combine sample regions within a group of batched samples.
"""
config = items[0]["config"]
work_dir = utils.safe_makedir(os.path.join(items[0]["dirs"]["work"], "regions"))
analysis_file = os.path.join(work_dir, "%s-analysis_blocks.bed" % batch)
... | python | def _combine_sample_regions_batch(batch, items):
"""Combine sample regions within a group of batched samples.
"""
config = items[0]["config"]
work_dir = utils.safe_makedir(os.path.join(items[0]["dirs"]["work"], "regions"))
analysis_file = os.path.join(work_dir, "%s-analysis_blocks.bed" % batch)
... | [
"def",
"_combine_sample_regions_batch",
"(",
"batch",
",",
"items",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"",
"]",
"work_dir",
"=",
"utils",
".",
"safe_makedir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"items",
"[",
"0",
"]"... | Combine sample regions within a group of batched samples. | [
"Combine",
"sample",
"regions",
"within",
"a",
"group",
"of",
"batched",
"samples",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L313-L347 |
223,076 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | get_split_regions | def get_split_regions(bed_file, data):
"""Retrieve a set of split regions using the input BED for callable regions.
Provides a less inclusive hook for parallelizing over multiple regions.
"""
out_file = "%s-analysis_blocks.bed" % utils.splitext_plus(bed_file)[0]
with shared.bedtools_tmpdir(data):
... | python | def get_split_regions(bed_file, data):
"""Retrieve a set of split regions using the input BED for callable regions.
Provides a less inclusive hook for parallelizing over multiple regions.
"""
out_file = "%s-analysis_blocks.bed" % utils.splitext_plus(bed_file)[0]
with shared.bedtools_tmpdir(data):
... | [
"def",
"get_split_regions",
"(",
"bed_file",
",",
"data",
")",
":",
"out_file",
"=",
"\"%s-analysis_blocks.bed\"",
"%",
"utils",
".",
"splitext_plus",
"(",
"bed_file",
")",
"[",
"0",
"]",
"with",
"shared",
".",
"bedtools_tmpdir",
"(",
"data",
")",
":",
"if",... | Retrieve a set of split regions using the input BED for callable regions.
Provides a less inclusive hook for parallelizing over multiple regions. | [
"Retrieve",
"a",
"set",
"of",
"split",
"regions",
"using",
"the",
"input",
"BED",
"for",
"callable",
"regions",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L349-L374 |
223,077 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | NBlockRegionPicker.include_block | def include_block(self, x):
"""Check for inclusion of block based on distance from previous.
"""
last_pos = self._chr_last_blocks.get(x.chrom, 0)
# Region excludes an entire chromosome, typically decoy/haplotypes
if last_pos <= self._end_buffer and x.stop >= self._ref_sizes.get(x... | python | def include_block(self, x):
"""Check for inclusion of block based on distance from previous.
"""
last_pos = self._chr_last_blocks.get(x.chrom, 0)
# Region excludes an entire chromosome, typically decoy/haplotypes
if last_pos <= self._end_buffer and x.stop >= self._ref_sizes.get(x... | [
"def",
"include_block",
"(",
"self",
",",
"x",
")",
":",
"last_pos",
"=",
"self",
".",
"_chr_last_blocks",
".",
"get",
"(",
"x",
".",
"chrom",
",",
"0",
")",
"# Region excludes an entire chromosome, typically decoy/haplotypes",
"if",
"last_pos",
"<=",
"self",
".... | Check for inclusion of block based on distance from previous. | [
"Check",
"for",
"inclusion",
"of",
"block",
"based",
"on",
"distance",
"from",
"previous",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L155-L169 |
223,078 | bcbio/bcbio-nextgen | bcbio/bam/callable.py | NBlockRegionPicker.expand_block | def expand_block(self, feat):
"""Expand any blocks which are near the start or end of a contig.
"""
chrom_end = self._ref_sizes.get(feat.chrom)
if chrom_end:
if feat.start < self._end_buffer:
feat.start = 0
if feat.stop >= chrom_end - self._end_buf... | python | def expand_block(self, feat):
"""Expand any blocks which are near the start or end of a contig.
"""
chrom_end = self._ref_sizes.get(feat.chrom)
if chrom_end:
if feat.start < self._end_buffer:
feat.start = 0
if feat.stop >= chrom_end - self._end_buf... | [
"def",
"expand_block",
"(",
"self",
",",
"feat",
")",
":",
"chrom_end",
"=",
"self",
".",
"_ref_sizes",
".",
"get",
"(",
"feat",
".",
"chrom",
")",
"if",
"chrom_end",
":",
"if",
"feat",
".",
"start",
"<",
"self",
".",
"_end_buffer",
":",
"feat",
".",... | Expand any blocks which are near the start or end of a contig. | [
"Expand",
"any",
"blocks",
"which",
"are",
"near",
"the",
"start",
"or",
"end",
"of",
"a",
"contig",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L171-L180 |
223,079 | bcbio/bcbio-nextgen | bcbio/chipseq/__init__.py | _keep_assembled_chrom | def _keep_assembled_chrom(bam_file, genome, config):
"""Remove contigs from the BAM file"""
fai = "%s.fai" % genome
chrom = []
with open(fai) as inh:
for line in inh:
c = line.split("\t")[0]
if c.find("_") < 0:
chrom.append(c)
chroms = " ".join(chrom)
... | python | def _keep_assembled_chrom(bam_file, genome, config):
"""Remove contigs from the BAM file"""
fai = "%s.fai" % genome
chrom = []
with open(fai) as inh:
for line in inh:
c = line.split("\t")[0]
if c.find("_") < 0:
chrom.append(c)
chroms = " ".join(chrom)
... | [
"def",
"_keep_assembled_chrom",
"(",
"bam_file",
",",
"genome",
",",
"config",
")",
":",
"fai",
"=",
"\"%s.fai\"",
"%",
"genome",
"chrom",
"=",
"[",
"]",
"with",
"open",
"(",
"fai",
")",
"as",
"inh",
":",
"for",
"line",
"in",
"inh",
":",
"c",
"=",
... | Remove contigs from the BAM file | [
"Remove",
"contigs",
"from",
"the",
"BAM",
"file"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/__init__.py#L40-L57 |
223,080 | bcbio/bcbio-nextgen | bcbio/chipseq/__init__.py | _prepare_bam | def _prepare_bam(bam_file, bed_file, config):
"""Remove regions from bed files"""
if not bam_file or not bed_file:
return bam_file
out_file = utils.append_stem(bam_file, '_filter')
bedtools = config_utils.get_program("bedtools", config)
if not utils.file_exists(out_file):
with file_t... | python | def _prepare_bam(bam_file, bed_file, config):
"""Remove regions from bed files"""
if not bam_file or not bed_file:
return bam_file
out_file = utils.append_stem(bam_file, '_filter')
bedtools = config_utils.get_program("bedtools", config)
if not utils.file_exists(out_file):
with file_t... | [
"def",
"_prepare_bam",
"(",
"bam_file",
",",
"bed_file",
",",
"config",
")",
":",
"if",
"not",
"bam_file",
"or",
"not",
"bed_file",
":",
"return",
"bam_file",
"out_file",
"=",
"utils",
".",
"append_stem",
"(",
"bam_file",
",",
"'_filter'",
")",
"bedtools",
... | Remove regions from bed files | [
"Remove",
"regions",
"from",
"bed",
"files"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/__init__.py#L60-L70 |
223,081 | bcbio/bcbio-nextgen | bcbio/chipseq/__init__.py | _bam_coverage | def _bam_coverage(name, bam_input, data):
"""Run bamCoverage from deeptools"""
cmd = ("{bam_coverage} -b {bam_input} -o {bw_output} "
"--binSize 20 --effectiveGenomeSize {size} "
"--smoothLength 60 --extendReads 150 --centerReads -p {cores}")
size = bam.fasta.total_sequence_length(dd.get... | python | def _bam_coverage(name, bam_input, data):
"""Run bamCoverage from deeptools"""
cmd = ("{bam_coverage} -b {bam_input} -o {bw_output} "
"--binSize 20 --effectiveGenomeSize {size} "
"--smoothLength 60 --extendReads 150 --centerReads -p {cores}")
size = bam.fasta.total_sequence_length(dd.get... | [
"def",
"_bam_coverage",
"(",
"name",
",",
"bam_input",
",",
"data",
")",
":",
"cmd",
"=",
"(",
"\"{bam_coverage} -b {bam_input} -o {bw_output} \"",
"\"--binSize 20 --effectiveGenomeSize {size} \"",
"\"--smoothLength 60 --extendReads 150 --centerReads -p {cores}\"",
")",
"size",
"... | Run bamCoverage from deeptools | [
"Run",
"bamCoverage",
"from",
"deeptools"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/__init__.py#L72-L94 |
223,082 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _get_out_file | def _get_out_file(work_dir, paired):
"""Retrieve manta output variant file, depending on analysis.
"""
if paired:
if paired.normal_bam:
base_file = "somaticSV.vcf.gz"
else:
base_file = "tumorSV.vcf.gz"
else:
base_file = "diploidSV.vcf.gz"
return os.pat... | python | def _get_out_file(work_dir, paired):
"""Retrieve manta output variant file, depending on analysis.
"""
if paired:
if paired.normal_bam:
base_file = "somaticSV.vcf.gz"
else:
base_file = "tumorSV.vcf.gz"
else:
base_file = "diploidSV.vcf.gz"
return os.pat... | [
"def",
"_get_out_file",
"(",
"work_dir",
",",
"paired",
")",
":",
"if",
"paired",
":",
"if",
"paired",
".",
"normal_bam",
":",
"base_file",
"=",
"\"somaticSV.vcf.gz\"",
"else",
":",
"base_file",
"=",
"\"tumorSV.vcf.gz\"",
"else",
":",
"base_file",
"=",
"\"dipl... | Retrieve manta output variant file, depending on analysis. | [
"Retrieve",
"manta",
"output",
"variant",
"file",
"depending",
"on",
"analysis",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L71-L81 |
223,083 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _get_evidence_bam | def _get_evidence_bam(work_dir, data):
"""Retrieve evidence BAM for the sample if it exists
"""
evidence_bam = glob.glob(os.path.join(work_dir, "results", "evidence",
"evidence_*.%s*.bam" % (dd.get_sample_name(data))))
if evidence_bam:
return evidence_... | python | def _get_evidence_bam(work_dir, data):
"""Retrieve evidence BAM for the sample if it exists
"""
evidence_bam = glob.glob(os.path.join(work_dir, "results", "evidence",
"evidence_*.%s*.bam" % (dd.get_sample_name(data))))
if evidence_bam:
return evidence_... | [
"def",
"_get_evidence_bam",
"(",
"work_dir",
",",
"data",
")",
":",
"evidence_bam",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"results\"",
",",
"\"evidence\"",
",",
"\"evidence_*.%s*.bam\"",
"%",
"(",
"dd",
".",... | Retrieve evidence BAM for the sample if it exists | [
"Retrieve",
"evidence",
"BAM",
"for",
"the",
"sample",
"if",
"it",
"exists"
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L83-L89 |
223,084 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _run_workflow | def _run_workflow(items, paired, workflow_file, work_dir):
"""Run manta analysis inside prepared workflow directory.
"""
utils.remove_safe(os.path.join(work_dir, "workspace"))
data = paired.tumor_data if paired else items[0]
cmd = [utils.get_program_python("configManta.py"), workflow_file, "-m", "lo... | python | def _run_workflow(items, paired, workflow_file, work_dir):
"""Run manta analysis inside prepared workflow directory.
"""
utils.remove_safe(os.path.join(work_dir, "workspace"))
data = paired.tumor_data if paired else items[0]
cmd = [utils.get_program_python("configManta.py"), workflow_file, "-m", "lo... | [
"def",
"_run_workflow",
"(",
"items",
",",
"paired",
",",
"workflow_file",
",",
"work_dir",
")",
":",
"utils",
".",
"remove_safe",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"workspace\"",
")",
")",
"data",
"=",
"paired",
".",
"tumor_da... | Run manta analysis inside prepared workflow directory. | [
"Run",
"manta",
"analysis",
"inside",
"prepared",
"workflow",
"directory",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L91-L98 |
223,085 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _prep_config | def _prep_config(items, paired, work_dir):
"""Run initial configuration, generating a run directory for Manta.
"""
assert utils.which("configManta.py"), "Could not find installed configManta.py"
out_file = os.path.join(work_dir, "runWorkflow.py")
if not utils.file_exists(out_file) or _out_of_date(ou... | python | def _prep_config(items, paired, work_dir):
"""Run initial configuration, generating a run directory for Manta.
"""
assert utils.which("configManta.py"), "Could not find installed configManta.py"
out_file = os.path.join(work_dir, "runWorkflow.py")
if not utils.file_exists(out_file) or _out_of_date(ou... | [
"def",
"_prep_config",
"(",
"items",
",",
"paired",
",",
"work_dir",
")",
":",
"assert",
"utils",
".",
"which",
"(",
"\"configManta.py\"",
")",
",",
"\"Could not find installed configManta.py\"",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
... | Run initial configuration, generating a run directory for Manta. | [
"Run",
"initial",
"configuration",
"generating",
"a",
"run",
"directory",
"for",
"Manta",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L100-L129 |
223,086 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _prep_streamlined_config | def _prep_streamlined_config(config_script, work_dir):
"""Create manta INI file without steps that potentially increase runtimes.
This removes calling of small indels.
"""
new_min_size = 100
in_file = config_script + ".ini"
out_file = os.path.join(work_dir, os.path.basename(in_file))
with o... | python | def _prep_streamlined_config(config_script, work_dir):
"""Create manta INI file without steps that potentially increase runtimes.
This removes calling of small indels.
"""
new_min_size = 100
in_file = config_script + ".ini"
out_file = os.path.join(work_dir, os.path.basename(in_file))
with o... | [
"def",
"_prep_streamlined_config",
"(",
"config_script",
",",
"work_dir",
")",
":",
"new_min_size",
"=",
"100",
"in_file",
"=",
"config_script",
"+",
"\".ini\"",
"out_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"os",
".",
"path",
".",
... | Create manta INI file without steps that potentially increase runtimes.
This removes calling of small indels. | [
"Create",
"manta",
"INI",
"file",
"without",
"steps",
"that",
"potentially",
"increase",
"runtimes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L131-L146 |
223,087 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _maybe_limit_chromosomes | def _maybe_limit_chromosomes(data):
"""Potentially limit chromosomes to avoid problematically named HLA contigs.
HLAs have ':' characters in them which confuse downstream processing. If
we have no problematic chromosomes we don't limit anything.
"""
std_chroms = []
prob_chroms = []
noalt_ca... | python | def _maybe_limit_chromosomes(data):
"""Potentially limit chromosomes to avoid problematically named HLA contigs.
HLAs have ':' characters in them which confuse downstream processing. If
we have no problematic chromosomes we don't limit anything.
"""
std_chroms = []
prob_chroms = []
noalt_ca... | [
"def",
"_maybe_limit_chromosomes",
"(",
"data",
")",
":",
"std_chroms",
"=",
"[",
"]",
"prob_chroms",
"=",
"[",
"]",
"noalt_calling",
"=",
"\"noalt_calling\"",
"in",
"dd",
".",
"get_tools_on",
"(",
"data",
")",
"or",
"\"altcontigs\"",
"in",
"dd",
".",
"get_e... | Potentially limit chromosomes to avoid problematically named HLA contigs.
HLAs have ':' characters in them which confuse downstream processing. If
we have no problematic chromosomes we don't limit anything. | [
"Potentially",
"limit",
"chromosomes",
"to",
"avoid",
"problematically",
"named",
"HLA",
"contigs",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L148-L165 |
223,088 | bcbio/bcbio-nextgen | bcbio/structural/manta.py | _out_of_date | def _out_of_date(rw_file):
"""Check if a run workflow file points to an older version of manta and needs a refresh.
"""
with open(rw_file) as in_handle:
for line in in_handle:
if line.startswith("sys.path.append"):
file_version = line.split("/lib/python")[0].split("Cellar... | python | def _out_of_date(rw_file):
"""Check if a run workflow file points to an older version of manta and needs a refresh.
"""
with open(rw_file) as in_handle:
for line in in_handle:
if line.startswith("sys.path.append"):
file_version = line.split("/lib/python")[0].split("Cellar... | [
"def",
"_out_of_date",
"(",
"rw_file",
")",
":",
"with",
"open",
"(",
"rw_file",
")",
"as",
"in_handle",
":",
"for",
"line",
"in",
"in_handle",
":",
"if",
"line",
".",
"startswith",
"(",
"\"sys.path.append\"",
")",
":",
"file_version",
"=",
"line",
".",
... | Check if a run workflow file points to an older version of manta and needs a refresh. | [
"Check",
"if",
"a",
"run",
"workflow",
"file",
"points",
"to",
"an",
"older",
"version",
"of",
"manta",
"and",
"needs",
"a",
"refresh",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/manta.py#L171-L180 |
223,089 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | _freebayes_options_from_config | def _freebayes_options_from_config(items, config, out_file, region=None):
"""Prepare standard options from configuration input.
Input BED target files are merged to avoid overlapping regions which
cause FreeBayes to call multiple times.
Checks for empty sets of target regions after filtering for high ... | python | def _freebayes_options_from_config(items, config, out_file, region=None):
"""Prepare standard options from configuration input.
Input BED target files are merged to avoid overlapping regions which
cause FreeBayes to call multiple times.
Checks for empty sets of target regions after filtering for high ... | [
"def",
"_freebayes_options_from_config",
"(",
"items",
",",
"config",
",",
"out_file",
",",
"region",
"=",
"None",
")",
":",
"opts",
"=",
"[",
"\"--genotype-qualities\"",
",",
"\"--strict-vcf\"",
"]",
"cur_ploidy",
"=",
"ploidy",
".",
"get_ploidy",
"(",
"items",... | Prepare standard options from configuration input.
Input BED target files are merged to avoid overlapping regions which
cause FreeBayes to call multiple times.
Checks for empty sets of target regions after filtering for high depth,
in which case we should skip the FreeBayes run. | [
"Prepare",
"standard",
"options",
"from",
"configuration",
"input",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L29-L64 |
223,090 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | _add_somatic_opts | def _add_somatic_opts(opts, paired):
"""Add somatic options to current set. See _run_freebayes_paired for references.
"""
if "--min-alternate-fraction" not in opts and "-F" not in opts:
# add minimum reportable allele frequency
# FreeBayes defaults to 20%, but use 10% by default for the
... | python | def _add_somatic_opts(opts, paired):
"""Add somatic options to current set. See _run_freebayes_paired for references.
"""
if "--min-alternate-fraction" not in opts and "-F" not in opts:
# add minimum reportable allele frequency
# FreeBayes defaults to 20%, but use 10% by default for the
... | [
"def",
"_add_somatic_opts",
"(",
"opts",
",",
"paired",
")",
":",
"if",
"\"--min-alternate-fraction\"",
"not",
"in",
"opts",
"and",
"\"-F\"",
"not",
"in",
"opts",
":",
"# add minimum reportable allele frequency",
"# FreeBayes defaults to 20%, but use 10% by default for the",
... | Add somatic options to current set. See _run_freebayes_paired for references. | [
"Add",
"somatic",
"options",
"to",
"current",
"set",
".",
"See",
"_run_freebayes_paired",
"for",
"references",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L66-L79 |
223,091 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | _run_freebayes_caller | def _run_freebayes_caller(align_bams, items, ref_file, assoc_files,
region=None, out_file=None, somatic=None):
"""Detect SNPs and indels with FreeBayes.
Performs post-filtering to remove very low quality variants which
can cause issues feeding into GATK. Breaks variants into indiv... | python | def _run_freebayes_caller(align_bams, items, ref_file, assoc_files,
region=None, out_file=None, somatic=None):
"""Detect SNPs and indels with FreeBayes.
Performs post-filtering to remove very low quality variants which
can cause issues feeding into GATK. Breaks variants into indiv... | [
"def",
"_run_freebayes_caller",
"(",
"align_bams",
",",
"items",
",",
"ref_file",
",",
"assoc_files",
",",
"region",
"=",
"None",
",",
"out_file",
"=",
"None",
",",
"somatic",
"=",
"None",
")",
":",
"config",
"=",
"items",
"[",
"0",
"]",
"[",
"\"config\"... | Detect SNPs and indels with FreeBayes.
Performs post-filtering to remove very low quality variants which
can cause issues feeding into GATK. Breaks variants into individual
allelic primitives for analysis and evaluation. | [
"Detect",
"SNPs",
"and",
"indels",
"with",
"FreeBayes",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L102-L144 |
223,092 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | _check_lods | def _check_lods(parts, tumor_thresh, normal_thresh, indexes):
"""Ensure likelihoods for tumor and normal pass thresholds.
Skipped if no FreeBayes GL annotations available.
"""
try:
gl_index = parts[8].split(":").index("GL")
except ValueError:
return True
try:
tumor_gls =... | python | def _check_lods(parts, tumor_thresh, normal_thresh, indexes):
"""Ensure likelihoods for tumor and normal pass thresholds.
Skipped if no FreeBayes GL annotations available.
"""
try:
gl_index = parts[8].split(":").index("GL")
except ValueError:
return True
try:
tumor_gls =... | [
"def",
"_check_lods",
"(",
"parts",
",",
"tumor_thresh",
",",
"normal_thresh",
",",
"indexes",
")",
":",
"try",
":",
"gl_index",
"=",
"parts",
"[",
"8",
"]",
".",
"split",
"(",
"\":\"",
")",
".",
"index",
"(",
"\"GL\"",
")",
"except",
"ValueError",
":"... | Ensure likelihoods for tumor and normal pass thresholds.
Skipped if no FreeBayes GL annotations available. | [
"Ensure",
"likelihoods",
"for",
"tumor",
"and",
"normal",
"pass",
"thresholds",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L197-L224 |
223,093 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | _check_freqs | def _check_freqs(parts, indexes):
"""Ensure frequency of tumor to normal passes a reasonable threshold.
Avoids calling low frequency tumors also present at low frequency in normals,
which indicates a contamination or persistent error.
"""
thresh_ratio = 2.7
try: # FreeBayes
ao_index = ... | python | def _check_freqs(parts, indexes):
"""Ensure frequency of tumor to normal passes a reasonable threshold.
Avoids calling low frequency tumors also present at low frequency in normals,
which indicates a contamination or persistent error.
"""
thresh_ratio = 2.7
try: # FreeBayes
ao_index = ... | [
"def",
"_check_freqs",
"(",
"parts",
",",
"indexes",
")",
":",
"thresh_ratio",
"=",
"2.7",
"try",
":",
"# FreeBayes",
"ao_index",
"=",
"parts",
"[",
"8",
"]",
".",
"split",
"(",
"\":\"",
")",
".",
"index",
"(",
"\"AO\"",
")",
"ro_index",
"=",
"parts",
... | Ensure frequency of tumor to normal passes a reasonable threshold.
Avoids calling low frequency tumors also present at low frequency in normals,
which indicates a contamination or persistent error. | [
"Ensure",
"frequency",
"of",
"tumor",
"to",
"normal",
"passes",
"a",
"reasonable",
"threshold",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L226-L260 |
223,094 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | _clean_freebayes_output | def _clean_freebayes_output(line):
"""Clean FreeBayes output to make post-processing with GATK happy.
XXX Not applied on recent versions which fix issues to be more compatible
with bgzip output, but retained in case of need.
- Remove lines from FreeBayes outputs where REF/ALT are identical:
2 ... | python | def _clean_freebayes_output(line):
"""Clean FreeBayes output to make post-processing with GATK happy.
XXX Not applied on recent versions which fix issues to be more compatible
with bgzip output, but retained in case of need.
- Remove lines from FreeBayes outputs where REF/ALT are identical:
2 ... | [
"def",
"_clean_freebayes_output",
"(",
"line",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"\"Type=Int,D\"",
",",
"\"Type=Integer,D\"",
")",
"return",
"line",
"else",
":",
"parts",
"=",
"line... | Clean FreeBayes output to make post-processing with GATK happy.
XXX Not applied on recent versions which fix issues to be more compatible
with bgzip output, but retained in case of need.
- Remove lines from FreeBayes outputs where REF/ALT are identical:
2 22816178 . G G ... | [
"Clean",
"FreeBayes",
"output",
"to",
"make",
"post",
"-",
"processing",
"with",
"GATK",
"happy",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L332-L353 |
223,095 | bcbio/bcbio-nextgen | bcbio/variation/freebayes.py | clean_vcf_output | def clean_vcf_output(orig_file, clean_fn, config, name="clean"):
"""Provide framework to clean a file in-place, with the specified clean
function.
"""
base, ext = utils.splitext_plus(orig_file)
out_file = "{0}-{1}{2}".format(base, name, ext)
if not utils.file_exists(out_file):
with open(... | python | def clean_vcf_output(orig_file, clean_fn, config, name="clean"):
"""Provide framework to clean a file in-place, with the specified clean
function.
"""
base, ext = utils.splitext_plus(orig_file)
out_file = "{0}-{1}{2}".format(base, name, ext)
if not utils.file_exists(out_file):
with open(... | [
"def",
"clean_vcf_output",
"(",
"orig_file",
",",
"clean_fn",
",",
"config",
",",
"name",
"=",
"\"clean\"",
")",
":",
"base",
",",
"ext",
"=",
"utils",
".",
"splitext_plus",
"(",
"orig_file",
")",
"out_file",
"=",
"\"{0}-{1}{2}\"",
".",
"format",
"(",
"bas... | Provide framework to clean a file in-place, with the specified clean
function. | [
"Provide",
"framework",
"to",
"clean",
"a",
"file",
"in",
"-",
"place",
"with",
"the",
"specified",
"clean",
"function",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/freebayes.py#L355-L372 |
223,096 | bcbio/bcbio-nextgen | bcbio/variation/effects.py | get_type | def get_type(data):
"""Retrieve the type of effects calculation to do.
"""
if data["analysis"].lower().startswith("var") or dd.get_variantcaller(data):
return tz.get_in(("config", "algorithm", "effects"), data, "snpeff") | python | def get_type(data):
"""Retrieve the type of effects calculation to do.
"""
if data["analysis"].lower().startswith("var") or dd.get_variantcaller(data):
return tz.get_in(("config", "algorithm", "effects"), data, "snpeff") | [
"def",
"get_type",
"(",
"data",
")",
":",
"if",
"data",
"[",
"\"analysis\"",
"]",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"\"var\"",
")",
"or",
"dd",
".",
"get_variantcaller",
"(",
"data",
")",
":",
"return",
"tz",
".",
"get_in",
"(",
"(",
... | Retrieve the type of effects calculation to do. | [
"Retrieve",
"the",
"type",
"of",
"effects",
"calculation",
"to",
"do",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L46-L50 |
223,097 | bcbio/bcbio-nextgen | bcbio/variation/effects.py | prep_vep_cache | def prep_vep_cache(dbkey, ref_file, tooldir=None, config=None):
"""Ensure correct installation of VEP cache file.
"""
if config is None: config = {}
resource_file = os.path.join(os.path.dirname(ref_file), "%s-resources.yaml" % dbkey)
if os.path.exists(resource_file):
with open(resource_file)... | python | def prep_vep_cache(dbkey, ref_file, tooldir=None, config=None):
"""Ensure correct installation of VEP cache file.
"""
if config is None: config = {}
resource_file = os.path.join(os.path.dirname(ref_file), "%s-resources.yaml" % dbkey)
if os.path.exists(resource_file):
with open(resource_file)... | [
"def",
"prep_vep_cache",
"(",
"dbkey",
",",
"ref_file",
",",
"tooldir",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"if",
"config",
"is",
"None",
":",
"config",
"=",
"{",
"}",
"resource_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
... | Ensure correct installation of VEP cache file. | [
"Ensure",
"correct",
"installation",
"of",
"VEP",
"cache",
"file",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L74-L117 |
223,098 | bcbio/bcbio-nextgen | bcbio/variation/effects.py | _get_G2P | def _get_G2P(data):
"""
A VEP plugin that uses G2P allelic requirements to assess variants in genes
for potential phenotype involvement.
"""
G2P_file = os.path.realpath(tz.get_in(("genome_resources", "variation", "genotype2phenotype"), data))
args = ["--plugin", "G2P,file:%s" % (G2P_file)]
i... | python | def _get_G2P(data):
"""
A VEP plugin that uses G2P allelic requirements to assess variants in genes
for potential phenotype involvement.
"""
G2P_file = os.path.realpath(tz.get_in(("genome_resources", "variation", "genotype2phenotype"), data))
args = ["--plugin", "G2P,file:%s" % (G2P_file)]
i... | [
"def",
"_get_G2P",
"(",
"data",
")",
":",
"G2P_file",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"tz",
".",
"get_in",
"(",
"(",
"\"genome_resources\"",
",",
"\"variation\"",
",",
"\"genotype2phenotype\"",
")",
",",
"data",
")",
")",
"args",
"=",
"[",
... | A VEP plugin that uses G2P allelic requirements to assess variants in genes
for potential phenotype involvement. | [
"A",
"VEP",
"plugin",
"that",
"uses",
"G2P",
"allelic",
"requirements",
"to",
"assess",
"variants",
"in",
"genes",
"for",
"potential",
"phenotype",
"involvement",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L234-L244 |
223,099 | bcbio/bcbio-nextgen | bcbio/variation/effects.py | _snpeff_args_from_config | def _snpeff_args_from_config(data):
"""Retrieve snpEff arguments supplied through input configuration.
"""
config = data["config"]
args = ["-hgvs"]
# General supplied arguments
resources = config_utils.get_resources("snpeff", config)
if resources.get("options"):
args += [str(x) for x... | python | def _snpeff_args_from_config(data):
"""Retrieve snpEff arguments supplied through input configuration.
"""
config = data["config"]
args = ["-hgvs"]
# General supplied arguments
resources = config_utils.get_resources("snpeff", config)
if resources.get("options"):
args += [str(x) for x... | [
"def",
"_snpeff_args_from_config",
"(",
"data",
")",
":",
"config",
"=",
"data",
"[",
"\"config\"",
"]",
"args",
"=",
"[",
"\"-hgvs\"",
"]",
"# General supplied arguments",
"resources",
"=",
"config_utils",
".",
"get_resources",
"(",
"\"snpeff\"",
",",
"config",
... | Retrieve snpEff arguments supplied through input configuration. | [
"Retrieve",
"snpEff",
"arguments",
"supplied",
"through",
"input",
"configuration",
"."
] | 6a9348c0054ccd5baffd22f1bb7d0422f6978b20 | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/effects.py#L266-L288 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.